Project

General

Profile

Download (12.6 KB) Statistics
| Branch: | Tag: | Revision:
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 6346f188 jim-p
# Setup ddb on all platforms. On full install it will save the dump, on NanoBSD it will print to console and auto-reboot.
35
if [ ! -z "`sysctl -Nq debug.ddb.scripting.scripts`" ]; then
36
	/sbin/ddb /etc/ddb.conf
37
fi
38
39 990fa101 jim-p
if [ -e /root/force_fsck ]; then
40
	echo "Forcing filesystem check..."
41 ac62a50d Ermal
	/sbin/fsck -y -t ufs /
42 990fa101 jim-p
	if [ "$PLATFORM" = "nanobsd" ]; then
43 ac62a50d Ermal
		/sbin/fsck -y -t ufs /cf
44 990fa101 jim-p
	fi
45
fi
46
47 302c005e Ermal
if [ "${PLATFORM}" = "nanobsd" ]; then
48
	kldstat -qm zfs
49 f74636b6 Renato Botelho
	if [ $? -eq 0 ]; then
50 302c005e Ermal
		kldunload zfs
51
	fi
52
fi
53
54 c4995e62 Chris Buechler
# Mount memory file system if it exists
55 8022e257 Scott Ullrich
echo "Mounting filesystems..."
56 842878b5 Scott Ullrich
57 87db1017 Scott Ullrich
# Handle ZFS read-only case
58 6bc46900 Scott Ullrich
if [ "$PLATFORM" = "pfSense" ]; then
59 302c005e Ermal
	kldstat -qm zfs
60 f74636b6 Renato Botelho
	if [ $? -eq 0 ]; then
61 302c005e Ermal
		ZFSFSAVAILABLE=$(/sbin/zfs mount 2>/dev/null | wc -l)
62 5d6e9640 Renato Botelho
		if [ $ZFSFSAVAILABLE -eq 0 ]; then
63 302c005e Ermal
			kldunload zfs
64
		elif [ -f /usr/bin/grep ]; then
65
			ZFSROOT=`/sbin/zfs mount | /usr/bin/grep ' /$' | /usr/bin/cut -d ' ' -f 1`
66
			if [ "$ZFSROOT" != "" ]; then
67
				/sbin/zfs set readonly=off $ZFSROOT
68
			fi
69 6bc46900 Scott Ullrich
		fi
70 8a8f51b7 Scott Ullrich
	fi
71 87db1017 Scott Ullrich
fi
72
73 e92e83d4 jim-p
if [ "${PLATFORM}" = "cdrom" ]; then
74 842878b5 Scott Ullrich
	/etc/rc.cdrom
75 e92e83d4 jim-p
else
76
	# Mount /. If it fails run a fsck.
77 ce8efd06 Scott Ullrich
	if [ "$PLATFORM" = "nanobsd" ]; then
78 e92e83d4 jim-p
		export PKG_TMPDIR=/root/
79 f5813962 Renato Botelho
		/sbin/mount -uw / 2>/dev/null
80
		mount_rc=$?
81
		attempts=0
82 f74636b6 Renato Botelho
		while [ ${mount_rc} -ne 0 -a ${attempts} -lt 3 ]; do
83 f5813962 Renato Botelho
			/sbin/fsck -y /
84
			/sbin/fsck -y /cf
85
			/sbin/mount -uw / 2>/dev/null
86
			mount_rc=$?
87
			attempts=$((attempts+1))
88
		done
89
	else
90
		/sbin/mount -a 2>/dev/null
91
		mount_rc=$?
92
		attempts=0
93 f74636b6 Renato Botelho
		while [ ${mount_rc} -ne 0 -a ${attempts} -lt 3 ]; do
94 f5813962 Renato Botelho
			/sbin/fsck -y /
95
			/sbin/mount -a 2>/dev/null
96
			mount_rc=$?
97
			attempts=$((attempts+1))
98
		done
99 ce8efd06 Scott Ullrich
	fi
100 e92e83d4 jim-p
101 842878b5 Scott Ullrich
	# If /conf is a directory, convert it to a symlink to /cf/conf
