Keep a copy of old mtree binary during upgrade and use it to avoid crashing. Fixes #4563

This commit is contained in:
Renato Botelho 2015-06-16 07:34:04 -05:00
parent 0ab90dd074
commit 0e40454d52
2 changed files with 8 additions and 2 deletions

View File

@ -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

View File

@ -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}"