summaryrefslogtreecommitdiffstats
path: root/tmp
diff options
context:
space:
mode:
authorRenato Botelho <garga@FreeBSD.org>2015-06-16 07:34:04 -0500
committerRenato Botelho <garga@FreeBSD.org>2015-06-16 07:34:26 -0500
commit9fced93c2535660b34e9aeeb38e43d53df9d8cf6 (patch)
tree98d159869d4b60b3898258a763825134857baa09 /tmp
parent8f102b09102f73a83e4cae25901fc1c3ce395c5c (diff)
downloadpfsense-9fced93c2535660b34e9aeeb38e43d53df9d8cf6.zip
pfsense-9fced93c2535660b34e9aeeb38e43d53df9d8cf6.tar.gz
Keep a copy of old mtree binary during upgrade and use it to avoid crashing. Fixes #4563
Diffstat (limited to 'tmp')
-rwxr-xr-xtmp/post_upgrade_command7
-rw-r--r--tmp/pre_upgrade_command3
2 files changed, 8 insertions, 2 deletions
diff --git a/tmp/post_upgrade_command b/tmp/post_upgrade_command
index b42ad51..eea691f 100755
--- a/tmp/post_upgrade_command
+++ b/tmp/post_upgrade_command
@@ -31,7 +31,12 @@ rm -f /root/*.md5 >/dev/null 2>&1
# Fixup permissions on installed files
if [ -f ${ROOT}etc/installed_filesystem.mtree ]; then
- /usr/sbin/mtree -U -e -q -f ${ROOT}etc/installed_filesystem.mtree -p ${ROOT} > /conf/mtree.log
+ if [ -x "/tmp/mtree.old" ]; then
+ MTREE_BIN=/tmp/mtree.old
+ else
+ MTREE_BIN=/usr/sbin/mtree
+ fi
+ ${MTREE_BIN} -U -e -q -f ${ROOT}etc/installed_filesystem.mtree -p ${ROOT} > /conf/mtree.log
fi
# Make sure to preserve existing time zone
diff --git a/tmp/pre_upgrade_command b/tmp/pre_upgrade_command
index 435b3dc..5bfd891 100644
--- a/tmp/pre_upgrade_command
+++ b/tmp/pre_upgrade_command
@@ -26,7 +26,8 @@ if [ ${PRIOR_VERSION} -le 8 ] && grep -q 'sh /etc/rc.reboot' /etc/rc.firmware; t
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
+ sed -i '' -e 's,sh /,/tmp/sh.old /,' \
+ -e 's,/usr/sbin/mtree,/tmp/mtree.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}"
OpenPOWER on IntegriCloud