102 c4995e62 Chris Buechler
	if [ -d "/conf" ]; then
103
		# If item is not a symlink then rm and recreate
104 e173dd74 Phil Davis
		CONFPOINTSTO=`readlink /conf`
105
		if ! test "x$CONFPOINTSTO" = "x/cf/conf"; then
106 e8d0903d Ermal
			/bin/rm -rf /conf
107
			/bin/ln -s /cf/conf /conf
108 c4995e62 Chris Buechler
		fi
109
	fi
110 efc0e29a jim-p
111
	if [ ! "$PLATFORM" = "jail" ]; then
112
		# Check to see if a compact flash mountpoint exists
113 ac62a50d Ermal
		# If it fails to mount then run a fsck -y
114 efc0e29a jim-p
		if grep -q cf /etc/fstab; then
115
			/sbin/mount -w /cf 2>/dev/null
116 f5813962 Renato Botelho
			/sbin/mount -uw /cf 2>/dev/null
117
			mount_rc=$?
118
			attempts=0
119 f74636b6 Renato Botelho
			while [ ${mount_rc} -ne 0 -a ${attempts} -lt 3 ]; do
120 f5813962 Renato Botelho
				/sbin/umount /cf
121
				/sbin/fsck -y /cf
122
				/sbin/mount -w /cf 2>/dev/null
123
				mount_rc=$?
124
				attempts=$((attempts+1))
125
			done
126 efc0e29a jim-p
		fi
127
	fi
128
129
	USE_MFS_TMPVAR=`/usr/bin/grep -c use_mfs_tmpvar /cf/conf/config.xml`
130 e61f548f Ermal
	if [ "${PLATFORM}" = "nanobsd" ] || [ ${USE_MFS_TMPVAR} -gt 0 ]; then
131 efc0e29a jim-p
		/etc/rc.embedded
132
	fi
133 c4995e62 Chris Buechler
fi
134
135 990fa101 jim-p
/bin/rm -f /root/force_fsck
136 2085c6de jim-p
/bin/rm -f /root/TRIM_set
137
/bin/rm -f /root/TRIM_unset
138
139 92ac3b3d jim-p
# Disable APM on ATA drives. Leaving this on will kill drives long-term, especially laptop drives, by generating excessive Load Cycles.
140 06fd1952 Ermal
if [ -f /etc/rc.disable_hdd_apm ]; then
141
	/etc/rc.disable_hdd_apm
142
fi
143 92ac3b3d jim-p
144 793d3c96 smos
#Eject CD devices on 3G modems
145 2f8782fe smos
MANUFACTURER="huawei|zte"
146
CDDEVICE=`dmesg |egrep -ie "($MANUFACTURER)" | awk -F: '/cd/ {print $1}'`
147
if [ "$CDDEVICE" != "" ]; then
148
	cdcontrol -f /dev/"$CDDEVICE" eject
149
fi
150 793d3c96 smos
151 ca3537ba jim-p
# sync pw database after mount.
152 01656166 jim-p
rm -f /etc/spwd.db.tmp
153
/usr/sbin/pwd_mkdb -d /etc/ /etc/master.passwd
154 ca3537ba jim-p
155 e8d0903d Ermal
product=`/usr/bin/grep product_name /etc/inc/globals.inc | /usr/bin/cut -d'"' -f4`
156
hideplatform=`/usr/bin/grep hideplatform /etc/inc/globals.inc | /usr/bin/wc -l`
157
varrunpath=`/usr/bin/grep varrun_path /etc/inc/globals.inc | /usr/bin/cut -d'"' -f4`
158 3d7639eb Scott Ullrich
159 b6a63312 jim-p
if [ "$PLATFORM" = "pfSense" ] && [ ${USE_MFS_TMPVAR} -eq 0 ]; then
160 7d3be92f Ermal
	/sbin/mdmfs -S -M -s 4m md $varrunpath
161
fi
162
163 6fafc69f Scott Ullrich
if [ "$hideplatform" -gt "0" ]; then
164 3d7639eb Scott Ullrich
	platformbanner="" # hide the platform
165
else
166
	platformbanner=" on the '${PLATFORM}' platform"
