Project

General

Profile

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