1 |
5f26831e
|
Scott Ullrich
|
#!/bin/sh
|
2 |
|
|
|
3 |
|
|
/etc/rc.conf_mount_rw
|
4 |
|
|
|
5 |
a90896fd
|
jim-p
|
PFSENSETYPE=`cat /etc/platform`
|
6 |
bff167fd
|
jim-p
|
|
7 |
48f77cef
|
Renato Botelho
|
if [ "${PFSENSETYPE}" = "pfSense" -o "${PFSENSETYPE}" = "nanobsd" ]; then
|
8 |
a90896fd
|
jim-p
|
touch /conf/needs_package_sync
|
9 |
|
|
fi
|
10 |
|
|
|
11 |
b001e0e5
|
Scott Ullrich
|
# Detect interactive logins and display the shell
|
12 |
d4b1e549
|
Renato Botelho
|
detect_command='[ -n "$SSH_TTY" -o "$TERM" = "cons25" ] && exec /etc/rc.initial'
|
13 |
48f77cef
|
Renato Botelho
|
echo "${detect_command}" > ${CVS_CO_DIR}/root/.shrc
|
14 |
|
|
echo "${detect_command}" >> ${CVS_CO_DIR}/root/.profile
|
15 |
|
|
|
16 |
|
|
if [ "${PFSENSETYPE}" = "nanobsd" ]; then
|
17 |
|
|
ROOT=/tmp/${1}/
|
18 |
|
|
else
|
19 |
|
|
ROOT=/
|
20 |
|
|
fi
|
21 |
b001e0e5
|
Scott Ullrich
|
|
22 |
caae9b2c
|
Scott Ullrich
|
# Now turn on or off serial console as needed
|
23 |
48f77cef
|
Renato Botelho
|
echo "Checking for ${ROOT}tmp/post_upgrade_command.php... " >> /conf/upgrade_log.txt
|
24 |
|
|
if [ -x ${ROOT}tmp/post_upgrade_command.php ]; then
|
25 |
|
|
echo "Running ${ROOT}tmp/post_upgrade_command.php $1" >> /conf/upgrade_log.txt
|
26 |
|
|
${ROOT}tmp/post_upgrade_command.php $1 >> /conf/upgrade_log.txt 2>&1
|
27 |
bcca590f
|
jim-p
|
fi
|
28 |
caae9b2c
|
Scott Ullrich
|
|
29 |
24c4023c
|
Scott Ullrich
|
# Remove any previous MD5 sum files
|
30 |
48f77cef
|
Renato Botelho
|
rm -f /root/*.md5 >/dev/null 2>&1
|
31 |
7a291481
|
Scott Ullrich
|
|
32 |
fa92a6a4
|
jim-p
|
# Fixup permissions on installed files
|
33 |
48f77cef
|
Renato Botelho
|
if [ -f ${ROOT}etc/installed_filesystem.mtree ]; then
|
34 |
0e40454d
|
Renato Botelho
|
if [ -x "/tmp/mtree.old" ]; then
|
35 |
|
|
MTREE_BIN=/tmp/mtree.old
|
36 |
|
|
else
|
37 |
|
|
MTREE_BIN=/usr/sbin/mtree
|
38 |
|
|
fi
|
39 |
|
|
${MTREE_BIN} -U -e -q -f ${ROOT}etc/installed_filesystem.mtree -p ${ROOT} > /conf/mtree.log
|
40 |
e7752fc4
|
Renato Botelho
|
fi
|
41 |
495dd804
|
jim-p
|
|
42 |
|
|
# Make sure to preserve existing time zone
|
43 |
48f77cef
|
Renato Botelho
|
if [ "${PFSENSETYPE}" = "nanobsd" -a -f /etc/localtime ]; then
|
44 |
|
|
/bin/cp -p /etc/localtime ${ROOT}etc/localtime 2>/dev/null
|
45 |
495dd804
|
jim-p
|
fi
|
46 |
e7a00514
|
Renato Botelho
|
|
47 |
e09797b0
|
Renato Botelho
|
# Files may contain spaces
|
48 |
|
|
oIFS=${IFS}
|
49 |
|
|
IFS="
|
50 |
|
|
"
|
51 |
e7a00514
|
Renato Botelho
|
# Obsolete files - nanobsd doesn't need it since a new image is installed
|
52 |
|
|
# on the other partition
|
53 |
|
|
if [ "${PFSENSETYPE}" != "nanobsd" -a -f /etc/pfSense.obsoletedfiles ]; then
|
54 |
|
|
for f in $(cat /etc/pfSense.obsoletedfiles); do
|
55 |
|
|
if [ -n "${f}" -a -f "${f}" ]; then
|
56 |
e09797b0
|
Renato Botelho
|
rm -f "${f}"
|
57 |
cc814aef
|
Renato Botelho
|
elif [ -n "${f}" -a -d "${f}" ]; then
|
58 |
e09797b0
|
Renato Botelho
|
rm -rf "${f}"
|
59 |
e7a00514
|
Renato Botelho
|
fi
|
60 |
|
|
done
|
61 |
|
|
fi
|
62 |
e09797b0
|
Renato Botelho
|
|
63 |
|
|
# Restore IFS
|
64 |
|
|
IFS=${oIFS}
|