feature: add a "firstboot" button on setup page (#225)

* feature: add a "firstboot" button on setup page

fixes #162

* changed confirmation message
This commit is contained in:
dman776 2018-10-18 11:06:55 -05:00 committed by GitHub
parent b11a4fc95d
commit ea36aa9d06
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 2 deletions

View File

@ -306,6 +306,7 @@ sub reboot_page
my ($link) = @_;
my($lanip, $lanmask, $junk, $lannet);
my $node = nvram_get("node");
$node = "Node" if $node eq "";
$link = "/cgi-bin/status" unless $link;
# is the browser coming from the lan?
@ -348,8 +349,8 @@ sub reboot_page
print "<h1>$node is rebooting</h1><br>\n";
print "<h3>Your browser should return to this node in 60 seconds.</br><br>\n";
print "If something goes astray you can try to connect with<br><br>";
print "<a href='http://localnode.local.mesh:8080/'>http://localnode.local.mesh:8080/</a><br>or<br>\n";
print "<a href='http://$node.local.mesh:8080/'>http://$node.local.mesh:8080/</a></h3>\n";
print "<a href='http://localnode.local.mesh:8080/'>http://localnode.local.mesh:8080/</a><br>\n";
print "or<br><a href='http://$node.local.mesh:8080/'>http://$node.local.mesh:8080/</a></h3>\n" if $node ne "Node";
}
print "</center></body></html>";

View File

@ -453,6 +453,13 @@ if($parms{button_save})
}
system "rm -rf /tmp/web/save";
if($parms{button_firstboot})
{
system "firstboot -y";
reboot_page("/cgi-bin/status");
}
reboot_page("/cgi-bin/status") if $parms{button_reboot};
#
@ -577,6 +584,7 @@ print "<tr><td align=center>
<input type=submit name=button_reset value='Reset Values' title='Revert to the last saved settings'>&nbsp;
<input type=submit name=button_default value='Default Values' title='Set all values to their default'>&nbsp;
<input type=submit name=button_reboot value=Reboot style='font-weight:bold' title='Immediately reboot this node'>
<input type=submit name=button_firstboot value='Reset to Firstboot' onclick=\"return confirm('All config settings and add-on packages will be lost back to first boot state. Continue?')\" title='Reset this node to the initial/firstboot status and reboot.'>
</td></tr>
<tr><td>&nbsp;</td></tr>\n";