Project

General

Profile

Download (1.74 KB) Statistics
| Branch: | Tag: | Revision:
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
	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
fi
41

    
42
# Make sure to preserve existing time zone
43
if [ "${PFSENSETYPE}" = "nanobsd" -a -f /etc/localtime ]; then
44
	/bin/cp -p /etc/localtime ${ROOT}etc/localtime 2>/dev/null
45
fi
46

    
47
# Files may contain spaces
48
oIFS=${IFS}
49
IFS="
50
"
51
# 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
			rm -f "${f}"
57
		elif [ -n "${f}" -a -d "${f}" ]; then
58
			rm -rf "${f}"
59
		fi
60
	done
61
fi
62

    
63
# Restore IFS
64
IFS=${oIFS}
(1-1/3)