Project

General

Profile

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

    
3
# $Id$
4
# /etc/rc.initial
5
# part of pfSense by Scott Ullrich
6
# Copyright (C) 2004-2010 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
# If recovery console shell option has been specified
18
if [ -f "/tmp/donotbootup" ]; then
19
	/usr/bin/env prompt="%B[%n@%m]%b%/(%h)||RecoveryConsoleShell: " /bin/tcsh
20
	rm "/tmp/donotbootup"
21
	echo "Rebooting in 5 seconds... CTRL-C to abort..."
22
	sleep 5
23
	/etc/rc.reboot
24
	exit
25
fi
26

    
27
CONFIG="/cf/conf/config.xml"
28
WORD="https"
29

    
30
# Set our operating platform
31
PLATFORM=`cat /etc/platform`
32

    
33
# endless loop
34
while : ; do
35

    
36
if [ -f /tmp/ttybug ]; then
37
	rm /tmp/ttybug
38
	exit && exit && logout
39
fi
40

    
41
/etc/rc.banner
42

    
43
product=`grep product_name /etc/inc/globals.inc | cut -d'"' -f4`
44
hidebanner=`grep hidebanner /etc/inc/globals.inc | cut -d'"' -f4`
45

    
46
# Check to see if SSH is listening.
47
SSHD=`/usr/bin/sockstat -4l | grep "*.22" | wc -l`
48
if [ "$SSHD" -gt 0 ]; then
49
	sshd_option="14) Disable Secure Shell (sshd)";
50
else
51
	sshd_option="14) Enable Secure Shell (sshd)";
52
fi
53

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

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

    
65
# display a cheap menu
66
echo ""
67
echo ""
68
echo " 0) Logout (SSH only)                  8) Shell"
69
echo " 1) Assign Interfaces                  9) pfTop"
70
echo " 2) Set interface(s) IP address       10) Filter Logs"
71
echo " 3) Reset webConfigurator password    11) Restart webConfigurator"
72
echo " 4) Reset to factory defaults         12) ${product} Developer Shell"
73
echo " 5) Reboot system                     13) Upgrade from console"
74
echo " 6) Halt system                       ${sshd_option}"
75
echo " 7) Ping host                         ${option98}"
76

    
77
if [ "${option99}" != "" ]; then
78
	/bin/echo "${option99}"
79
fi
80

    
81
echo
82
read -p "Enter an option: " opmode
83
echo
84

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

    
159
done
160

    
(54-54/99)