1
|
#!/bin/sh
|
2
|
|
3
|
# $Id$
|
4
|
# /etc/rc.initial
|
5
|
# part of pfSense by Scott Ullrich
|
6
|
# Copyright (C) 2004 Scott Ullrich, All rights reserved.
|
7
|
# originally based on m0n0wall (http://neon1.net/m0n0wall)
|
8
|
# Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
|
9
|
# All rights reserved.
|
10
|
|
11
|
if [ -e /usr/local/etc/rc.d/dev_bootstrap.sh ]; then
|
12
|
echo
|
13
|
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
|
echo "During this process, /usr/src is automatically downloaded"
|
19
|
echo "and many supporting files are built, installed, etc."
|
20
|
echo
|
21
|
echo -n "Would you like to tail the progress (y/n) [n]? "
|
22
|
read ANSWER
|
23
|
if [ "$ANSWER" = "y" ]; then
|
24
|
echo
|
25
|
echo "Tailing developer bootstrap process."
|
26
|
echo
|
27
|
echo "Press CTRL-C to abort."
|
28
|
echo
|
29
|
echo "Note, this tailing process will exit once the operation is completed."
|
30
|
echo
|
31
|
tail -f /tmp/bootup_messages
|
32
|
fi
|
33
|
fi
|
34
|
|
35
|
# make sure the user can't kill us by pressing Ctrl-C,
|
36
|
# ctrl-z, etc.
|
37
|
#trap : 2
|
38
|
#trap : 3
|
39
|
#trap : 4
|
40
|
|
41
|
CONFIG="/cf/conf/config.xml"
|
42
|
WORD="https"
|
43
|
|
44
|
# Set our operating platform
|
45
|
PLATFORM=`cat /etc/platform`
|
46
|
|
47
|
# endless loop
|
48
|
while : ; do
|
49
|
|
50
|
if [ -f /tmp/ttybug ]; then
|
51
|
rm /tmp/ttybug
|
52
|
exit && exit && logout
|
53
|
fi
|
54
|
|
55
|
/etc/rc.banner
|
56
|
|
57
|
product=`cat /etc/inc/globals.inc | grep product_name | cut -d'"' -f4`
|
58
|
|
59
|
# display a cheap menu
|
60
|
echo
|
61
|
echo
|
62
|
echo " ${product} console setup "
|
63
|
echo "***********************"
|
64
|
echo " 0) Logout (SSH only)"
|
65
|
echo " 1) Assign Interfaces"
|
66
|
echo " 2) Set interface(s) IP address"
|
67
|
echo " 3) Reset webConfigurator password"
|
68
|
echo " 4) Reset to factory defaults"
|
69
|
echo " 5) Reboot system"
|
70
|
echo " 6) Halt system"
|
71
|
echo " 7) Ping host"
|
72
|
echo " 8) Shell"
|
73
|
echo " 9) PFtop"
|
74
|
echo "10) Filter Logs"
|
75
|
echo "11) Restart webConfigurator"
|
76
|
echo "12) ${product} PHP shell"
|
77
|
echo "13) Upgrade from console"
|
78
|
SSHD=`netstat -an | grep "*.22" | wc -l`
|
79
|
if [ "$SSHD" -gt 0 ]; then
|
80
|
echo "14) Disable Secure Shell (sshd)";
|
81
|
else
|
82
|
echo "14) Enable Secure Shell (sshd)";
|
83
|
fi
|
84
|
|
85
|
for i in /var/db/pfi/capable_*; do
|
86
|
if [ -f $i -a ! -L /cf/conf ]; then
|
87
|
echo "98) Move configuration file to removable device"
|
88
|
break
|
89
|
fi
|
90
|
done
|
91
|
|
92
|
if [ "$PLATFORM" = "cdrom" ]; then
|
93
|
echo "99) Install ${product} to a hard drive/memory drive, etc."
|
94
|
echo
|
95
|
fi
|
96
|
|
97
|
echo
|
98
|
read -p "Enter an option: " opmode
|
99
|
echo
|
100
|
|
101
|
# see what the user has chosen
|
102
|
case ${opmode} in
|
103
|
0)
|
104
|
exit && exit && logout
|
105
|
;;
|
106
|
1)
|
107
|
/etc/rc.initial.setports
|
108
|
;;
|
109
|
2)
|
110
|
/etc/rc.initial.setlanip
|
111
|
;;
|
112
|
3)
|
113
|
/etc/rc.initial.password
|
114
|
;;
|
115
|
4)
|
116
|
/etc/rc.initial.defaults
|
117
|
;;
|
118
|
5)
|
119
|
/etc/rc.initial.reboot
|
120
|
;;
|
121
|
6)
|
122
|
/etc/rc.initial.halt
|
123
|
;;
|
124
|
7)
|
125
|
/etc/rc.initial.ping
|
126
|
;;
|
127
|
8)
|
128
|
/bin/tcsh
|
129
|
;;
|
130
|
9)
|
131
|
/usr/local/sbin/pftop
|
132
|
;;
|
133
|
10)
|
134
|
/usr/sbin/tcpdump -n -e -ttt -i pflog0
|
135
|
;;
|
136
|
11)
|
137
|
/etc/rc.restart_webgui
|
138
|
;;
|
139
|
12)
|
140
|
/usr/local/sbin/pfSsh.php
|
141
|
;;
|
142
|
13)
|
143
|
php -f /etc/rc.initial.firmware_update
|
144
|
;;
|
145
|
14)
|
146
|
php -f /etc/rc.initial.toggle_sshd
|
147
|
;;
|
148
|
15)
|
149
|
/etc/rc.banner
|
150
|
;;
|
151
|
98)
|
152
|
if [ ! -f /tmp/config_moved ]; then
|
153
|
/etc/rc.initial.store_config_to_removable_device
|
154
|
fi
|
155
|
;;
|
156
|
99)
|
157
|
if [ -e /dev/ukbd0 ]; then
|
158
|
env TERM=cons25 /scripts/lua_installer
|
159
|
else
|
160
|
/scripts/lua_installer
|
161
|
fi
|
162
|
;;
|
163
|
100)
|
164
|
if grep "$WORD" "$CONFIG"; then
|
165
|
links "https://localhost"
|
166
|
else
|
167
|
links "http://localhost"
|
168
|
fi
|
169
|
;;
|
170
|
"")
|
171
|
killall login ; exit
|
172
|
;;
|
173
|
esac
|
174
|
|
175
|
done
|
176
|
|