Project

General

Profile

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

    
3
# /etc/rc.initial
4
# part of pfSense by Scott Ullrich
5
# Copyright (C) 2004-2011 Scott Ullrich, All rights reserved.
6
# originally based on m0n0wall (http://neon1.net/m0n0wall)
7
# Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
8
# All rights reserved.
9

    
10
# make sure the user can't kill us by pressing Ctrl-C,
11
# ctrl-z, etc.
12
#trap : 2
13
#trap : 3
14
#trap : 4
15

    
16
if [ -f /etc/rc.local ]; then
17
	RCLOCALPWD=`ps awux | grep rc.local | grep -v grep | awk '{ print $2 }'`
18
	if [ "$RCLOCALPWD" = "" ]; then
19
		echo ">>> Launching rc.local in background..."
20
		sh /etc/rc.local &
21
		sleep 1
22
		sh /etc/rc.local.running &
23
	else
24
		if [ -f /etc/rc.local.running ]; then
25
			echo ">>> Launching rc.local.running in background..."
26
			sh /etc/rc.local.running &
27
		fi
28
	fi
29
fi
30

    
31
CONFIG="/cf/conf/config.xml"
32
WORD="https"
33

    
34
# Set our operating platform
35
PLATFORM=`cat /etc/platform`
36

    
37
# endless loop
38
while : ; do
39

    
40
if [ -f /tmp/ttybug ]; then
41
	rm /tmp/ttybug
42
	exit && exit && logout
43
fi
44

    
45
/etc/rc.banner
46

    
47
# Read product_name from $g, defaults to pfSense
48
product=$(/usr/local/sbin/read_global_var product_name pfSense)
49

    
50
# Check to see if SSH is running.
51
if pgrep -q -a -F /var/run/sshd.pid sshd >/dev/null 2>&1; then
52
	sshd_option="14) Disable Secure Shell (sshd)";
53
else
54
	sshd_option="14) Enable Secure Shell (sshd)";
55
fi
56

    
57
for i in /var/db/pfi/capable_*; do
58
	if [ -f $i -a ! -L /cf/conf ]; then
59
		option98="98) Move configuration file to removable device"
60
		break
61
	fi
62
done
63

    
64
if [ "$PLATFORM" = "cdrom" ]; then
65
	option99="99) Install ${product} to a hard drive, etc."
66
fi
67

    
68
# display a cheap menu
69
echo ""
70
echo " 0) Logout (SSH only)                  9) pfTop"
71
echo " 1) Assign Interfaces                 10) Filter Logs"
72
echo " 2) Set interface(s) IP address       11) Restart webConfigurator"
73
echo " 3) Reset webConfigurator password    12) ${product} Developer Shell"
74
echo " 4) Reset to factory defaults         13) Update from console"
75
echo " 5) Reboot system                     ${sshd_option}"
76
echo " 6) Halt system                       15) Restore recent configuration"
77
echo " 7) Ping host                         16) Restart PHP-FPM"
78
echo " 8) Shell"
79
echo " ${option98} "
80

    
81
if [ "${option99}" != "" ]; then
82
	/bin/echo "${option99}"
83
fi
84

    
85
echo
86
read -p "Enter an option: " opmode
87
echo
88

    
89
# see what the user has chosen
90
case ${opmode} in
91
0)
92
	exit && exit && logout
93
	;;
94
1)
95
	/etc/rc.initial.setports
96
	;;
97
2)
98
	/etc/rc.initial.setlanip
99
	;;
100
3)
101
	/etc/rc.initial.password
102
	;;
103
4)
104
	/etc/rc.initial.defaults
105
	;;
106
5)
107
	/etc/rc.initial.reboot
108
	;;
109
6)
110
	/etc/rc.initial.halt
111
	;;
112
7)
113
	/etc/rc.initial.ping
114
	;;
115
8)
116
	/bin/tcsh
117
	;;
118
9)
119
	/usr/local/sbin/pftop
120
	;;
121
10)
122
	/usr/local/sbin/clog -f /var/log/filter.log
123
	;;
124
11 | 111)
125
	/etc/rc.restart_webgui
126
	;;
127
12)
128
	/usr/local/sbin/pfSsh.php
129
	;;
130
13)
131
	/bin/sh /usr/local/sbin/${product}-upgrade
132
	;;
133
14)
134
	php -f /etc/rc.initial.toggle_sshd
135
	;;
136
15)
137
	/etc/rc.restore_config_backup
138
	;;
139
16)
140
	/etc/rc.php-fpm_restart
141
	;;
142
98)
143
	if [ ! -f /tmp/config_moved ]; then
144
		/etc/rc.initial.store_config_to_removable_device
145
	fi
146
	;;
147
99)
148
	if [ -e /dev/ukbd0 ]; then
149
		env TERM=cons25 /scripts/lua_installer
150
	else
151
		/scripts/lua_installer
152
	fi
153
	;;
154
100)
155
	if grep "$WORD" "$CONFIG"; then
156
		links "https://localhost"
157
	else
158
		links "http://localhost"
159
	fi
160
	;;
161
"")
162
	kill $PPID ; exit
163
	;;
164
esac
165

    
166
done
167

    
(53-53/101)