Use 192.168.1.1 when flashing while on ramdisk (#1154)

This commit is contained in:
Tim Wilkinson 2024-04-03 15:29:15 -07:00 committed by GitHub
parent 608ec75ff8
commit e51fedc394
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 1 deletions

View File

@ -483,6 +483,15 @@ if fw_install and nixio.fs.stat(tmpdir .. "/firmware") then
aredn.info.set_nvram("nodeupgraded", "0")
os.execute("reboot >/dev/null 2>&1")
else
-- Show a different reload address if we're running on the ramdisk
local hostname = "192.168.1.1"
for line in io.lines("/proc/mounts")
do
if line:match("overlay") or line:match("ext4") then
hostname = node .. ".local.mesh"
break
end
end
html.print([[
<center><h2>Firmware will be written in the background.</h2>
<h3>If your computer is connected to the LAN of this node you may need to acquire<br>
@ -490,7 +499,7 @@ if fw_install and nixio.fs.stat(tmpdir .. "/firmware") then
<h3>The node will reboot twice while the configuration is applied<br>
When the node has finished booting you should ensure your computer has<br>
received a new IP address and reconnect with<br>
<a href='http://]] .. node .. [[.local.mesh:8080/'>http://]] .. node .. [[.local.mesh:8080/</a><br>
<a href='http://]] .. hostname .. [[:8080/'>http://]] .. hostname .. [[:8080/</a><br>
This page will automatically reload once the upgrade has completed</h3>
<br><h1 id='countdown'></h1>
</center></body></html>