Project

General

Profile

Download (3.4 KB) Statistics
| Branch: | Tag: | Revision:
1 5b237745 Scott Ullrich
#!/bin/sh
2
3 1b8df11b Bill Marquette
# $Id$
4 5b237745 Scott Ullrich
# /etc/rc.initial
5 99227fad Scott Ullrich
# part of pfSense by Scott Ullrich
6 e5cd29a0 Scott Ullrich
# Copyright (C) 2004 Scott Ullrich, All rights reserved.
7
# originally based on m0n0wall (http://neon1.net/m0n0wall)
8 5b237745 Scott Ullrich
# Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
9
# All rights reserved.
10 89c5f759 Scott Ullrich
11 d223f533 Scott Ullrich
if [ -e /usr/local/etc/rc.d/dev_bootstrap.sh ]; then
12
	echo
13 f6db5a83 Scott Ullrich
	echo "A developer bootstrap is most likely in progress."
14
	echo "This operation bootstraps all developer files from"
15
	echo "pfSense.com and also FreeBSD.org and builds a ISO"
16
	echo "to verify the environment is sane."
17
	echo
18 2c05cc10 Scott Ullrich
	echo "During this process, /usr/src is automatically downloaded"
19
	echo "and many supporting files are built, installed, etc."
20
	echo
21 45e38645 Scott Ullrich
	echo -n "Would you like to tail the progress (y/n) [n]? "
22 d223f533 Scott Ullrich
	read ANSWER
23
	if [ "$ANSWER" = "y" ]; then
24 74283bbb Scott Ullrich
		echo
25
		echo "Tailing developer bootstrap process."
26 d223f533 Scott Ullrich
		echo
27
		echo "Press CTRL-C to abort."
28
		echo
29 74283bbb Scott Ullrich
		echo "Note, this tailing process will exit once the operation is completed."
30
		echo
31 d223f533 Scott Ullrich
		tail -f /tmp/bootup_messages
32
	fi
33
fi
34
35 cd80a0a8 Scott Ullrich
# make sure the user can't kill us by pressing Ctrl-C,
36
# ctrl-z, etc.
37 e8b82b81 Scott Ullrich
#trap : 2
38
#trap : 3
39
#trap : 4
40 5b237745 Scott Ullrich
41 89c5f759 Scott Ullrich
CONFIG="/cf/conf/config.xml"
42
WORD="https"
43
44 b99acdb9 Scott Ullrich
# Document which terminal launched last
45
# so we can attempt to track down the
46
# rc.initial respawn issues.
47
echo `tty` > /tmp/last_term_seen
48
49 c0c27851 Scott Ullrich
# Set our operating platform
50
PLATFORM=`cat /etc/platform`
51
52 5b237745 Scott Ullrich
# endless loop
53 cdfff204 Scott Ullrich
while : ; do
54 5b237745 Scott Ullrich
55 7c961207 Scott Ullrich
if [ -f /tmp/ttybug ]; then
56
	rm /tmp/ttybug
57
	exit && exit && logout
58
fi
59
60 6a997de8 Scott Ullrich
/etc/rc.banner
61
62 5b237745 Scott Ullrich
# display a cheap menu
63 085127d2 Scott Ullrich
echo
64 223d7e54 Scott Ullrich
echo
65 8a45d75b Scott Ullrich
echo " pfSense console setup "
66
echo "***********************"
67 e1a8dc99 Colin Smith
echo " 0)  Logout (SSH only)"
68
echo " 1)  Assign Interfaces"
69
echo " 2)  Set LAN IP address"
70 029b7cf7 Scott Ullrich
echo " 3)  Reset webConfigurator password"
71 bfcb39c4 Scott Ullrich
echo " 4)  Reset to factory defaults"
72
echo " 5)  Reboot system"
73
echo " 6)  Halt system"
74
echo " 7)  Ping host"
75
echo " 8)  Shell"
76
echo " 9)  PFtop"
77 ef5ebb35 Scott Ullrich
echo "10)  Filter Logs"
78 bb8deb4a Scott Ullrich
echo "11)  Restart webConfigurator"
79 838abde9 Scott Ullrich
echo "12)  pfSense PHP shell"
80 741fe28d Scott Ullrich
echo "13)  Upgrade from console"
81 f321b3a2 Scott Ullrich
for i in /var/db/pfi/capable_*; do
82
    if [ -f $i -a ! -L /cf/conf ]; then
