Project

General

Profile

Download (3.2 KB) Statistics
| Branch: | Tag: | Revision:
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
# check in two places for the old kernel type, since it could have been moved elsewhere in the upgrade process.
8
if [ -f /boot/kernel/pfsense_kernel.txt ]; then
9
	OLDKERNEL=`cat /boot/kernel/pfsense_kernel.txt`
10
else
11
	OLDKERNEL=`cat /tmp/pfsense_kernel.txt`
12
fi
13 a90896fd jim-p
14 e684290f jim-p
# Massage the existing kernel into one that actually exists.
15
#	Leaving old entries so we can bring back other kernels later if desired.
16
case "$OLDKERNEL" in
17
	"wrap")
18
	KERNELTYPE=wrap
19
	;;
20 58d9e380 jim-p
	"wrap_vga")
21
	KERNELTYPE=wrap_vga
22
	;;
23 e684290f jim-p
	"Developers")
24
	KERNELTYPE=SMP
25
	;;
26
	"UP")
27
	KERNELTYPE=SMP
28
	;;
29
	"SMP")
30
	KERNELTYPE=SMP
31
	;;
32
	*)
33 8a0f6ca1 jim-p
	if [ "${PFSENSETYPE}" = "pfSense" ]; then
34
		KERNELTYPE=SMP
35
	elif [ "${PFSENSETYPE}" = "nanobsd" ]; then
36
		KERNELTYPE=WRAP
37
	fi
38 e684290f jim-p
	;;
39
esac
40
41
# Overwrite the old kernel type with what we're using now to reflect what is about to be written out.
42
echo ${KERNELTYPE} > /boot/kernel/pfsense_kernel.txt
43
HAVE_KERNEL=false
44
45 bff167fd jim-p
case "${KERNELTYPE}" in
46 e684290f jim-p
	"wrap")
47
		if [ -f /kernels/kernel_wrap.gz ]; then
48
			HAVE_KERNEL=true
49
			tar xzpf /kernels/kernel_wrap.gz --exclude loader.conf -C /boot/
50
			cp /etc/ttys_wrap /etc/ttys
51
		fi
52
		;;
53 58d9e380 jim-p
	"wrap_vga")
54
		if [ -f /kernels/kernel_wrap_vga.gz ]; then
55
			HAVE_KERNEL=true
56
			tar xzpf /kernels/kernel_wrap_vga.gz --exclude loader.conf -C /boot/
57
		fi
58
		;;
59 e684290f jim-p
	"Developers")
60
		if [ -f /kernels/kernel_Dev.gz ]; then
61
			HAVE_KERNEL=true
62
			tar xzpf /kernels/kernel_Dev.gz --exclude loader.conf -C /boot/
63
		fi
64
		;;
65
	"UP")
66 d63b89af Erik Fonnesbeck
		if [ -f /kernels/kernel_uniprocessor.gz ]; then
67 e684290f jim-p
			HAVE_KERNEL=true
68
			tar xzpf /kernels/kernel_uniprocessor.gz --exclude loader.conf -C /boot/
69
		fi
70
		;;
71
	"SMP")
72
		if [ -f /kernels/kernel_SMP.gz ]; then
73
			HAVE_KERNEL=true
74
			tar xzpf /kernels/kernel_SMP.gz --exclude loader.conf -C /boot/
75
		fi
76
		;;
77
esac
78
79
if [ ${HAVE_KERNEL} = "false" ]; then
80
	echo "ERROR: Unable to locate a kernel upgrade file!"
81
	sleep 5
82 b3191bd2 Scott Ullrich
fi
83 33edf4b9 Scott Ullrich
84 a90896fd jim-p
if [ $PFSENSETYPE = "pfSense" ] || [ $PFSENSETYPE = "nanobsd" ]; then
85
	touch /conf/needs_package_sync
86
fi
87
88 b001e0e5 Scott Ullrich
# Detect interactive logins and display the shell
89 a7401ce7 Lauri Tirkkonen
detect_command='[ -n "$SSH_TTY" -o "$TERM" = "cons25" ] && exec /etc/rc.initial'
90
echo "$detect_command" > $CVS_CO_DIR/root/.shrc
91
echo "$detect_command" >> $CVS_CO_DIR/root/.profile
92 b001e0e5 Scott Ullrich
93 caae9b2c Scott Ullrich
# Now turn on or off serial console as needed
94 baef6be8 jim-p
echo "Checking for /tmp/$1/tmp/post_upgrade_command.php... " >> /conf/upgrade_log.txt
95 bcca590f jim-p
if [ -x /tmp/$1/tmp/post_upgrade_command.php ]; then
96 baef6be8 jim-p
	echo "Running /tmp/$1/tmp/post_upgrade_command.php $1" >> /conf/upgrade_log.txt
97 bcca590f jim-p
	/tmp/$1/tmp/post_upgrade_command.php $1 >> /conf/upgrade_log.txt 2>&1
98
elif [ -f /tmp/post_upgrade_command.php ]; then
99 baef6be8 jim-p
	echo "Running /tmp/post_upgrade_command.php $1" >> /conf/upgrade_log.txt
100 bcca590f jim-p
	/tmp/post_upgrade_command.php $1
101
fi
102 caae9b2c Scott Ullrich
103 24c4023c Scott Ullrich
# Remove any previous MD5 sum files
104
rm -f /root/*.md5
105 7a291481 Scott Ullrich
106
# File moved to pfSense php shell (pfSsh.php)
107
rm -rf /usr/local/sbin/cvs_sync.sh
108
109 988724da Scott Ullrich
if [ $PFSENSETYPE = "embedded" ]; then
110
	cp /etc/ttys_wrap /etc/ttys
111 998bc8a5 Scott Ullrich
fi
112
113
if [ -f /usr/local/sbin/php ]; then
114
	rm /usr/local/sbin/php
115
fi
116 fa92a6a4 jim-p
117
# Fixup permissions on installed files
118
if [ "${PFSENSETYPE}" = "nanobsd" ]; then
119
	MTREECHKDIR=/tmp/${1}/
120
else
121
	MTREECHKDIR=/
122
fi
123
if [ -f ${MTREECHKDIR}etc/pfSense.mtree ]; then
124
	/usr/sbin/mtree -U -e -q -f ${MTREECHKDIR}etc/pfSense.mtree -p ${MTREECHKDIR} > /conf/mtree.log;
125
fi;