1 |
5b237745
|
Scott Ullrich
|
#!/bin/sh
|
2 |
|
|
|
3 |
3b6a207d
|
Scott Ullrich
|
# $Id$
|
4 |
|
|
|
5 |
e5cd29a0
|
Scott Ullrich
|
# /etc/rc - master bootup script, invokes php setup
|
6 |
|
|
# part of pfSense by Scott Ullrich
|
7 |
8ad39798
|
Scott Ullrich
|
# Copyright (C) 2004-2010 Scott Ullrich, All rights reserved.
|
8 |
e5cd29a0
|
Scott Ullrich
|
# originally based on m0n0wall (http://neon1.net/m0n0wall)
|
9 |
5b237745
|
Scott Ullrich
|
# Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
|
10 |
|
|
# All rights reserved.
|
11 |
d8a2ce2c
|
Scott Ullrich
|
|
12 |
|
|
#/bin/stty status '^T'
|
13 |
|
|
#/bin/stty susp '^-' intr '^-' quit '^-'
|
14 |
|
|
|
15 |
|
|
#trap : 2
|
16 |
|
|
#trap : 3
|
17 |
5b237745
|
Scott Ullrich
|
|
18 |
|
|
HOME=/
|
19 |
ce823053
|
Scott Ullrich
|
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
|
20 |
5b237745
|
Scott Ullrich
|
export HOME PATH
|
21 |
|
|
|
22 |
1c44a77d
|
Scott Ullrich
|
# Set our operating platform
|
23 |
e8d0903d
|
Ermal
|
PLATFORM=`/bin/cat /etc/platform`
|
24 |
1c44a77d
|
Scott Ullrich
|
|
25 |
842878b5
|
Scott Ullrich
|
# Set our current version
|
26 |
e8d0903d
|
Ermal
|
version=`/bin/cat /etc/version`
|
27 |
842878b5
|
Scott Ullrich
|
|
28 |
e5323cca
|
jim-p
|
# Setup dumpdev/ddb/savecore"
|
29 |
|
|
echo "Configuring crash dumps..."
|
30 |
|
|
if [ "$PLATFORM" = "pfSense" ]; then
|
31 |
|
|
/etc/rc.dumpon
|
32 |
|
|
fi
|
33 |
|
|
|
34 |
c4995e62
|
Chris Buechler
|
# Mount memory file system if it exists
|
35 |
8022e257
|
Scott Ullrich
|
echo "Mounting filesystems..."
|
36 |
842878b5
|
Scott Ullrich
|
|
37 |
87db1017
|
Scott Ullrich
|
# Handle ZFS read-only case
|
38 |
6bc46900
|
Scott Ullrich
|
if [ "$PLATFORM" = "pfSense" ]; then
|
39 |
|
|
if [ -f /usr/bin/grep ]; then
|
40 |
|
|
WHEREISROOT=`/sbin/mount | /usr/bin/grep " / " | /usr/bin/grep "tank" | /usr/bin/cut -d' ' -f1`
|
41 |
|
|
if [ "$WHEREISROOT" != "" ]; then
|
42 |
|
|
/sbin/zfs set readonly=off $WHEREISROOT
|
43 |
|
|
fi
|
44 |
8a8f51b7
|
Scott Ullrich
|
fi
|
45 |
87db1017
|
Scott Ullrich
|
fi
|
46 |
|
|
|
47 |
842878b5
|
Scott Ullrich
|
if [ "$PLATFORM" = "cdrom" ]; then
|
48 |
|
|
/etc/rc.cdrom
|
49 |
|
|
fi
|
50 |
|
|
|
51 |
|
|
if [ "$PLATFORM" = "embedded" ]; then
|
52 |
6c67a28d
|
jim-p
|
export PKG_TMPDIR=/root/
|
53 |
842878b5
|
Scott Ullrich
|
/etc/rc.embedded
|
54 |
|
|
fi
|
55 |
|
|
|
56 |
|
|
if [ "$PLATFORM" = "nanobsd" ]; then
|
57 |
6c67a28d
|
jim-p
|
export PKG_TMPDIR=/root/
|
58 |
842878b5
|
Scott Ullrich
|
/etc/rc.embedded
|
59 |
|
|
fi
|
60 |
|
|
|
61 |
|
|
if [ "$PLATFORM" = "pfSense" ]; then
|
62 |
e8d0903d
|
Ermal
|
/sbin/mdmfs -S -M -s 4m md /var/run
|
63 |
842878b5
|
Scott Ullrich
|
fi
|
64 |
c4995e62
|
Chris Buechler
|
|
65 |
|
|
# Mount /. If it fails run a fsck.
|
66 |
|
|
if [ ! "$PLATFORM" = "cdrom" ] ; then
|
67 |
ce8efd06
|
Scott Ullrich
|
if [ "$PLATFORM" = "nanobsd" ]; then
|
68 |
842878b5
|
Scott Ullrich
|
/sbin/mount -uw / || (/sbin/fsck -fy; /sbin/mount -uw /)
|
69 |
ce8efd06
|
Scott Ullrich
|
else
|
70 |
|
|
/sbin/mount -a || (/sbin/fsck -fy; /sbin/mount -a)
|
71 |
|
|
fi
|
72 |
842878b5
|
Scott Ullrich
|
# If /conf is a directory, convert it to a symlink to /cf/conf
|
73 |
c4995e62
|
Chris Buechler
|
if [ -d "/conf" ]; then
|
74 |
|
|
# If item is not a symlink then rm and recreate
|
75 |
|
|
CONFPOINTSTO=`readlink /conf`
|
76 |
|
|
if ! test "x$CONFPOINTSTO" = "x/cf/conf"; then
|
77 |
e8d0903d
|
Ermal
|
/bin/rm -rf /conf
|
78 |
|
|
/bin/ln -s /cf/conf /conf
|
79 |
c4995e62
|
Chris Buechler
|
fi
|
80 |
|
|
fi
|
81 |
|
|
fi
|
82 |
|
|
|
83 |
92ac3b3d
|
jim-p
|
# Disable APM on ATA drives. Leaving this on will kill drives long-term, especially laptop drives, by generating excessive Load Cycles.
|
84 |
06fd1952
|
Ermal
|
if [ -f /etc/rc.disable_hdd_apm ]; then
|
85 |
|
|
/etc/rc.disable_hdd_apm
|
86 |
|
|
fi
|
87 |
92ac3b3d
|
jim-p
|
|
88 |
793d3c96
|
smos
|
#Eject CD devices on 3G modems
|
89 |
2f8782fe
|
smos
|
MANUFACTURER="huawei|zte"
|
90 |
|
|
CDDEVICE=`dmesg |egrep -ie "($MANUFACTURER)" | awk -F: '/cd/ {print $1}'`
|
91 |
|
|
if [ "$CDDEVICE" != "" ]; then
|
92 |
|
|
cdcontrol -f /dev/"$CDDEVICE" eject
|
93 |
|
|
fi
|
94 |
793d3c96
|
smos
|
|
95 |
7734aea6
|
Andrew Thompson
|
if [ ! "$PLATFORM" = "jail" ]; then
|
96 |
|
|
# Check to see if a compact flash mountpoint exists
|
97 |
|
|
# If it fails to mount then run a fsck -fy
|
98 |
|
|
if grep -q cf /etc/fstab; then
|
99 |
|
|
/sbin/mount -w /cf 2>/dev/null
|
100 |
|
|
/sbin/mount -uw /cf || \
|
101 |
|
|
(/sbin/umount /cf; /sbin/fsck -fy /cf; /sbin/mount -w /cf)
|
102 |
|
|
fi
|
103 |
c4995e62
|
Chris Buechler
|
fi
|
104 |
|
|
|
105 |
ca3537ba
|
jim-p
|
# sync pw database after mount.
|
106 |
01656166
|
jim-p
|
rm -f /etc/spwd.db.tmp
|
107 |
|
|
/usr/sbin/pwd_mkdb -d /etc/ /etc/master.passwd
|
108 |
ca3537ba
|
jim-p
|
|
109 |
e8d0903d
|
Ermal
|
product=`/usr/bin/grep product_name /etc/inc/globals.inc | /usr/bin/cut -d'"' -f4`
|
110 |
|
|
hideplatform=`/usr/bin/grep hideplatform /etc/inc/globals.inc | /usr/bin/wc -l`
|
111 |
|
|
varrunpath=`/usr/bin/grep varrun_path /etc/inc/globals.inc | /usr/bin/cut -d'"' -f4`
|
112 |
3d7639eb
|
Scott Ullrich
|
|
113 |
6fafc69f
|
Scott Ullrich
|
if [ "$hideplatform" -gt "0" ]; then
|
114 |
3d7639eb
|
Scott Ullrich
|
platformbanner="" # hide the platform
|
115 |
|
|
else
|
116 |
|
|
platformbanner=" on the '${PLATFORM}' platform"
|
117 |
|
|
fi
|
118 |
1c44a77d
|
Scott Ullrich
|
|
119 |
|
|
echo
|
120 |
|
|
cat /etc/ascii-art/pfsense-logo-small.txt
|
121 |
|
|
echo
|
122 |
|
|
echo
|
123 |
ba2cbed4
|
Scott Ullrich
|
echo "Welcome to ${product} ${version} ${platformbanner} ..."
|
124 |
1c44a77d
|
Scott Ullrich
|
echo
|
125 |
|
|
|
126 |
7734aea6
|
Andrew Thompson
|
if [ ! "$PLATFORM" = "jail" ]; then
|
127 |
|
|
# Enable console output if its muted.
|
128 |
|
|
/sbin/conscontrol mute off >/dev/null
|
129 |
|
|
fi
|
130 |
d5f60dba
|
Scott Ullrich
|
|
131 |
5621d2d5
|
Scott Ullrich
|
if [ "$PLATFORM" = "cdrom" ] ; then
|
132 |
|
|
# do nothing for cdrom platform
|
133 |
|
|
elif [ "$PLATFORM" = "embedded" ] ; then
|
134 |
f92e9ff3
|
Scott Ullrich
|
# do nothing for embedded platform
|
135 |
803c0401
|
Scott Ullrich
|
elif [ "$PLATFORM" = "nanobsd" ] ; then
|
136 |
152c18f0
|
Phil Davis
|
# Ensure that old-style PKG packages can be persistent across reboots
|
137 |
cd465e06
|
Scott Ullrich
|
/bin/mkdir -p /root/var/db/pkg
|
138 |
e8d0903d
|
Ermal
|
/bin/rm -rf /var/db/pkg
|
139 |
|
|
/bin/ln -s /root/var/db/pkg/ /var/db/pkg
|
140 |
152c18f0
|
Phil Davis
|
# Ensure that PBI packages can be persistent across reboots
|
141 |
|
|
/bin/mkdir -p /root/var/db/pbi
|
142 |
|
|
/bin/rm -rf /var/db/pbi
|
143 |
|
|
/bin/ln -s /root/var/db/pbi/ /var/db/pbi
|
144 |
7734aea6
|
Andrew Thompson
|
elif [ "$PLATFORM" = "jail" ]; then
|
145 |
|
|
# do nothing for jail platform
|
146 |
c0819d14
|
Jeb Campbell
|
else
|
147 |
3b39d0ac
|
jim-p
|
SWAPDEVICE=`/bin/cat /etc/fstab | /usr/bin/grep swap | /usr/bin/cut -f1`
|
148 |
|
|
/sbin/swapon -a 2>/dev/null >/dev/null
|
149 |
e5323cca
|
jim-p
|
/etc/rc.savecore
|
150 |
98546a74
|
Scott Ullrich
|
fi
|
151 |
5621d2d5
|
Scott Ullrich
|
|
152 |
12bf92ca
|
Scott Ullrich
|
if [ "$PLATFORM" = "cdrom" ] ; then
|
153 |
df40aa86
|
Scott Ullrich
|
echo -n "Mounting unionfs directories..."
|
154 |
e8d0903d
|
Ermal
|
/bin/mkdir /tmp/unionfs
|
155 |
|
|
/bin/mkdir /tmp/unionfs/usr
|
156 |
|
|
/bin/mkdir /tmp/unionfs/root
|
157 |
|
|
/bin/mkdir /tmp/unionfs/sbin
|
158 |
|
|
/bin/mkdir /tmp/unionfs/bin
|
159 |
|
|
/bin/mkdir /tmp/unionfs/boot
|
160 |
|
|
/bin/mkdir /tmp/unionfs/confdefault
|
161 |
|
|
/sbin/mount_unionfs /tmp/unionfs/usr /usr/
|
162 |
|
|
/sbin/mount_unionfs /tmp/unionfs/root /root/
|
163 |
|
|
/sbin/mount_unionfs /tmp/unionfs/bin /bin/
|
164 |
|
|
/sbin/mount_unionfs /tmp/unionfs/sbin /sbin/
|
165 |
|
|
/sbin/mount_unionfs /tmp/unionfs/boot /boot/
|
166 |
|
|
/sbin/mount_unionfs /tmp/unionfs/confdefault /conf.default/
|
167 |
df40aa86
|
Scott Ullrich
|
echo "done."
|
168 |
12bf92ca
|
Scott Ullrich
|
fi
|
169 |
|
|
|
170 |
2e269da2
|
Scott Ullrich
|
echo -n "Creating symlinks..."
|
171 |
895ecb35
|
Scott Ullrich
|
# Make sure symlink is correct on embedded
|
172 |
|
|
if [ "$PLATFORM" = "embedded" ] ; then
|
173 |
e8d0903d
|
Ermal
|
/bin/rm /conf
|
174 |
|
|
/bin/ln -s /cf/conf/ /conf
|
175 |
895ecb35
|
Scott Ullrich
|
fi
|
176 |
|
|
|
177 |
803c0401
|
Scott Ullrich
|
# Make sure symlink is correct on nanobsd
|
178 |
|
|
if [ "$PLATFORM" = "nanobsd" ] ; then
|
179 |
e8d0903d
|
Ermal
|
/bin/rm /conf
|
180 |
|
|
/bin/ln -s /cf/conf/ /conf
|
181 |
803c0401
|
Scott Ullrich
|
fi
|
182 |
|
|
|
183 |
6bab150e
|
Scott Ullrich
|
# Repair symlinks if they are broken
|
184 |
|
|
if [ ! -L /etc/syslog.conf ]; then
|
185 |
e8d0903d
|
Ermal
|
/bin/rm -rf /etc/syslog.conf
|
186 |
|
|
/bin/ln -s /var/etc/syslog.conf /etc/syslog.conf
|
187 |
6bab150e
|
Scott Ullrich
|
fi
|
188 |
|
|
|
189 |
f1cc2287
|
Scott Ullrich
|
# Repair symlinks if they are broken
|
190 |
|
|
if [ ! -L /etc/hosts ]; then
|
191 |
e8d0903d
|
Ermal
|
/bin/rm -rf /etc/hosts
|
192 |
|
|
/bin/ln -s /var/etc/hosts /etc/hosts
|
193 |
c8fcdb2f
|
Scott Ullrich
|
fi
|
194 |
095d04db
|
Scott Ullrich
|
|
195 |
f1cc2287
|
Scott Ullrich
|
if [ ! -L /etc/resolv.conf ]; then
|
196 |
e8d0903d
|
Ermal
|
/bin/rm -rf /etc/resolv.conf
|
197 |
|
|
/bin/ln -s /var/etc/resolv.conf /etc/resolv.conf
|
198 |
f1cc2287
|
Scott Ullrich
|
fi
|
199 |
095d04db
|
Scott Ullrich
|
|
200 |
230787e7
|
Scott Ullrich
|
# Setup compatibility link for packages that
|
201 |
|
|
# have trouble overriding the PREFIX configure
|
202 |
|
|
# argument since we build our packages in a
|
203 |
|
|
# seperated PREFIX area
|
204 |
eb03f14e
|
Chris Buechler
|
# Only create if symlink does not exist.
|
205 |
|
|
if [ ! -h /tmp/tmp ]; then
|
206 |
e8d0903d
|
Ermal
|
/bin/ln -hfs / /tmp/tmp
|
207 |
eb03f14e
|
Chris Buechler
|
fi
|
208 |
230787e7
|
Scott Ullrich
|
|
209 |
4be3f6cf
|
Seth Mos
|
# Make sure our /tmp is 777 + Sticky
|
210 |
3fb8caf2
|
Scott Ullrich
|
if [ ! "$PLATFORM" = "cdrom" ] ; then
|
211 |
e8d0903d
|
Ermal
|
/bin/rm -rf /tmp/*
|
212 |
3fb8caf2
|
Scott Ullrich
|
fi
|
213 |
e8d0903d
|
Ermal
|
/bin/chmod 1777 /tmp
|
214 |
0652f3ae
|
Seth Mos
|
|
215 |
dd64811a
|
Scott Ullrich
|
if [ ! "$PLATFORM" = "cdrom" ] ; then
|
216 |
|
|
# Malloc debugging check
|
217 |
|
|
if [ -L /etc/malloc.conf ]; then
|
218 |
|
|
#ln -s aj /etc/malloc.conf
|
219 |
e8d0903d
|
Ermal
|
/bin/rm /etc/malloc.conf
|
220 |
dd64811a
|
Scott Ullrich
|
fi
|
221 |
cecdf31c
|
Scott Ullrich
|
fi
|
222 |
|
|
|
223 |
6484bb83
|
Scott Ullrich
|
if [ ! -L /etc/dhclient.conf ]; then
|
224 |
e8d0903d
|
Ermal
|
/bin/rm -rf /etc/dhclient.conf
|
225 |
6484bb83
|
Scott Ullrich
|
fi
|
226 |
c8fcdb2f
|
Scott Ullrich
|
|
227 |
bfe6d078
|
Scott Ullrich
|
if [ ! -L /etc/sasyncd.conf ]; then
|
228 |
e8d0903d
|
Ermal
|
/bin/mkdir -p /var/etc/
|
229 |
|
|
/usr/bin/touch /var/etc/sasyncd.conf
|
230 |
|
|
/bin/rm -rf /etc/sasyncd.conf
|
231 |
|
|
/bin/ln -s /var/etc/sasyncd.conf /etc/sasyncd.conf
|
232 |
|
|
/usr/sbin/chown root:wheel /var/etc/sasyncd.conf
|
233 |
|
|
/bin/chmod 0600 /var/etc/sasyncd.conf
|
234 |
bfe6d078
|
Scott Ullrich
|
fi
|
235 |
|
|
|
236 |
544156a7
|
Scott Ullrich
|
if [ ! -d /var/tmp ]; then
|
237 |
e8d0903d
|
Ermal
|
/bin/mkdir -p /var/tmp
|
238 |
544156a7
|
Scott Ullrich
|
fi
|
239 |
4aa70cd8
|
Scott Ullrich
|
|
240 |
544156a7
|
Scott Ullrich
|
if [ ! -d /cf/conf/backup/ ]; then
|
241 |
e8d0903d
|
Ermal
|
/bin/mkdir -p /cf/conf/backup/
|
242 |
544156a7
|
Scott Ullrich
|
fi
|
243 |
d42c2e20
|
Scott Ullrich
|
|
244 |
9f85112d
|
Scott Ullrich
|
# OpenVPN storage
|
245 |
359e3f6a
|
Scott Ullrich
|
if [ ! -d /var/etc/openvpn ]; then
|
246 |
e8d0903d
|
Ermal
|
/bin/mkdir -p /var/etc/openvpn
|
247 |
359e3f6a
|
Scott Ullrich
|
fi
|
248 |
|
|
if [ ! -d /var/etc/openvpn-csc ]; then
|
249 |
e8d0903d
|
Ermal
|
/bin/mkdir -p /var/etc/openvpn-csc
|
250 |
359e3f6a
|
Scott Ullrich
|
fi
|
251 |
67df0c62
|
Scott Ullrich
|
|
252 |
5b237745
|
Scott Ullrich
|
set -T
|
253 |
|
|
trap "echo 'Reboot interrupted'; exit 1" 3
|
254 |
|
|
|
255 |
61f1e2ec
|
Scott Ullrich
|
# Remove old nameserver resolution files
|
256 |
e8d0903d
|
Ermal
|
/bin/rm -f /var/etc/nameserver*
|
257 |
61f1e2ec
|
Scott Ullrich
|
|
258 |
f3677fc5
|
Scott Ullrich
|
# Create uploadbar tmp directory
|
259 |
e8d0903d
|
Ermal
|
/bin/mkdir -p /tmp/uploadbar
|
260 |
|
|
/bin/chmod 0777 /tmp/uploadbar
|
261 |
f3677fc5
|
Scott Ullrich
|
|
262 |
5b237745
|
Scott Ullrich
|
# make some directories in /var
|
263 |
e8d0903d
|
Ermal
|
/bin/mkdir -p /var/run /var/log /var/etc /var/db/entropy /var/at/jobs/ /var/empty 2>/dev/null
|
264 |
|
|
/bin/rm -rf /var/run/*
|
265 |
e8197e56
|
Ermal
|
if [ "$PLATFORM" != "pfSense" ]; then
|
266 |
|
|
/bin/rm /var/log/* 2>/dev/null
|
267 |
|
|
fi
|
268 |
5b237745
|
Scott Ullrich
|
|
269 |
2e269da2
|
Scott Ullrich
|
echo -n "."
|
270 |
71bdd226
|
Warren Baker
|
DISABLESYSLOGCLOG=`/usr/bin/grep -c disablesyslogclog /cf/conf/config.xml`
|
271 |
|
|
ENABLEFIFOLOG=`/usr/bin/grep -c usefifolog /cf/conf/config.xml`
|
272 |
e0c45357
|
jim-p
|
LOG_FILES="system filter dhcpd vpn pptps poes l2tps openvpn portalauth ipsec ppp relayd wireless lighttpd ntpd gateways resolver routing"
|
273 |
973b2663
|
Ermal
|
for logfile in $LOG_FILES; do
|
274 |
|
|
if [ "$DISABLESYSLOGCLOG" -gt "0" ]; then
|
275 |
|
|
/usr/bin/touch /var/log/$logfile.log
|
276 |
8274afc7
|
Scott Ullrich
|
else
|
277 |
973b2663
|
Ermal
|
if [ ! -f /var/log/$logfile.log ]; then
|
278 |
|
|
if [ "$ENABLEFIFOLOG" -gt "0" ]; then
|
279 |
|
|
# generate fifolog files
|
280 |
|
|
/usr/sbin/fifolog_create -s 511488 /var/log/$logfile.log
|
281 |
|
|
else
|
282 |
|
|
/usr/sbin/clog -i -s 512144 /var/log/$logfile.log
|
283 |
|
|
fi
|
284 |
e8197e56
|
Ermal
|
fi
|
285 |
973b2663
|
Ermal
|
fi
|
286 |
|
|
done
|
287 |
|
|
|
288 |
57ecd9b6
|
Scott Ullrich
|
# change permissions on newly created fifolog files.
|
289 |
e8d0903d
|
Ermal
|
/bin/chmod 0600 /var/log/*.log
|
290 |
8d418ca9
|
Scott Ullrich
|
|
291 |
2e269da2
|
Scott Ullrich
|
echo -n "."
|
292 |
7734aea6
|
Andrew Thompson
|
if [ ! "$PLATFORM" = "jail" ]; then
|
293 |
|
|
DEVFS=`/sbin/mount | /usr/bin/grep devfs | /usr/bin/wc -l | /usr/bin/cut -d" " -f8`
|
294 |
|
|
if [ "$DEVFS" = "0" ]; then
|
295 |
|
|
mount_devfs devfs /dev
|
296 |
|
|
fi
|
297 |
f93c5384
|
Scott Ullrich
|
fi
|
298 |
5b237745
|
Scott Ullrich
|
|
299 |
|
|
# Create an initial utmp file
|
300 |
e8d0903d
|
Ermal
|
cd /var/run && /bin/cp /dev/null utmp && /bin/chmod 644 utmp
|
301 |
5b237745
|
Scott Ullrich
|
|
302 |
2e269da2
|
Scott Ullrich
|
echo -n "."
|
303 |
6fe4f291
|
Scott Ullrich
|
/sbin/ldconfig -elf /usr/lib /usr/local/lib /lib
|
304 |
c268f10f
|
Scott Ullrich
|
|
305 |
cdbc61b6
|
Scott Ullrich
|
# Make sure /etc/rc.conf doesn't exist.
|
306 |
|
|
if [ -f /etc/rc.conf ]; then
|
307 |
e8d0903d
|
Ermal
|
/bin/rm -rf /etc/rc.conf
|
308 |
cdbc61b6
|
Scott Ullrich
|
fi
|
309 |
|
|
|
310 |
7734aea6
|
Andrew Thompson
|
if [ ! "$PLATFORM" = "jail" ]; then
|
311 |
|
|
# Launching kbdmux(4)
|
312 |
|
|
if [ -f "/dev/kbdmux0" ]; then
|
313 |
|
|
echo -n "."
|
314 |
|
|
/usr/sbin/kbdcontrol -k /dev/kbdmux0 < /dev/console
|
315 |
|
|
[ -c "/dev/atkbd0" ] && kbdcontrol -a atkbd0 < /dev/console
|
316 |
|
|
[ -c "/dev/ukbd0" ] && kbdcontrol -a ukbd0 < /dev/console
|
317 |
|
|
fi
|
318 |
4e7b2b27
|
Scott Ullrich
|
|
319 |
7734aea6
|
Andrew Thompson
|
# Fire up unionfs if mount points exist.
|
320 |
|
|
if [ -f /dist/uniondirs ]; then
|
321 |
|
|
echo -n "."
|
322 |
|
|
/etc/rc.d/unionfs start
|
323 |
|
|
fi
|
324 |
b1ce7649
|
Scott Ullrich
|
fi
|
325 |
fa8f44ce
|
Scott Ullrich
|
|
326 |
2e269da2
|
Scott Ullrich
|
echo "done."
|
327 |
deff30cd
|
Scott Ullrich
|
|
328 |
64183253
|
Scott Ullrich
|
# Ensure gettytab is of a sane size
|
329 |
|
|
if [ `/bin/ls -la /etc/gettytab | /usr/bin/awk '{ print $5'}` -lt 512 ]; then
|
330 |
|
|
echo ">>> Restoring /etc/gettytab due to unusal size"
|
331 |
|
|
echo ">>> Restoring /etc/gettytab due to unusal size" | /usr/bin/logger
|
332 |
416e6432
|
Ermal
|
/bin/cp /etc/gettytab.bak /etc/gettytab
|
333 |
64183253
|
Scott Ullrich
|
fi
|
334 |
|
|
|
335 |
ad0d7518
|
Scott Ullrich
|
# Recreate capabilities DB
|
336 |
416e6432
|
Ermal
|
/usr/bin/cap_mkdb /etc/login.conf
|
337 |
ad0d7518
|
Scott Ullrich
|
|
338 |
40e46009
|
Scott Ullrich
|
# Run the php.ini setup file and populate
|
339 |
|
|
# /usr/local/etc/php.ini and /usr/local/lib/php.ini
|
340 |
aa840cf9
|
Scott Ullrich
|
/etc/rc.php_ini_setup 2>/tmp/php_errors.txt
|
341 |
0cf5aa69
|
Scott Ullrich
|
|
342 |
206f684d
|
Scott Ullrich
|
# Launch external configuration loader for supported platforms
|
343 |
|
|
if [ "$PLATFORM" = "embedded" ]; then
|
344 |
fb2e53da
|
jim-p
|
/usr/local/bin/php -q /etc/ecl.php
|
345 |
206f684d
|
Scott Ullrich
|
fi
|
346 |
|
|
|
347 |
|
|
# Launch external configuration loader for supported platforms
|
348 |
|
|
if [ "$PLATFORM" = "nanobsd" ]; then
|
349 |
fb2e53da
|
jim-p
|
/usr/local/bin/php -q /etc/ecl.php
|
350 |
206f684d
|
Scott Ullrich
|
fi
|
351 |
|
|
|
352 |
|
|
# Launch external configuration loader for supported platforms
|
353 |
|
|
if [ "$PLATFORM" = "pfSense" ]; then
|
354 |
690d24af
|
Scott Ullrich
|
/usr/local/bin/php -q /etc/ecl.php
|
355 |
206f684d
|
Scott Ullrich
|
fi
|
356 |
|
|
|
357 |
490615d3
|
Scott Ullrich
|
if [ -f /etc/rc.custom_boot_early ]; then
|
358 |
|
|
/bin/echo -n "Launching /etc/rc.custom_boot_early...";
|
359 |
|
|
/etc/rc.custom_boot_early
|
360 |
|
|
echo "Done"
|
361 |
|
|
fi
|
362 |
|
|
|
363 |
01599e5e
|
Ermal
|
/usr/bin/nice -n20 /usr/local/sbin/check_reload_status
|
364 |
e8d0903d
|
Ermal
|
|
365 |
b406ae66
|
Scott Ullrich
|
# let the PHP-based configuration subsystem set up the system now
|
366 |
8e2eb65e
|
Scott Ullrich
|
echo -n "Launching the init system..."
|
367 |
e8d0903d
|
Ermal
|
/bin/rm -f /cf/conf/backup/backup.cache
|
368 |
|
|
/bin/rm -f /root/lighttpd*
|
369 |
|
|
/usr/bin/touch $varrunpath/booting
|
370 |
b406ae66
|
Scott Ullrich
|
/etc/rc.bootup
|
371 |
|
|
|
372 |
c1da5030
|
Scott Ullrich
|
# If a shell was selected from recovery
|
373 |
|
|
# console then just drop to the shell now.
|
374 |
|
|
if [ -f "/tmp/donotbootup" ]; then
|
375 |
b1d04497
|
Scott Ullrich
|
echo "Dropping to recovery shell."
|
376 |
c1da5030
|
Scott Ullrich
|
exit 0
|
377 |
|
|
fi
|
378 |
|
|
|
379 |
0c5e431d
|
Scott Ullrich
|
echo -n "Starting CRON... "
|
380 |
ea83ac64
|
Scott Ullrich
|
cd /tmp && /usr/sbin/cron -s 2>/dev/null
|
381 |
0c5e431d
|
Scott Ullrich
|
echo "done."
|
382 |
3e08b3c1
|
Scott Ullrich
|
|
383 |
5be5825e
|
Scott Ullrich
|
# Start packages
|
384 |
|
|
/etc/rc.start_packages
|
385 |
3bd1bd72
|
Scott Ullrich
|
|
386 |
e8d0903d
|
Ermal
|
/bin/rm -rf /usr/local/pkg/pf/CVS
|
387 |
bc086d51
|
Scott Ullrich
|
|
388 |
0092b3bd
|
mgrooms
|
# Start ping handler every 240 seconds
|
389 |
e8d0903d
|
Ermal
|
/usr/local/bin/minicron 240 /var/run/ping_hosts.pid /usr/local/bin/ping_hosts.sh
|
390 |
f2025e91
|
Scott Ullrich
|
|
391 |
0092b3bd
|
mgrooms
|
# Start account expire handler every hour
|
392 |
41fb483a
|
Ermal
|
/usr/local/bin/minicron 3600 /var/run/expire_accounts.pid /etc/rc.expireaccounts
|
393 |
0092b3bd
|
mgrooms
|
|
394 |
f6ba4bd1
|
Scott Ullrich
|
# Start alias url updater every 24 hours
|
395 |
e8d0903d
|
Ermal
|
/usr/local/bin/minicron 86400 /var/run/update_alias_url_data.pid /etc/rc.update_alias_url_data
|
396 |
f6ba4bd1
|
Scott Ullrich
|
|
397 |
c432da9c
|
Scott Ullrich
|
/bin/chmod a+rw /tmp/.
|
398 |
b569598b
|
Scott Ullrich
|
|
399 |
e393a4a8
|
Scott Ullrich
|
echo "Bootup complete"
|
400 |
416e6432
|
Ermal
|
/bin/rm $varrunpath/booting
|
401 |
1ba9533c
|
Scott Ullrich
|
|
402 |
2d4be1c5
|
Scott Ullrich
|
/usr/local/bin/beep.sh start 2>&1 >/dev/null
|
403 |
e393a4a8
|
Scott Ullrich
|
|
404 |
4171fa68
|
Scott Ullrich
|
# Reset the cache. read-only requires this.
|
405 |
7734aea6
|
Andrew Thompson
|
/bin/rm -f /tmp/config.cache
|
406 |
4171fa68
|
Scott Ullrich
|
|
407 |
d35cf0de
|
Scott Ullrich
|
exit 0
|