blob: 2bcdfb23d9d3a04cb2600ffa4ccd18d4a6922e0a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
#!/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
# 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/*
|