Project

General

Profile

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

    
3
# /etc/rc - master bootup script, invokes php setup
4
# part of pfSense by Scott Ullrich
5
# Copyright (C) 2004 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
stty status '^T'
11

    
12
trap : 2
13
trap : 3
14

    
15
HOME=/
16
PATH=/sbin:/bin:/usr/sbin:/usr/bin
17
export HOME PATH
18

    
19
version=`cat /etc/version`
20

    
21
echo
22
echo "Welcome to pfSense ${version} ..."
23
echo
24

    
25
/sbin/mount -a || fsck -y && mount -a
26
SWAPDEVICE=`cat /etc/fstab | grep swap | cut -f1`
27
/sbin/dumpon -v $SWAPDEVICE 2>/dev/null
28
/sbin/swapon -a 2>/dev/null
29
/bin/mkdir -p /usr/savecore 2>/dev/null
30
/sbin/savecore /usr/savecore $SWAPDEVICE
31

    
32
/usr/local/bin/php -f /etc/rc.conf_mount_rw
33

    
34
/etc/rc.d/initrandom start >/dev/null
35
/etc/rc.d/random start >/dev/null
36

    
37
rm -rf /var/run/*
38
rm -rf /tmp/*
39

    
40
set -T
41
trap "echo 'Reboot interrupted'; exit 1" 3
42

    
43
# Create uploadbar tmp directory
44
mkdir /tmp/uploadbar
45
chmod 777 /tmp/uploadbar
46

    
47
# make some directories in /var
48
mkdir /var/run /var/log /var/etc /var/db/ipf 2>/dev/null
49
chmod 0755 /var/db/ipf
50
rm -rf /var/log/*
51

    
52
# generate circular logfiles
53
clog -i -s 262144 /var/log/system.log
54
clog -i -s 262144 /var/log/filter.log
55
clog -i -s 32768 /var/log/dhcpd.log
56
clog -i -s 32768 /var/log/vpn.log
57
clog -i -s 32768 /var/log/portalauth.log
58
chmod 0600 /var/log/system.log /var/log/filter.log /var/log/dhcpd.log /var/log/vpn.log /var/log/portalauth.log
59

    
60
adjkerntz -i
61

    
62
sysctl net.inet.tcp.sack.enable=0
63

    
64
mount_devfs devfs /dev
65

    
66
echo Syncing master.passwd...
67
/usr/sbin/pwd_mkdb -d /etc/ /etc/master.passwd
68

    
69
# Create an initial utmp file
70
cd /var/run && cp /dev/null utmp && chmod 644 utmp
71

    
72
# Build devices database
73
#dev_mkdb
74

    
75
# Run ldconfig
76
/sbin/ldconfig -elf /usr/lib /usr/local/lib /lib
77

    
78
# let the PHP-based configuration subsystem set up the system now
79
/etc/rc.bootup
80

    
81
/usr/local/bin/php -f /etc/rc.conf_mount_rw
82

    
83
echo -n Starting Secure Shell Services...
84
/etc/sshd
85

    
86
echo -n "Starting USB..."
87
/usr/sbin/usbd 2>>/tmp/bootup_messages
88
echo Done.
89

    
90
/usr/sbin/cron 2>>/tmp/bootup_messages
91

    
92
echo -n "Syncing package configurations..."
93
/etc/rc.packages
94
echo Done.
95

    
96
echo "Executing rc.d items..."
97
for FILE in /usr/local/etc/rc.d/*.sh; do
98
    if [ -e $FILE ]; then
99
        echo -n " Starting ${FILE}..."
100
        sh $FILE >>/tmp/bootup_messages 2>&1
101
	echo "Done."
102
    fi
103
done
104

    
105
# one more pass to give package plugins a chance to adjust
106
echo -n "Final firewall setup in progress..."
107
/etc/rc.filter_configure
108
echo "Done."
109

    
110
/usr/local/bin/php -f /etc/rc.conf_mount_ro
111

    
112
echo "Bootup complete"
113

    
114
exit 0
115

    
(19-19/50)