1
|
#!/bin/sh
|
2
|
|
3
|
/etc/rc.conf_mount_rw
|
4
|
|
5
|
PFSENSETYPE=`cat /etc/platform`
|
6
|
|
7
|
if [ "${PFSENSETYPE}" = "pfSense" -o "${PFSENSETYPE}" = "nanobsd" ]; then
|
8
|
touch /conf/needs_package_sync
|
9
|
fi
|
10
|
|
11
|
# Detect interactive logins and display the shell
|
12
|
detect_command='[ -n "$SSH_TTY" -o "$TERM" = "cons25" ] && exec /etc/rc.initial'
|
13
|
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
|
|
22
|
# Now turn on or off serial console as needed
|
23
|
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
|
fi
|
28
|
|
29
|
# Remove any previous MD5 sum files
|
30
|
rm -f /root/*.md5 >/dev/null 2>&1
|
31
|
|
32
|
# Fixup permissions on installed files
|
33
|
if [ -f ${ROOT}etc/installed_filesystem.mtree ]; then
|
34
|
/usr/sbin/mtree -U -e -q -f ${ROOT}etc/installed_filesystem.mtree -p ${ROOT} > /conf/mtree.log
|
35
|
fi
|
36
|
|
37
|
# Make sure to preserve existing time zone
|
38
|
if [ "${PFSENSETYPE}" = "nanobsd" -a -f /etc/localtime ]; then
|
39
|
/bin/cp -p /etc/localtime ${ROOT}etc/localtime 2>/dev/null
|
40
|
fi
|
41
|
|
42
|
# Obsolete files - nanobsd doesn't need it since a new image is installed
|
43
|
# on the other partition
|
44
|
if [ "${PFSENSETYPE}" != "nanobsd" -a -f /etc/pfSense.obsoletedfiles ]; then
|
45
|
for f in $(cat /etc/pfSense.obsoletedfiles); do
|
46
|
if [ -n "${f}" -a -f "${f}" ]; then
|
47
|
rm -f ${f}
|
48
|
fi
|
49
|
done
|
50
|
fi
|