Project

General

Profile

Download (3.36 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 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
# display a cheap menu
58
echo
59
echo
60
echo " pfSense console setup "
61
echo "***********************"
62
echo " 0)  Logout (SSH only)"
63
echo " 1)  Assign Interfaces"
64
echo " 2)  Set interface(s) IP address"
65
echo " 3)  Reset webConfigurator password"
66
echo " 4)  Reset to factory defaults"
67
echo " 5)  Reboot system"
68
echo " 6)  Halt system"
69
echo " 7)  Ping host"
70
echo " 8)  Shell"
71
echo " 9)  PFtop"
72
echo "10)  Filter Logs"
73
echo "11)  Restart webConfigurator"
74
echo "12)  pfSense PHP shell"
75
echo "13)  Upgrade from console"
76
SSHD=`netstat -an | grep "*.22" | wc -l`
77
if [ "$SSHD" -gt 0 ]; then
78
	echo "14)  Disable Secure Shell (sshd)";
79
else
80
	echo "14)  Enable Secure Shell (sshd)";
81
fi
82

    
83
for i in /var/db/pfi/capable_*; do
84
    if [ -f $i -a ! -L /cf/conf ]; then
85
	echo "98)  Move configuration file to removable device"
86
	break
87
    fi
88
done
89

    
90
if [ "$PLATFORM" = "cdrom" ]; then
91
    echo "99)  Install pfSense to a hard drive/memory drive, etc."
92
    echo
93
fi
94

    
95
echo
96
read -p "Enter an option: " opmode
97
echo
98

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

    
173
done
174

    
(41-41/79)