diff options
author | Renato Botelho <garga@FreeBSD.org> | 2015-03-11 19:14:16 -0300 |
---|---|---|
committer | Renato Botelho <garga@FreeBSD.org> | 2015-03-11 19:14:27 -0300 |
commit | 3f5e998c9cc7e9cce41a3f5abe4d1be6c272d2c1 (patch) | |
tree | 56b635da7eeb27aca1a609ff55242d76d8737ba8 | |
parent | b6c04ed8382e9f889c110db2b3f56e528970261c (diff) | |
download | pfsense-3f5e998c9cc7e9cce41a3f5abe4d1be6c272d2c1.zip pfsense-3f5e998c9cc7e9cce41a3f5abe4d1be6c272d2c1.tar.gz |
Detect when broken rc.firmware is running, fix it and restart. This should fix #4328
-rw-r--r-- | tmp/pre_upgrade_command | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tmp/pre_upgrade_command b/tmp/pre_upgrade_command index d146187..2bcdfb2 100644 --- a/tmp/pre_upgrade_command +++ b/tmp/pre_upgrade_command @@ -21,6 +21,27 @@ if [ "${PRIOR_VERSION}" = "8" ] && grep -q 'sh /etc/rc.reboot' /etc/rc.firmware; kill ${PID} >/dev/null 2>&1 kill -9 ${PID} >/dev/null 2>&1 sed -i '' -e 's,sh /,/tmp/sh.old /,' /etc/rc.firmware + # To avoid restarting rc.firmware twice because of #4328 + sed -i '' -e '/^restore_chflags()/, /^}/ s/mtree *-PU/mtree -P/' /etc/rc.firmware + /etc/rc.firmware pfSenseupgrade "${IMG}" + exit + fi +fi + +# One more hack to workaround #4328 +if grep -q 'mtree *-PU' /etc/rc.firmware; then + PROC=$(ps axwww | grep '/etc/rc.firmware *pfSenseupgrade') + PID='' + IMG='' + if [ -n "${PROC}" ]; then + PID=$(echo "${PROC}" | awk '{print $1}') + IMG=$(echo "${PROC}" | sed 's,^.*pfSenseupgrade *,,') + fi + + if [ -n "${PID}" -a -n "${IMG}" -a -f "${IMG}" ]; then + kill ${PID} >/dev/null 2>&1 + kill -9 ${PID} >/dev/null 2>&1 + sed -i '' -e '/^restore_chflags()/, /^}/ s/mtree *-PU/mtree -P/' /etc/rc.firmware /etc/rc.firmware pfSenseupgrade "${IMG}" exit fi |