Project

General

Profile

Download (3.51 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
product=`cat /etc/inc/globals.inc | grep product_name | cut -d'"' -f4`
58
hidebanner=`cat /etc/inc/globals.inc | grep hidebanner | cut -d'"' -f4`
59

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

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

    
93
if [ "$PLATFORM" = "cdrom" ]; then
94
    echo "99)  Install ${product} to a hard drive/memory drive, etc."
95
    echo
96
fi
97

    
98
echo
99
read -p "Enter an option: " opmode
100
echo
101

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

    
176
done
177

    
(46-46/85)