167
fi
168 1c44a77d Scott Ullrich
169
echo
170
cat /etc/ascii-art/pfsense-logo-small.txt
171
echo
172
echo
173 ba2cbed4 Scott Ullrich
echo "Welcome to ${product} ${version} ${platformbanner} ..."
174 1c44a77d Scott Ullrich
echo
175
176 7734aea6 Andrew Thompson
if [ ! "$PLATFORM" = "jail" ]; then
177
	# Enable console output if its muted.
178
	/sbin/conscontrol mute off >/dev/null
179
fi
180 d5f60dba Scott Ullrich
181 5621d2d5 Scott Ullrich
if [ "$PLATFORM" = "cdrom" ] ; then
182
	# do nothing for cdrom platform
183 e92e83d4 jim-p
elif [ "$PLATFORM" = "nanobsd" ] || [ ${USE_MFS_TMPVAR} -gt 0 ]; then
184 152c18f0 Phil Davis
	# Ensure that old-style PKG packages can be persistent across reboots
185 cd465e06 Scott Ullrich
	/bin/mkdir -p /root/var/db/pkg
186 e8d0903d Ermal
	/bin/rm -rf /var/db/pkg
187
	/bin/ln -s /root/var/db/pkg/ /var/db/pkg
188 152c18f0 Phil Davis
	# Ensure that PBI packages can be persistent across reboots
189
	/bin/mkdir -p /root/var/db/pbi
190
	/bin/rm -rf /var/db/pbi
191
	/bin/ln -s /root/var/db/pbi/ /var/db/pbi
192 7734aea6 Andrew Thompson
elif [ "$PLATFORM" = "jail" ]; then
193
	# do nothing for jail platform
194 c0819d14 Jeb Campbell
else
195 3b39d0ac jim-p
	SWAPDEVICE=`/bin/cat /etc/fstab | /usr/bin/grep swap | /usr/bin/cut -f1`
196
	/sbin/swapon -a 2>/dev/null >/dev/null
197 e5323cca jim-p
	/etc/rc.savecore
198 e92e83d4 jim-p
199
	if [ -d /root/var/db/pkg ]; then
200
		# User must have just disabled RAM disks, move these back into place.
201
		/bin/mkdir -p /var/db/pkg
202
		/bin/mv /root/var/db/pkg /var/db/pkg
203
		/bin/mkdir -p /var/db/pbi
204 485cc436 Renato Botelho
		/bin/mv /root/var/db/pbi /var/db/pbi
205 e92e83d4 jim-p
	fi
