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
|
# make sure the user can't kill us by pressing Ctrl-C,
|
12
|
# ctrl-z, etc.
|
13
|
trap : 2
|
14
|
trap : 3
|
15
|
trap : 4
|
16
|
|
17
|
CONFIG="/cf/conf/config.xml"
|
18
|
WORD="https"
|
19
|
|
20
|
# 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
|
# Set our operating platform
|
26
|
PLATFORM=`cat /etc/platform`
|
27
|
|
28
|
# endless loop
|
29
|
while : ; do
|
30
|
|
31
|
/etc/rc.banner
|
32
|
|
33
|
# display a cheap menu
|
34
|
echo
|
35
|
echo
|
36
|
echo " pfSense console setup "
|
37
|
echo "***********************"
|
38
|
echo " 0) Logout (SSH only)"
|
39
|
echo " 1) Assign Interfaces"
|
40
|
echo " 2) Set LAN IP address"
|
41
|
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
|
echo "10) Traffic Logs"
|
49
|
echo "11) Restart webConfigurator"
|
50
|
if [ -f /var/db/pfi/capable_* ]; then
|
51
|
if [ ! -L /cf/conf ]; then
|
52
|
echo "98) Move configuration file to removable device"
|
53
|
fi
|
54
|
fi
|
55
|
|
56
|
if [ "$PLATFORM" = "cdrom" ]; then
|
57
|
echo "99) Install pfSense to a hard drive/memory drive, etc."
|
58
|
echo
|
59
|
fi
|
60
|
|
61
|
echo
|
62
|
read -p "Enter an option: " opmode
|
63
|
echo
|
64
|
|
65
|
# see what the user has chosen
|
66
|
case ${opmode} in
|
67
|
0)
|
68
|
exit && exit && logout
|
69
|
;;
|
70
|
1)
|
71
|
/etc/rc.initial.setports
|
72
|
;;
|
73
|
2)
|
74
|
/etc/rc.initial.setlanip
|
75
|
;;
|
76
|
3)
|
77
|
/etc/rc.initial.password
|
78
|
;;
|
79
|
4)
|
80
|
/etc/rc.initial.defaults
|
81
|
;;
|
82
|
5)
|
83
|
/etc/rc.initial.reboot
|
84
|
;;
|
85
|
6)
|
86
|
/etc/rc.initial.halt
|
87
|
;;
|
88
|
7)
|
89
|
/etc/rc.initial.ping
|
90
|
;;
|
91
|
8)
|
92
|
/bin/tcsh
|
93
|
;;
|
94
|
9)
|
95
|
/usr/local/sbin/pftop
|
96
|
;;
|
97
|
10)
|
98
|
/usr/sbin/tcpdump -n -e -ttt -i pflog0
|
99
|
;;
|
100
|
11)
|
101
|
/etc/rc.restart_webgui
|
102
|
;;
|
103
|
98)
|
104
|
if [ ! -f /tmp/config_moved ]; then
|
105
|
/etc/rc.initial.store_config_to_removable_device
|
106
|
fi
|
107
|
;;
|
108
|
99)
|
109
|
if [ -e /dev/ukbd0 ]; then
|
110
|
env TERM=cons25 /scripts/lua_installer
|
111
|
else
|
112
|
/scripts/lua_installer
|
113
|
fi
|
114
|
;;
|
115
|
100)
|
116
|
if grep "$WORD" "$CONFIG"
|
117
|
then
|
118
|
links "https://localhost"
|
119
|
else
|
120
|
links "http://localhost"
|
121
|
fi
|
122
|
;;
|
123
|
esac
|
124
|
|
125
|
sleep 1
|
126
|
|
127
|
done
|
128
|
|