Project

General

Profile

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

    
3
# If recovery console shell option has been specified
4
if [ -f "/tmp/donotbootup" ]; then
5
	/usr/bin/env prompt="%B[%n@%m]%b%/(%h)||RecoveryConsoleShell: " /bin/tcsh
6
	rm "/tmp/donotbootup"
7
	echo "Rebooting in 5 seconds... CTRL-C to abort..."
8
	sleep 5
9
	/etc/rc.reboot
10
	exit
11
fi
12

    
13
# $Id$
14
# /etc/rc.initial
15
# part of pfSense by Scott Ullrich
16
# Copyright (C) 2004 Scott Ullrich, All rights reserved.
17
# originally based on m0n0wall (http://neon1.net/m0n0wall)
18
# Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
19
# All rights reserved.
20

    
21
if [ -e /usr/local/etc/rc.d/dev_bootstrap.sh ]; then
22
	echo
23
	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
	echo "During this process, /usr/src is automatically downloaded"
29
	echo "and many supporting files are built, installed, etc."
30
	echo
31
	echo -n "Would you like to tail the progress (y/n) [n]? "
32
	read ANSWER
33
	if [ "$ANSWER" = "y" ]; then
34
		echo
35
		echo "Tailing developer bootstrap process."
36
		echo
37
		echo "Press CTRL-C to abort."
38
		echo
39
		echo "Note, this tailing process will exit once the operation is completed."
40
		echo
41
		tail -f /tmp/bootup_messages
42
	fi
43
fi
44

    
45
# make sure the user can't kill us by pressing Ctrl-C,
46
# ctrl-z, etc.
47
#trap : 2
48
#trap : 3
49
#trap : 4
50

    
51
CONFIG="/cf/conf/config.xml"
52
WORD="https"
53

    
54
# Set our operating platform
55
PLATFORM=`cat /etc/platform`
56

    
57
# endless loop
58
while : ; do
59

    
60
if [ -f /tmp/ttybug ]; then
61
	rm /tmp/ttybug
62
	exit && exit && logout
63
fi
64

    
65
/etc/rc.banner
66

    
67
product=`cat /etc/inc/globals.inc | grep product_name | cut -d'"' -f4`
68
hidebanner=`cat /etc/inc/globals.inc | grep hidebanner | cut -d'"' -f4`
69

    
70
# display a cheap menu
71
echo
72
echo
73
echo " ${product} console setup "
74
echo "***************************"
75
echo " 0)  Logout (SSH only)"
76
echo " 1)  Assign Interfaces"
77
echo " 2)  Set interface(s) IP address"
78
echo " 3)  Reset webConfigurator password"
79
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
echo "10)  Filter Logs"
86
echo "11)  Restart webConfigurator"
87
echo "12)  ${product} PHP shell"
88
echo "13)  Upgrade from console"
89
SSHD=`netstat -an | grep "*.22" | wc -l`
90
if [ "$SSHD" -gt 0 ]; then
91
	echo "14)  Disable Secure Shell (sshd)";
92
else
93
	echo "14)  Enable Secure Shell (sshd)";
94
fi
95

    
96
for i in /var/db/pfi/capable_*; do
97
    if [ -f $i -a ! -L /cf/conf ]; then
98
	echo "98)  Move configuration file to removable device"
99
	break
100
    fi
101
done
102

    
103
if [ "$PLATFORM" = "cdrom" ]; then
104
    echo "99)  Install ${product} to a hard drive/memory drive, etc."
105
    echo
106
fi
107

    
108
echo
109
read -p "Enter an option: " opmode
110
echo
111

    
112
# see what the user has chosen
113
case ${opmode} in
114
0)
115
        exit && exit && logout
116
        ;;
117
1)
118
        /etc/rc.initial.setports
119
        ;;
120
2)
121
        /etc/rc.initial.setlanip
122
        ;;
123
3)
124
        /etc/rc.initial.password
125
        ;;
126
4)
127
        /etc/rc.initial.defaults
128
        ;;
129
5)
130
        /etc/rc.initial.reboot
131
        ;;
132
6)
133
        /etc/rc.initial.halt
134
        ;;
135
7)
136
        /etc/rc.initial.ping
137
        ;;
138
8)
139
        /bin/tcsh
140
        ;;
141
9)
142
        /usr/local/sbin/pftop
143
        ;;
144
10)
145
		/usr/sbin/tcpdump -n -e -ttt -i pflog0
146
		;;
147
11)
148
		/etc/rc.restart_webgui
149
		;;
150
12)
151
		/usr/local/sbin/pfSsh.php
152
		;;
153
13) 
154
		php -f /etc/rc.initial.firmware_update
155
		;;
156
14) 
157
		php -f /etc/rc.initial.toggle_sshd
158
		;;	
159
15)
160
		/etc/rc.banner
161
		;;
162
98)
163
		if [ ! -f /tmp/config_moved ]; then
164
			/etc/rc.initial.store_config_to_removable_device
165
		fi
166
		;;
167
99)
168
		if [ -e /dev/ukbd0 ]; then
169
	    	env TERM=cons25 /scripts/lua_installer
170
		else
171
			/scripts/lua_installer
172
		fi
173
		;;
174
100)
175
    	if grep "$WORD" "$CONFIG"; then
176
			links "https://localhost"
177
    	else
178
			links "http://localhost"
179
    	fi
180
    	;;
181
"")
182
		killall login ; exit
183
		;;
184
esac
185

    
186
done
187

    
(47-47/87)