206 98546a74 Scott Ullrich
fi
207 5621d2d5 Scott Ullrich
208 0ffc4a7b Renato Botelho
# Copy PBI keys
209
if ls /usr/local/share/pbi-keys/*.ssl >/dev/null 2>&1; then
210
	if [ ! -d "/var/db/pbi/keys" ]; then
211
		mkdir -p /var/db/pbi/keys
212
	fi
213
	cp -f /usr/local/share/pbi-keys/*.ssl /var/db/pbi/keys
214
fi
215
216 12bf92ca Scott Ullrich
if [ "$PLATFORM" = "cdrom" ] ; then
217 df40aa86 Scott Ullrich
	echo -n "Mounting unionfs directories..."
218 e8d0903d Ermal
	/bin/mkdir /tmp/unionfs
219
	/bin/mkdir /tmp/unionfs/usr
220
	/bin/mkdir /tmp/unionfs/root
221
	/bin/mkdir /tmp/unionfs/sbin
222
	/bin/mkdir /tmp/unionfs/bin
223
	/bin/mkdir /tmp/unionfs/boot
224
	/bin/mkdir /tmp/unionfs/confdefault
225
	/sbin/mount_unionfs /tmp/unionfs/usr /usr/
226
	/sbin/mount_unionfs /tmp/unionfs/root /root/
227 e173dd74 Phil Davis
	/sbin/mount_unionfs /tmp/unionfs/bin /bin/
228
	/sbin/mount_unionfs /tmp/unionfs/sbin /sbin/
229 e8d0903d Ermal
	/sbin/mount_unionfs /tmp/unionfs/boot /boot/
230
	/sbin/mount_unionfs /tmp/unionfs/confdefault /conf.default/
231 df40aa86 Scott Ullrich
	echo "done."
232 12bf92ca Scott Ullrich
fi
233
234 080b4ce1 Ermal
# make some directories in /var
235 1a28657c Ermal LUÇI
/bin/mkdir -p $varrunpath /var/log /var/etc /var/db/entropy /var/db/rrd /var/at/jobs/ /var/empty 2>/dev/null
236 080b4ce1 Ermal
/bin/rm -rf $varrunpath/*
237
if [ "$PLATFORM" != "pfSense" ]; then
238
	/bin/rm /var/log/* 2>/dev/null
239
fi
240
241 9e9bc51c Ermal
# Cleanup configuration files from previous instance
242
/bin/rm -rf /var/etc/*
243 24450773 Ermal
/bin/rm -rf /var/tmp/*
244 9e9bc51c Ermal
245 2e269da2 Scott Ullrich
echo -n "Creating symlinks..."
246 803c0401 Scott Ullrich
# Make sure symlink is correct on nanobsd
247
if [ "$PLATFORM" = "nanobsd" ] ; then
248 e8d0903d Ermal
	/bin/rm /conf
249
	/bin/ln -s /cf/conf/ /conf
250 803c0401 Scott Ullrich
fi
251
252 6bab150e Scott Ullrich
# Repair symlinks if they are broken
253 080b4ce1 Ermal
if [ -f /etc/newsyslog.conf ]; then
254
	/bin/rm -f /etc/newsyslog.conf
255
fi
256 6bab150e Scott Ullrich
if [ ! -L /etc/syslog.conf ]; then
257 e8d0903d Ermal
	/bin/rm -rf /etc/syslog.conf
258 9e9bc51c Ermal
	if [ ! -f /var/etc/syslog.conf ]; then
259
		touch /var/etc/syslog.conf
260
	fi
261 e8d0903d Ermal
	/bin/ln -s /var/etc/syslog.conf /etc/syslog.conf
262 6bab150e Scott Ullrich
fi
263
264 f1cc2287 Scott Ullrich
# Repair symlinks if they are broken
265
if [ ! -L /etc/hosts ]; then
266 e8d0903d Ermal
	/bin/rm -rf /etc/hosts
267
	/bin/ln -s /var/etc/hosts /etc/hosts
268 c8fcdb2f Scott Ullrich
fi
269 095d04db Scott Ullrich
270 f1cc2287 Scott Ullrich
if [ ! -L /etc/resolv.conf ]; then
271 e173dd74 Phil Davis
	/bin/rm -rf /etc/resolv.conf
272
	/bin/ln -s /var/etc/resolv.conf /etc/resolv.conf
273 f1cc2287 Scott Ullrich
fi
274 095d04db Scott Ullrich
275 30501526 Warren Baker
if [ ! -L /etc/resolvconf.conf ]; then
276 e173dd74 Phil Davis
	/bin/rm -rf /etc/resolvconf.conf
277
	/bin/ln -s /var/etc/resolvconf.conf /etc/resolvconf.conf
278 30501526 Warren Baker
fi
279
280 230787e7 Scott Ullrich
# Setup compatibility link for packages that
281
# have trouble overriding the PREFIX configure
282
# argument since we build our packages in a
283 5aa68a55 Renato Botelho
# separated PREFIX area
284 e173dd74 Phil Davis
# Only create if symlink does not exist.
285 eb03f14e Chris Buechler
if [ ! -h /tmp/tmp ]; then
286 e173dd74 Phil Davis
	/bin/ln -hfs / /tmp/tmp
287 eb03f14e Chris Buechler
fi
288 230787e7 Scott Ullrich
289 4be3f6cf Seth Mos
# Make sure our /tmp is 777 + Sticky
290 3fb8caf2 Scott Ullrich
if [ ! "$PLATFORM" = "cdrom" ] ; then
291 e8d0903d Ermal
	/bin/rm -rf /tmp/*
292 3fb8caf2 Scott Ullrich
fi
293 e8d0903d Ermal
/bin/chmod 1777 /tmp
294 0652f3ae Seth Mos
295 dd64811a Scott Ullrich
if [ ! "$PLATFORM" = "cdrom" ] ; then
296
	# Malloc debugging check
297
	if [ -L /etc/malloc.conf ]; then
298 e173dd74 Phil Davis
		#ln -s aj /etc/malloc.conf
299 e8d0903d Ermal
		/bin/rm /etc/malloc.conf
300 dd64811a Scott Ullrich
	fi
301 cecdf31c Scott Ullrich
fi
302
303 6484bb83 Scott Ullrich
if [ ! -L /etc/dhclient.conf ]; then
304 e173dd74 Phil Davis
	/bin/rm -rf /etc/dhclient.conf
305 6484bb83 Scott Ullrich
fi
306 c8fcdb2f Scott Ullrich
307 544156a7 Scott Ullrich
if [ ! -d /var/tmp ]; then
308 e8d0903d Ermal
	/bin/mkdir -p /var/tmp
309 544156a7 Scott Ullrich
fi
310 4aa70cd8 Scott Ullrich
311 544156a7 Scott Ullrich
if [ ! -d /cf/conf/backup/ ]; then
312 e173dd74 Phil Davis
	/bin/mkdir -p /cf/conf/backup/
313 544156a7 Scott Ullrich
fi
314 d42c2e20 Scott Ullrich
315 5b237745 Scott Ullrich
set -T
316
trap "echo 'Reboot interrupted'; exit 1" 3
317
318 61f1e2ec Scott Ullrich
# Remove old nameserver resolution files
319 e8d0903d Ermal
/bin/rm -f /var/etc/nameserver*
320 61f1e2ec Scott Ullrich
321 2e269da2 Scott Ullrich
echo -n "."
322 71bdd226 Warren Baker
DISABLESYSLOGCLOG=`/usr/bin/grep -c disablesyslogclog /cf/conf/config.xml`
323
ENABLEFIFOLOG=`/usr/bin/grep -c usefifolog /cf/conf/config.xml`
324 e0c45357 jim-p
LOG_FILES="system filter dhcpd vpn pptps poes l2tps openvpn portalauth ipsec ppp relayd wireless lighttpd ntpd gateways resolver routing"
325 c7a3356e jim-p
326
DEFAULT_LOG_FILE_SIZE=`/usr/local/bin/xmllint --xpath 'string(//pfsense/syslog/logfilesize)' /conf/config.xml`
327
if [ ! ${DEFAULT_LOG_FILE_SIZE} ]; then
328
	DEFAULT_LOG_FILE_SIZE=511488
329
fi
330
331 973b2663 Ermal
for logfile in $LOG_FILES; do
332 e173dd74 Phil Davis
	if [ "$DISABLESYSLOGCLOG" -gt "0" ]; then
333 973b2663 Ermal
		/usr/bin/touch /var/log/$logfile.log
334 e173dd74 Phil Davis
	else
335 973b2663 Ermal
		if [ ! -f /var/log/$logfile.log ]; then
336
			if [ "$ENABLEFIFOLOG" -gt "0" ]; then
337
				# generate fifolog files
338 c7a3356e jim-p
				/usr/sbin/fifolog_create -s ${DEFAULT_LOG_FILE_SIZE} /var/log/$logfile.log
339 e173dd74 Phil Davis
			else
340 2a50fd8a Renato Botelho
				/usr/local/sbin/clog -i -s ${DEFAULT_LOG_FILE_SIZE} /var/log/$logfile.log
341 973b2663 Ermal
			fi
342 e8197e56 Ermal
		fi
343 e173dd74 Phil Davis
	fi
344 973b2663 Ermal
done
345
346 57ecd9b6 Scott Ullrich
# change permissions on newly created fifolog files.
347 e8d0903d Ermal
/bin/chmod 0600 /var/log/*.log
348 8d418ca9 Scott Ullrich
349 2e269da2 Scott Ullrich
echo -n "."
350 7734aea6 Andrew Thompson
if [ ! "$PLATFORM" = "jail" ]; then
351
	DEVFS=`/sbin/mount | /usr/bin/grep devfs | /usr/bin/wc -l | /usr/bin/cut -d" " -f8`
352
	if [ "$DEVFS" = "0" ]; then
353
		mount_devfs devfs /dev
354
	fi
355 f93c5384 Scott Ullrich
fi
356 5b237745 Scott Ullrich
357
# Create an initial utmp file
358 7d3be92f Ermal
cd $varrunpath && /bin/cp /dev/null utmp && /bin/chmod 644 utmp
359 5b237745 Scott Ullrich
360 2e269da2 Scott Ullrich
echo -n "."
361 6fe4f291 Scott Ullrich
/sbin/ldconfig -elf /usr/lib /usr/local/lib /lib
362 05dd0c32 Ermal
/etc/rc.d/ldconfig start 2>/dev/null
363 c268f10f Scott Ullrich
364 cdbc61b6 Scott Ullrich
# Make sure /etc/rc.conf doesn't exist.
365
if [ -f /etc/rc.conf ]; then
366 e173dd74 Phil Davis
	/bin/rm -rf /etc/rc.conf
367 cdbc61b6 Scott Ullrich
fi
368
369 7734aea6 Andrew Thompson
if [ ! "$PLATFORM" = "jail" ]; then
370
	# Launching kbdmux(4)
371
	if [ -f "/dev/kbdmux0" ]; then
372
		echo -n "."
373
		/usr/sbin/kbdcontrol -k /dev/kbdmux0 < /dev/console
374
		[ -c "/dev/atkbd0" ] && kbdcontrol -a atkbd0 < /dev/console
375
		[ -c "/dev/ukbd0" ] && kbdcontrol -a ukbd0 < /dev/console
376
	fi
377 4e7b2b27 Scott Ullrich
378 7734aea6 Andrew Thompson
	# Fire up unionfs if mount points exist.
379
	if [ -f /dist/uniondirs ]; then
380
		echo -n "."
381
		/etc/rc.d/unionfs start
382
	fi
383 b1ce7649 Scott Ullrich
fi
384 fa8f44ce Scott Ullrich
385 2e269da2 Scott Ullrich
echo "done."
386 deff30cd Scott Ullrich
387 ad0d7518 Scott Ullrich
# Recreate capabilities DB
388 416e6432 Ermal
/usr/bin/cap_mkdb /etc/login.conf
389 ad0d7518 Scott Ullrich
390 40e46009 Scott Ullrich
# Run the php.ini setup file and populate
391
# /usr/local/etc/php.ini and /usr/local/lib/php.ini
392 aa840cf9 Scott Ullrich
/etc/rc.php_ini_setup 2>/tmp/php_errors.txt
393 4aea91d8 Ermal
/usr/local/sbin/php-fpm -c /usr/local/lib/php.ini -y /usr/local/lib/php-fpm.conf -RD 2>&1 >/dev/null
394 0cf5aa69 Scott Ullrich
395 206f684d Scott Ullrich
# Launch external configuration loader for supported platforms
396
if [ "$PLATFORM" = "nanobsd" ]; then
397 1590947b Ermal
	/usr/local/sbin/fcgicli -f /etc/ecl.php
398 206f684d Scott Ullrich
fi
399
400
# Launch external configuration loader for supported platforms
401
if [ "$PLATFORM" = "pfSense" ]; then
402 1590947b Ermal
	/usr/local/sbin/fcgicli -f /etc/ecl.php
403 206f684d Scott Ullrich
fi
404
405 490615d3 Scott Ullrich
if [ -f /etc/rc.custom_boot_early ]; then
406
	/bin/echo -n "Launching /etc/rc.custom_boot_early...";
407
	/etc/rc.custom_boot_early
408
	echo "Done"
409
fi
410
411 4aea91d8 Ermal
export fcgipath=/var/run/php-fpm.socket
412 01599e5e Ermal
/usr/bin/nice -n20 /usr/local/sbin/check_reload_status
413 e8d0903d Ermal
414 b406ae66 Scott Ullrich
# let the PHP-based configuration subsystem set up the system now
415 8e2eb65e Scott Ullrich
echo -n "Launching the init system..."
416 e8d0903d Ermal
/bin/rm -f /cf/conf/backup/backup.cache
417
/bin/rm -f /root/lighttpd*
418
/usr/bin/touch $varrunpath/booting
419 b406ae66 Scott Ullrich
/etc/rc.bootup
420
421 f658bac7 Ermal LUÇI
# /etc/rc.bootup unset $g['booting'], and removes file
422
# Be sure the file is removed to not create troubles after
423
if [ -f $varrunpath/booting ]; then
424
	/bin/rm $varrunpath/booting
425
fi
426 5551d818 Renato Botelho
427 e173dd74 Phil Davis
# If a shell was selected from recovery
428 c1da5030 Scott Ullrich
# console then just drop to the shell now.
429
if [ -f "/tmp/donotbootup" ]; then
430 b1d04497 Scott Ullrich
	echo "Dropping to recovery shell."
431 c1da5030 Scott Ullrich
	exit 0
432
fi
433
434 0c5e431d Scott Ullrich
echo -n "Starting CRON... "
435 ea83ac64 Scott Ullrich
cd /tmp && /usr/sbin/cron -s 2>/dev/null
436 0c5e431d Scott Ullrich
echo "done."
437 3e08b3c1 Scott Ullrich
438 5be5825e Scott Ullrich
# Start packages
439 1590947b Ermal
/usr/local/sbin/fcgicli -f /etc/rc.start_packages
440 3bd1bd72 Scott Ullrich
441 e8d0903d Ermal
/bin/rm -rf /usr/local/pkg/pf/CVS
442 bc086d51 Scott Ullrich
443 0092b3bd mgrooms
# Start ping handler every 240 seconds
444 7d3be92f Ermal
/usr/local/bin/minicron 240 $varrunpath/ping_hosts.pid /usr/local/bin/ping_hosts.sh
445 f2025e91 Scott Ullrich
446 0092b3bd mgrooms
# Start account expire handler every hour
447 1590947b Ermal
/usr/local/bin/minicron 3600 $varrunpath/expire_accounts.pid '/usr/local/sbin/fcgicli -f /etc/rc.expireaccounts'
448 0092b3bd mgrooms
449 f6ba4bd1 Scott Ullrich
# Start alias url updater every 24 hours
450 1590947b Ermal
/usr/local/bin/minicron 86400 $varrunpath/update_alias_url_data.pid '/usr/local/sbin/fcgicli -f /etc/rc.update_alias_url_data'
451 f6ba4bd1 Scott Ullrich
452 c432da9c Scott Ullrich
/bin/chmod a+rw /tmp/.
453 b569598b Scott Ullrich
454 52398a6b jim-p
# Check for GEOM mirrors
455
GMIRROR_STATUS=`/sbin/gmirror status`
456
if [ "${GMIRROR_STATUS}" != "" ]; then
457
	# Using a flag file at bootup saves an expensive exec/check on each page load.
458
	/usr/bin/touch /var/run/gmirror_active
459
	# Setup monitoring/notifications
460
	/usr/local/bin/minicron 60 /var/run/gmirror_status_check.pid /usr/local/sbin/gmirror_status_check.php
461
fi
462
463 dcafc712 Adam Gibson
# Log product version to syslog
464 4982e61e Adam Gibson
BUILDTIME=`cat /etc/version.buildtime`
465
ARCH=`uname -m`
466 76fce373 Adam Gibson
echo "$product ($PLATFORM) $version $ARCH $BUILDTIME"
467 4982e61e Adam Gibson
468 e393a4a8 Scott Ullrich
echo "Bootup complete"
469 1ba9533c Scott Ullrich
470 2d4be1c5 Scott Ullrich
/usr/local/bin/beep.sh start 2>&1 >/dev/null
471 e393a4a8 Scott Ullrich
472 4171fa68 Scott Ullrich
# Reset the cache.  read-only requires this.
473 7734aea6 Andrew Thompson
/bin/rm -f /tmp/config.cache
474 4171fa68 Scott Ullrich
475 d35cf0de Scott Ullrich
exit 0