summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
Diffstat (limited to 'etc')
-rwxr-xr-xetc/rc.firmware38
-rwxr-xr-xetc/rc.initial.firmware_update13
2 files changed, 31 insertions, 20 deletions
diff --git a/etc/rc.firmware b/etc/rc.firmware
index 8c4eab5..ab17260 100755
--- a/etc/rc.firmware
+++ b/etc/rc.firmware
@@ -87,12 +87,16 @@ enable)
# > /dev/null 2>&1
;;
auto)
+ touch /var/run/firmware.lock
backup_chflags
remove_chflags
/etc/rc.firmware_auto
restore_chflags
;;
upgrade)
+
+ touch /var/run/firmware.lock
+
# wait 5 seconds before beginning
sleep 5
backup_chflags
@@ -149,9 +153,12 @@ upgrade)
fi
;;
pfSenseupgrade)
- # wait 5 seconds before beginning
- sleep 5
+ touch /var/run/firmware.lock
+
+ # wait 1 seconds before beginning
+ sleep 1
+
# Sanity check - bail early if there's no firmware file!
if [ ! -r $IMG ]; then
echo "2nd parameter has not been passed or file does not exist. Exiting." | logger -p daemon.info -i -t Upgrade
@@ -210,10 +217,17 @@ pfSenseupgrade)
# Remove upgrade file
rm -f $IMG
- rm -f /var/run/firmware.lock
+ if [ -e /etc/init_bootloader.sh ]; then
+ sh /etc/init_bootloader.sh
+ fi
- /bin/sync
- sleep 5
+ # If /tmp/post_upgrade_command exists after update
+ # then execute the command.
+ if [ -f /tmp/post_upgrade_command ]; then
+ sh /tmp/post_upgrade_command
+ fi
+
+ rm -f /var/run/firmware.lock
# remount /cf ro
rm -rf /etc/rc.conf
@@ -225,18 +239,12 @@ pfSenseupgrade)
/sbin/mount -r /cf 2>/dev/null
/sbin/umount -f / 2>/dev/null
/sbin/mount -r / 2>/dev/null
- if [ -e /etc/init_bootloader.sh ]; then
- sh /etc/init_bootloader.sh
- fi
+
+ sleep 3
/bin/sync
+ sleep 2
echo "Done." | logger -p daemon.info -i -t Upgrade
- # If /tmp/post_upgrade_command exists after update
- # then execute the command.
- if [ -f /tmp/post_upgrade_command ]; then
- sh /tmp/post_upgrade_command
- fi
-
# If the archive has unpacked a file called
# /tmp/no_upgrade_reboot_required then do
# not reboot after upgrade.
@@ -246,8 +254,10 @@ pfSenseupgrade)
rm -f /var/run/config.lock
sh /etc/rc.reboot
fi
+
;;
delta_update)
+ touch /var/run/firmware.lock
backup_chflags
remove_chflags
binary_update $IMG
diff --git a/etc/rc.initial.firmware_update b/etc/rc.initial.firmware_update
index a9d1064..a6b1011 100755
--- a/etc/rc.initial.firmware_update
+++ b/etc/rc.initial.firmware_update
@@ -153,15 +153,16 @@ function check_for_kernel_file() {
}
function do_upgrade($path, $type) {
- global $fp;
check_for_kernel_file();
- echo "\nOne moment please... Invoking firmware upgrade...\n";
+ echo "\nOne moment please...\nInvoking firmware upgrade... ";
if($type == "bdiff")
- exec("/etc/rc.firmware delta_update $path");
+ mwexec_bg("/etc/rc.firmware delta_update $path");
else
- exec("/etc/rc.firmware pfSenseupgrade $path");
- unlink_if_exists($path);
- die;
+ mwexec_bg("/etc/rc.firmware pfSenseupgrade $path");
+ sleep(1);
+ while(file_exists("{$g['varrun_path']}/firmware.lock"))
+ sleep(1);
+ echo "Done. Rebooting...\n\n";
}
exec("rm -f /root/*.md5");
OpenPOWER on IntegriCloud