diff --git a/files/usr/lib/lua/aredn/html.lua b/files/usr/lib/lua/aredn/html.lua index 55f272cc..6bbcca4b 100644 --- a/files/usr/lib/lua/aredn/html.lua +++ b/files/usr/lib/lua/aredn/html.lua @@ -194,14 +194,13 @@ function html.wait_for_reboot(delay, countdown, address) const div = document.getElementById("countdown"); if (div) { let t = Math.round(]] .. countdown .. [[ - (Date.now() - start) / 1000); - if (t <= 0) { - div.innerHTML = "" - } - else if (t == 1) { - div.innerHTML = t + " second"; - } - else { - div.innerHTML = t + " seconds"; + div.innerHTML = t <= 0 ? "..." : new Date(1000 * t).toISOString().substring(14, 19); + const cdp = document.getElementById("cdprogress"); + if (cdp) { + if (t < 0) + cdp.removeAttribute("value"); + else + cdp.setAttribute("value", cdp.getAttribute("max") - t); } } } @@ -257,7 +256,6 @@ function html.reboot() html.print("

When the node reboots you get your new DHCP lease and reconnect with
") html.print("http://localnode.local.mesh:8080/
or
") html.print("http://" .. node .. ".local.mesh:8080/

") - html.print("

") else html.header(node .. " rebooting", false) html.wait_for_reboot(20, 120) @@ -269,8 +267,9 @@ function html.reboot() if node ~= "Node" then html.print("or
http://" .. node .. ".local.mesh:8080/") end - html.print("

") end + html.print("

") + html.print("

Time Remaining:

") html.print("") http_footer() os.execute("reboot >/dev/null 2>&1") diff --git a/files/www/cgi-bin/admin b/files/www/cgi-bin/admin index 4222381c..8885c587 100755 --- a/files/www/cgi-bin/admin +++ b/files/www/cgi-bin/admin @@ -113,6 +113,22 @@ function word_wrap(len, lines) return output:sub(1, #output - 1) end +function print_firmware_notice(reboot_when, href_addr, text_addr) + html.print([[ +

Firmware will be written in the background.

+

If your computer is connected to the LAN of this node you may need to acquire
+ a new IP address and reset any name service caches you may be using.

+

The node will reboot ]] .. reboot_when .. [[.
+ When the node has finished booting you should ensure your computer has
+ received a new IP address and reconnect with
+ http://]] .. text_addr .. [[:8080/
+ This page will automatically reload once the upgrade has completed

+

+

Time Remaining:

+
+ ]]) +end + -- read_postdata local parms = {} local firmfile = "" @@ -496,18 +512,7 @@ if fw_install and nixio.fs.stat(tmpdir .. "/firmware") then aredn.info.set_nvram("nodeupgraded", "0") os.execute("reboot >/dev/null 2>&1") else - html.print([[ -

Firmware will be written in the background.

-

If your computer is connected to the LAN of this node you may need to acquire
- a new IP address and reset any name service caches you may be using.

-

The node will reboot twice while the configuration is applied
- When the node has finished booting you should ensure your computer has
- received a new IP address and reconnect with
- http://]] .. displayaddress .. [[:8080/
- This page will automatically reload once the upgrade has completed

-

-
- ]]) + print_firmware_notice("twice while the configuration is applied", displayaddress, displayaddress) http_footer() nixio.fs.remove("/tmp/sysupgradefilelist") upgradecmd = "/usr/local/bin/aredn_sysupgrade -f /tmp/arednsysupgradebackup.tgz -q " .. tmpdir .. "/firmware 2>&1 &" @@ -530,19 +535,7 @@ if fw_install and nixio.fs.stat(tmpdir .. "/firmware") then os.execute("reboot >/dev/null 2>&1") end else - html.print([[ -

Firmware will be written in the background.

-

If your computer is connected to the LAN of this node you may need to acquire
- a new IP address and reset any name service caches you may be using.

-

The node will reboot after the firmware has been written to flash memory
- When the node has finished booting you should ensure your computer has
- received a new IP address and reconnect with
- http://192.168.1.1:8080/
- and continue setup of the node in firstboot state.
- This page will automatically reload once the upgrade has completed

-

-
- ]]) + print_firmware_notice("after the firmware has been written to flash memory", "localnode.local.mesh", "192.168.1.1") http_footer() upgradecmd = "/usr/local/bin/aredn_sysupgrade -q -n " .. tmpdir .. "/firmware 2>&1 &" end