summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Botelho <garga@FreeBSD.org>2014-07-11 08:18:06 -0300
committerRenato Botelho <garga@FreeBSD.org>2014-07-11 08:23:04 -0300
commit720c529f2890708c8dca6264924ec5b1afbf0daf (patch)
tree8be2af6b4b6b0a46b10ab923320b25586cd6e7d5
parent5fbdacc1ec787ddb911a4b5d5d2adb93819efe04 (diff)
downloadpfsense-720c529f2890708c8dca6264924ec5b1afbf0daf.zip
pfsense-720c529f2890708c8dca6264924ec5b1afbf0daf.tar.gz
Fix #3749:
When a full upgrade from 2.1.x to 2.2 is being done, after decompress tarball with 2.2 files, /bin/sh is not able to run a script using syntax 'sh scriptname'. Because of that, /tmp/post_upgrade_command and /etc/rc.reboot are not executed ending on an incomplete and broken update. Since we need to fix it only touching 2.2 files, the only way I found to workaround the situation is to use pre_upgrade_command script to: - Copy /bin/sh to /tmp/sh.old - Change /etc/rc.firmware to use sh.old when calling post_upgrade_command and rc.reboot - Kill current rc.firmware process - Start a new rc.firmware using same parameters This issue doesn't affect nanobsd or 2.2 -> 2.2 updates
-rw-r--r--tmp/pre_upgrade_command20
1 files changed, 20 insertions, 0 deletions
diff --git a/tmp/pre_upgrade_command b/tmp/pre_upgrade_command
index c6bb66c..d146187 100644
--- a/tmp/pre_upgrade_command
+++ b/tmp/pre_upgrade_command
@@ -6,5 +6,25 @@
PRIOR_VERSION=`uname -r | cut -d'.' -f1`
echo $PRIOR_VERSION > /tmp/pre_upgrade_version
+# Hack to workaround ticket #3749
+if [ "${PRIOR_VERSION}" = "8" ] && grep -q 'sh /etc/rc.reboot' /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
+ cp -fp /bin/sh /tmp/sh.old
+ kill ${PID} >/dev/null 2>&1
+ kill -9 ${PID} >/dev/null 2>&1
+ sed -i '' -e 's,sh /,/tmp/sh.old /,' /etc/rc.firmware
+ /etc/rc.firmware pfSenseupgrade "${IMG}"
+ exit
+ fi
+fi
+
rm /boot/kernel/*
OpenPOWER on IntegriCloud