mirror of
https://github.com/pfsense/pfsense.git
synced 2025-10-26 11:38:35 +00:00
58 lines
1.8 KiB
Bash
58 lines
1.8 KiB
Bash
#!/bin/sh
|
|
|
|
/etc/rc.conf_mount_rw
|
|
|
|
# Record the previous version
|
|
PRIOR_VERSION=`uname -r | cut -d'.' -f1`
|
|
echo $PRIOR_VERSION > /tmp/pre_upgrade_version
|
|
|
|
# Activate sync on root filesystem. See ticket #4523
|
|
# Back up original fstab
|
|
/bin/cp /etc/fstab /etc/fstab.orig
|
|
# Activate sync on the root slice only. This will not match NanoBSD since it already has sync,noatime
|
|
/usr/bin/sed -i '' 's/^\(\/.*[[:space:]]*\/[[:space:]]*ufs[[:space:]]*\)rw\([[:space:]]*[[:digit:]][[:space:]]*[[:digit:]]\)$/\1rw,sync\2/' /etc/fstab
|
|
|
|
# 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
|
|
# 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
|
|
fi
|
|
|
|
rm /boot/kernel/*
|
|
|