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 |
cd80a0a8
|
Scott Ullrich
|
# make sure the user can't kill us by pressing Ctrl-C,
|
12 |
|
|
# ctrl-z, etc.
|
13 |
5b237745
|
Scott Ullrich
|
trap : 2
|
14 |
|
|
trap : 3
|
15 |
|
|
trap : 4
|
16 |
|
|
|
17 |
89c5f759
|
Scott Ullrich
|
CONFIG="/cf/conf/config.xml"
|
18 |
|
|
WORD="https"
|
19 |
|
|
|
20 |
b99acdb9
|
Scott Ullrich
|
# Document which terminal launched last
|
21 |
|
|
# so we can attempt to track down the
|
22 |
|
|
# rc.initial respawn issues.
|
23 |
|
|
echo `tty` > /tmp/last_term_seen
|
24 |
|
|
|
25 |
c0c27851
|
Scott Ullrich
|
# Set our operating platform
|
26 |
|
|
PLATFORM=`cat /etc/platform`
|
27 |
|
|
|
28 |
5b237745
|
Scott Ullrich
|
# endless loop
|
29 |
|
|
while : ; do
|
30 |
|
|
|
31 |
|
|
/etc/rc.banner
|
32 |
|
|
|
33 |
|
|
# display a cheap menu
|
34 |
085127d2
|
Scott Ullrich
|
echo
|
35 |
223d7e54
|
Scott Ullrich
|
echo
|
36 |
8a45d75b
|
Scott Ullrich
|
echo " pfSense console setup "
|
37 |
|
|
echo "***********************"
|
38 |
e1a8dc99
|
Colin Smith
|
echo " 0) Logout (SSH only)"
|
39 |
|
|
echo " 1) Assign Interfaces"
|
40 |
|
|
echo " 2) Set LAN IP address"
|
41 |
bfcb39c4
|
Scott Ullrich
|
echo " 3) Reset webGUI password"
|
42 |
|
|
echo " 4) Reset to factory defaults"
|
43 |
|
|
echo " 5) Reboot system"
|
44 |
|
|
echo " 6) Halt system"
|
45 |
|
|
echo " 7) Ping host"
|
46 |
|
|
echo " 8) Shell"
|
47 |
|
|
echo " 9) PFtop"
|
48 |
4591490d
|
Scott Ullrich
|
echo "10) Traffic Logs"
|
49 |
bb8deb4a
|
Scott Ullrich
|
echo "11) Restart webConfigurator"
|
50 |
3e2a20cf
|
Scott Ullrich
|
if [ -f /var/db/pfi/capable_* ]; then
|
51 |
4d28b3ec
|
Scott Ullrich
|
if [ ! -L /cf/conf ]; then
|
52 |
|
|
echo "98) Move configuration file to removable device"
|
53 |
|
|
fi
|
54 |
0b6163bd
|
Scott Ullrich
|
fi
|
55 |
2730fde3
|
Scott Ullrich
|
|
56 |
|
|
if [ "$PLATFORM" = "cdrom" ]; then
|
57 |
f446f817
|
Scott Ullrich
|
echo "99) Install pfSense to a hard drive/memory drive, etc."
|
58 |
2730fde3
|
Scott Ullrich
|
echo
|
59 |
|
|
fi
|
60 |
5b237745
|
Scott Ullrich
|
|
61 |
75c72ffb
|
Scott Ullrich
|
echo
|
62 |
568af189
|
Colin Smith
|
read -p "Enter an option: " opmode
|
63 |
4df08112
|
Scott Ullrich
|
echo
|
64 |
5b237745
|
Scott Ullrich
|
|
65 |
|
|
# see what the user has chosen
|
66 |
|
|
case ${opmode} in
|
67 |
debddb24
|
Scott Ullrich
|
0)
|
68 |
c900e2dc
|
Scott Ullrich
|
exit && exit && logout
|
69 |
|
|
;;
|
70 |
5b237745
|
Scott Ullrich
|
1)
|
71 |
c900e2dc
|
Scott Ullrich
|
/etc/rc.initial.setports
|
72 |
|
|
;;
|
73 |
5b237745
|
Scott Ullrich
|
2)
|
74 |
c900e2dc
|
Scott Ullrich
|
/etc/rc.initial.setlanip
|
75 |
|
|
;;
|
76 |
5b237745
|
Scott Ullrich
|
3)
|
77 |
c900e2dc
|
Scott Ullrich
|
/etc/rc.initial.password
|
78 |
|
|
;;
|
79 |
5b237745
|
Scott Ullrich
|
4)
|
80 |
c900e2dc
|
Scott Ullrich
|
/etc/rc.initial.defaults
|
81 |
|
|
;;
|
82 |
5b237745
|
Scott Ullrich
|
5)
|
83 |
c900e2dc
|
Scott Ullrich
|
/etc/rc.initial.reboot
|
84 |
|
|
;;
|
85 |
5b237745
|
Scott Ullrich
|
6)
|
86 |
c900e2dc
|
Scott Ullrich
|
/etc/rc.initial.halt
|
87 |
|
|
;;
|
88 |
5b237745
|
Scott Ullrich
|
7)
|
89 |
c900e2dc
|
Scott Ullrich
|
/etc/rc.initial.ping
|
90 |
|
|
;;
|
91 |
97a741af
|
Scott Ullrich
|
8)
|
92 |
9607c2a4
|
Scott Ullrich
|
/bin/tcsh
|
93 |
c900e2dc
|
Scott Ullrich
|
;;
|
94 |
97a741af
|
Scott Ullrich
|
9)
|
95 |
c900e2dc
|
Scott Ullrich
|
/usr/local/sbin/pftop
|
96 |
|
|
;;
|
97 |
97a741af
|
Scott Ullrich
|
10)
|
98 |
9228eaab
|
Scott Ullrich
|
/usr/sbin/tcpdump -n -e -ttt -i pflog0
|
99 |
|
|
;;
|
100 |
8b52f644
|
Scott Ullrich
|
11)
|
101 |
|
|
/etc/rc.restart_webgui
|
102 |
|
|
;;
|
103 |
9eb7a7b4
|
Scott Ullrich
|
98)
|
104 |
2c69c9f7
|
Scott Ullrich
|
if [ ! -f /tmp/config_moved ]; then
|
105 |
0b6c7bce
|
Scott Ullrich
|
/etc/rc.initial.store_config_to_removable_device
|
106 |
|
|
fi
|
107 |
6e1fe0fc
|
Scott Ullrich
|
;;
|
108 |
c26023b4
|
Scott Ullrich
|
99)
|
109 |
|
|
if [ -e /dev/ukbd0 ]; then
|
110 |
|
|
env TERM=cons25 /scripts/lua_installer
|
111 |
|
|
else
|
112 |
|
|
/scripts/lua_installer
|
113 |
|
|
fi
|
114 |
0b6163bd
|
Scott Ullrich
|
;;
|
115 |
f446f817
|
Scott Ullrich
|
100)
|
116 |
c900e2dc
|
Scott Ullrich
|
if grep "$WORD" "$CONFIG"
|
117 |
|
|
then
|
118 |
|
|
links "https://localhost"
|
119 |
|
|
else
|
120 |
|
|
links "http://localhost"
|
121 |
|
|
fi
|
122 |
|
|
;;
|
123 |
5b237745
|
Scott Ullrich
|
esac
|
124 |
|
|
|
125 |
0c6b7ff1
|
Scott Ullrich
|
sleep 1
|
126 |
|
|
|
127 |
5b237745
|
Scott Ullrich
|
done
|