summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2009-04-16 22:20:48 -0400
committerScott Ullrich <sullrich@pfsense.org>2009-04-16 22:21:31 -0400
commit6e75ac00d99903e9ba73bc385b0e152b30996d53 (patch)
tree23128f7119f06c921d1c28211eb80f4319644995 /etc
parent50a9d5b9aae284f3027d00685ab80da6ee6b5e3b (diff)
downloadpfsense-6e75ac00d99903e9ba73bc385b0e152b30996d53.zip
pfsense-6e75ac00d99903e9ba73bc385b0e152b30996d53.tar.gz
Correct ordering, use a lock file. Launch upgrade in bg and look for lock file to guess if upgrade is in progress
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