83 4d28b3ec Scott Ullrich
	echo "98)  Move configuration file to removable device"
84 f321b3a2 Scott Ullrich
	break
85 4d28b3ec Scott Ullrich
    fi
86 f321b3a2 Scott Ullrich
done
87 2730fde3 Scott Ullrich
88
if [ "$PLATFORM" = "cdrom" ]; then
89 f446f817 Scott Ullrich
    echo "99)  Install pfSense to a hard drive/memory drive, etc."
90 2730fde3 Scott Ullrich
    echo
91
fi
92 5b237745 Scott Ullrich
93 75c72ffb Scott Ullrich
echo
94 568af189 Colin Smith
read -p "Enter an option: " opmode
95 4df08112 Scott Ullrich
echo
96 5b237745 Scott Ullrich
97
# see what the user has chosen
98
case ${opmode} in
99 debddb24 Scott Ullrich
0)
100 c900e2dc Scott Ullrich
        exit && exit && logout
101
        ;;
102 5b237745 Scott Ullrich
1)
103 cdfff204 Scott Ullrich
        /etc/rc.initial.setports ; sleep 10 ; killall login ; exit
104 c900e2dc Scott Ullrich
        ;;
105 5b237745 Scott Ullrich
2)
106 cdfff204 Scott Ullrich
        /etc/rc.initial.setlanip ; sleep 10 ; killall login ; exit
107 c900e2dc Scott Ullrich
        ;;
108 5b237745 Scott Ullrich
3)
109 c900e2dc Scott Ullrich
        /etc/rc.initial.password
110
        ;;
111 5b237745 Scott Ullrich
4)
112 cdfff204 Scott Ullrich
        /etc/rc.initial.defaults ; sleep 10 ; killall login ; exit
113 c900e2dc Scott Ullrich
        ;;
114 5b237745 Scott Ullrich
5)
115 c900e2dc Scott Ullrich
        /etc/rc.initial.reboot
116
        ;;
117 5b237745 Scott Ullrich
6)
118 c900e2dc Scott Ullrich
        /etc/rc.initial.halt
119
        ;;
120 5b237745 Scott Ullrich
7)
121 c900e2dc Scott Ullrich
        /etc/rc.initial.ping
122
        ;;
123 97a741af Scott Ullrich
8)
124 9607c2a4 Scott Ullrich
        /bin/tcsh
125 c900e2dc Scott Ullrich
        ;;
126 97a741af Scott Ullrich
9)
127 c900e2dc Scott Ullrich
        /usr/local/sbin/pftop
128
        ;;
129 97a741af Scott Ullrich
10)
130 cdfff204 Scott Ullrich
		/usr/sbin/tcpdump -n -e -ttt -i pflog0
131
		;;
132 8b52f644 Scott Ullrich
11)
133 cdfff204 Scott Ullrich
		/etc/rc.restart_webgui
134
		;;
135 dc7e008c Scott Ullrich
12)
136 cdfff204 Scott Ullrich
		/usr/local/sbin/pfSsh.php
137
		;;
138 741fe28d Scott Ullrich
13) 
139 cdfff204 Scott Ullrich
		php -f /etc/rc.initial_firmware_update
140
		;;
141 741fe28d Scott Ullrich
14)
142 cdfff204 Scott Ullrich
		/etc/rc.banner
143
		;;
144 9eb7a7b4 Scott Ullrich
98)
145 cdfff204 Scott Ullrich
		if [ ! -f /tmp/config_moved ]; then
146
			/etc/rc.initial.store_config_to_removable_device
147
		fi
148
		;;
149 c26023b4 Scott Ullrich
99)
150 cdfff204 Scott Ullrich
		if [ -e /dev/ukbd0 ]; then
151
		    env TERM=cons25 /scripts/lua_installer
152
		else
153
	            /scripts/lua_installer
154
		fi
155
		;;
156 f446f817 Scott Ullrich
100)
157 cdfff204 Scott Ullrich
	    if grep "$WORD" "$CONFIG"
158
	    then
159
	    	links "https://localhost"
160
	    else
161
	    	links "http://localhost"
162
	    fi
163
	    ;;
164 2e28c9c7 Scott Ullrich
"")
165
		killall login ; exit
166
	;;
167 5b237745 Scott Ullrich
esac
168
169 cdfff204 Scott Ullrich
done