diff --git a/files/etc/init.d/local b/files/etc/init.d/local index 2f08b314..b94bdcc1 100755 --- a/files/etc/init.d/local +++ b/files/etc/init.d/local @@ -3,6 +3,8 @@ START=99 boot() { + + [ -x /usr/local/bin/bbhn-postupgrade ] && /usr/local/bin/bbhn-postupgrade # extract kamikaze generated vlan config #CMLARA Not needed on BULLETM's maybe needed on other devices diff --git a/files/lib/upgrade/keep.d/bbhn-base b/files/lib/upgrade/keep.d/bbhn-base new file mode 100644 index 00000000..ea161827 --- /dev/null +++ b/files/lib/upgrade/keep.d/bbhn-base @@ -0,0 +1,22 @@ +/etc/config.ap/_setup +/etc/config.ap/_setup.dhcp +/etc/config.ap/_setup.ports +/etc/config.client/_setup +/etc/config.client/_setup.dhcp +/etc/config.client/_setup.ports +/etc/config.mesh/_setup +/etc/config.mesh/_setup.dhcp.dmz +/etc/config.mesh/_setup.dhcp.nat +/etc/config.mesh/_setup.ports.dmz +/etc/config.mesh/_setup.ports.nat +/etc/config.mesh/_setup.services.dmz +/etc/config.mesh/_setup.services.nat +/etc/config.mesh_ap/_setup +/etc/config.mesh_ap/_setup.dhcp +/etc/config.mesh_ap/_setup.ports +/etc/config.router/_setup +/etc/config.router/_setup.dhcp +/etc/config.router/_setup.ports +/etc/httpd.conf +/etc/local/services +/etc/local/uci/hsmmmesh diff --git a/files/usr/local/bin/bbhn-postupgrade b/files/usr/local/bin/bbhn-postupgrade new file mode 100755 index 00000000..ce3f0698 --- /dev/null +++ b/files/usr/local/bin/bbhn-postupgrade @@ -0,0 +1,73 @@ +#!/usr/bin/perl -w -I/www/cgi-bin + +use perlfunc; + +$needsrun=nvram_get("nodeupgraded"); + +if ( ! $needsrun ){ + print "Node not upgraded, exiting\n"; + exit 0; +} + + +#Prep some variables +$node = nvram_get("node"); +$tactical = nvram_get("tactical"); +$mac2 = mac2ip(get_mac("wlan0"), 0); +$dtdmac = mac2ip(get_mac("eth0"), 0); + + +foreach $config ("ap","client","mesh","mesh_ap","router") +{ + + + $cfg = (); + $defaultcfg = (); + + open(TMPCONFFILE, ">/tmp/.${config}_setup") or die; + + foreach $line (`cat /etc/config.$config/_setup`) + { + next if $line =~ /^\s*#/; + next if $line =~ /^\s*$/; + $line =~ /^(\w+)\s*=\s*(.*)$/; + + $cfg{$1} = $2; + } + + foreach $line (`cat /etc/config.$config/_setup.default`) + { + next if $line =~ /^\s*#/; + next if $line =~ /^\s*$/; + $line =~ s//$node/; + $line =~ s//$mac2/; + $line =~ s//$dtdmac/; + $line =~ /^(\w+)\s*=\s*(.*)$/; + $defaultcfg{$1} = $2; + } + + foreach $variable( sort keys %defaultcfg ) + { + if ( $cfg{$variable} ) + { + print TMPCONFFILE "$variable = $cfg{$variable}\n"; + } + else + { + print TMPCONFFILE "$variable = $defaultcfg{$variable}\n"; + } + } + + close (TMPCONFFILE); + + system ("mv /tmp/.${config}_setup /etc/config.$config/_setup"); + print "Updated mode: $config\n"; +} + +$LASTMODE=nvram_get('config'); + +#Commit the new combined config +system ("/usr/local/bin/node-setup -a $LASTMODE"); +nvram_set("nodeupgraded","0"); +print "Rebooting node"; +system ("reboot"); diff --git a/files/www/cgi-bin/admin b/files/www/cgi-bin/admin index 15f69698..0648e2df 100755 --- a/files/www/cgi-bin/admin +++ b/files/www/cgi-bin/admin @@ -174,8 +174,9 @@ if($parms{button_dl_fw} and $parms{dl_fw} ne "default") } } -# install fw -- Force overwrite using MTD device -# Needs a "not $overwrite_firmware" clause once we get sysupgrade working + +# install fw + if($fw_install and -f "$tmpdir/firmware") { my $junk; @@ -185,56 +186,44 @@ if($fw_install and -f "$tmpdir/firmware") print "

The firmware is being updated.

\n"; print "

DO NOT REMOVE POWER UNTIL UPDATE IS FINISHED

\n"; print "
\n"; - print "Writing firmware

\n"; - unless($debug) { - #system "nvram unset config; nvram commit >/dev/null 2>&1"; - nvram_set("config", ""); - open(FILE, "/sbin/mtd write $tmpdir/firmware firmware 2>&1 |") or die; - while(read FILE, $junk, 7) { print "|" } - } - - print " -

The node is rebooting

+ if ( $parms{checkbox_keep_settings} ) + { + nvram_set("nodeupgraded","1"); + print " +

Firmware will be written in the background.

If you are connected to the LAN of this node you may need to acquire a new
DHCP lease and reset any name service caches you may be using.

-

Wait for the Power LED to start blinking, then stop blinking.
-When the DMZ LED turns off you can get your new DHCP lease and reconnect with
+

The node will reboot twice while the configuration is applied
+Wait for the Status 4 LED to start blinking, then stop blinking twice.
+When the Status 4 LED is solid on you can get your new DHCP lease and reconnect with
http://localnode.local.mesh:8080/

"; + open(FILE, "/sbin/sysupgrade -q $tmpdir/firmware 2>&1 |") or die; + } + else + { + print "Writing firmware

\n"; + open(FILE, "/sbin/mtd write $tmpdir/firmware firmware 2>&1 |") or die; + while(read FILE, $junk, 7) { print "|" } + print " +

The node is rebooting

+

If you are connected to the LAN of this node you may need to acquire a new
+DHCP lease and reset any name service caches you may be using.

+

Wait for the Status 4 LED to start blinking, then stop blinking.
+When the Status 4 LED is solid on you can get your new DHCP lease and reconnect with
+http://localnode.local.mesh:8080/

+
+"; + system "/sbin/reboot" unless $debug; - system "/sbin/reboot" unless $debug; + } + } exit; } -# CMLARA: Prepwork for using sysupgrade --- it has some issues with the page not returning that need to be worked on -# install fw -- use sysupgrade - -#if($fw_install and -f "$tmpdir/firmware" and not $overwrite_firmware ) -#{ -# my $junk; -# http_header(); -# html_header("FIRMWARE UPDATE IN PROGRESS", 1); -# print "
\n"; -# print "

The firmware is being updated.



\n"; -# print "

DO NOT REMOVE POWER UNTIL UPDATE IS FINISHED



\n"; -# print "

Wait for the Power LED to start blinking, then stop blinking.
\n"; -# print "When the DMZ LED turns off you can reconnect your browser to the mesh node.

\n"; -# print "

\n"; -# print "Writing firmware

\n"; -# unless($debug) -# { -# open(FILE, "/sbin/sysupgrade -q $tmpdir/firmware 2>&1 |") or die; -# while(read FILE, $junk, 7) { print "|" } -# print "

REBOOTING

\n"; -# print "Click here when the blinking stops and the DMZ LED turns off\n"; -# system "/sbin/reboot"; -# } -# exit; -#} - # install patch if($patch_install and -f "$tmpdir/firmware") @@ -498,6 +487,7 @@ foreach(@fw_images) print "\n"; print "\n"; print "\n"; +print "Keep Settings\n"; print "\n"; print "\n";