Project

General

Profile

Download (2.62 KB) Statistics
| Branch: | Tag: | Revision:
1
#!/bin/sh
2

    
3
/etc/rc.conf_mount_rw
4

    
5
PFSENSETYPE=`cat /etc/platform`
6
OLDKERNEL=`cat /boot/kernel/pfsense_kernel.txt`
7

    
8
# Massage the existing kernel into one that actually exists.
9
#	Leaving old entries so we can bring back other kernels later if desired.
10
case "$OLDKERNEL" in
11
	"wrap")
12
	KERNELTYPE=wrap
13
	;;
14
	"wrap_vga")
15
	KERNELTYPE=wrap_vga
16
	;;
17
	"Developers")
18
	KERNELTYPE=SMP
19
	;;
20
	"UP")
21
	KERNELTYPE=SMP
22
	;;
23
	"SMP")
24
	KERNELTYPE=SMP
25
	;;
26
	*)
27
	KERNELTYPE=SMP
28
	;;
29
esac
30

    
31
# Overwrite the old kernel type with what we're using now to reflect what is about to be written out.
32
echo ${KERNELTYPE} > /boot/kernel/pfsense_kernel.txt
33
HAVE_KERNEL=false
34

    
35
case "$KERNELTYPE" in
36
	"wrap")
37
		if [ -f /kernels/kernel_wrap.gz ]; then
38
			HAVE_KERNEL=true
39
			tar xzpf /kernels/kernel_wrap.gz --exclude loader.conf -C /boot/
40
			cp /etc/ttys_wrap /etc/ttys
41
		fi
42
		;;
43
	"wrap_vga")
44
		if [ -f /kernels/kernel_wrap_vga.gz ]; then
45
			HAVE_KERNEL=true
46
			tar xzpf /kernels/kernel_wrap_vga.gz --exclude loader.conf -C /boot/
47
		fi
48
		;;
49
	"Developers")
50
		if [ -f /kernels/kernel_Dev.gz ]; then
51
			HAVE_KERNEL=true
52
			tar xzpf /kernels/kernel_Dev.gz --exclude loader.conf -C /boot/
53
		fi
54
		;;
55
	"UP")
56
		if [ -f /kernels/kernel_uniprocessor.gz ]; then
57
			HAVE_KERNEL=true
58
			tar xzpf /kernels/kernel_uniprocessor.gz --exclude loader.conf -C /boot/
59
		fi
60
		;;
61
	"SMP")
62
		if [ -f /kernels/kernel_SMP.gz ]; then
63
			HAVE_KERNEL=true
64
			tar xzpf /kernels/kernel_SMP.gz --exclude loader.conf -C /boot/
65
		fi
66
		;;
67
esac
68

    
69
if [ ${HAVE_KERNEL} = "false" ]; then
70
	echo "ERROR: Unable to locate a kernel upgrade file!"
71
	sleep 5
72
fi
73

    
74
if [ $PFSENSETYPE = "pfSense" ] || [ $PFSENSETYPE = "nanobsd" ]; then
75
	touch /conf/needs_package_sync
76
fi
77

    
78
# Detect interactive logins and display the shell
79
detect_command='[ -n "$SSH_TTY" -o "$TERM" = "cons25" ] && exec /etc/rc.initial'
80
echo "$detect_command" > $CVS_CO_DIR/root/.shrc
81
echo "$detect_command" >> $CVS_CO_DIR/root/.profile
82

    
83
# Now turn on or off serial console as needed
84
echo "Checking for /tmp/$1/tmp/post_upgrade_command.php... " >> /conf/upgrade_log.txt
85
if [ -x /tmp/$1/tmp/post_upgrade_command.php ]; then
86
	echo "Running /tmp/$1/tmp/post_upgrade_command.php $1" >> /conf/upgrade_log.txt
87
	/tmp/$1/tmp/post_upgrade_command.php $1 >> /conf/upgrade_log.txt 2>&1
88
elif [ -f /tmp/post_upgrade_command.php ]; then
89
	echo "Running /tmp/post_upgrade_command.php $1" >> /conf/upgrade_log.txt
90
	/tmp/post_upgrade_command.php $1
91
fi
92

    
93
# Remove any previous MD5 sum files
94
rm -f /root/*.md5
95

    
96
# File moved to pfSense php shell (pfSsh.php)
97
rm -rf /usr/local/sbin/cvs_sync.sh
98

    
99
if [ $PFSENSETYPE = "embedded" ]; then
100
	cp /etc/ttys_wrap /etc/ttys
101
fi
102

    
103
if [ -f /usr/local/sbin/php ]; then
104
	rm /usr/local/sbin/php
105
fi
(1-1/3)