1
|
#!/bin/sh
|
2
|
#
|
3
|
# rc
|
4
|
#
|
5
|
# part of pfSense (https://www.pfsense.org)
|
6
|
# Copyright (c) 2004-2018 Rubicon Communications, LLC (Netgate)
|
7
|
# All rights reserved.
|
8
|
#
|
9
|
# originally based on m0n0wall (http://neon1.net/m0n0wall)
|
10
|
# Copyright (c) 2003-2004 Manuel Kasper <mk@neon1.net>.
|
11
|
# All rights reserved.
|
12
|
#
|
13
|
# Redistribution and use in source and binary forms, with or without
|
14
|
# modification, are permitted provided that the following conditions are met:
|
15
|
#
|
16
|
# 1. Redistributions of source code must retain the above copyright notice,
|
17
|
# this list of conditions and the following disclaimer.
|
18
|
#
|
19
|
# 2. Redistributions in binary form must reproduce the above copyright
|
20
|
# notice, this list of conditions and the following disclaimer in
|
21
|
# the documentation and/or other materials provided with the
|
22
|
# distribution.
|
23
|
#
|
24
|
# 3. All advertising materials mentioning features or use of this software
|
25
|
# must display the following acknowledgment:
|
26
|
# "This product includes software developed by the pfSense Project
|
27
|
# for use in the pfSense® software distribution. (http://www.pfsense.org/).
|
28
|
#
|
29
|
# 4. The names "pfSense" and "pfSense Project" must not be used to
|
30
|
# endorse or promote products derived from this software without
|
31
|
# prior written permission. For written permission, please contact
|
32
|
# coreteam@pfsense.org.
|
33
|
#
|
34
|
# 5. Products derived from this software may not be called "pfSense"
|
35
|
# nor may "pfSense" appear in their names without prior written
|
36
|
# permission of the Electric Sheep Fencing, LLC.
|
37
|
#
|
38
|
# 6. Redistributions of any form whatsoever must retain the following
|
39
|
# acknowledgment:
|
40
|
#
|
41
|
# "This product includes software developed by the pfSense Project
|
42
|
# for use in the pfSense software distribution (http://www.pfsense.org/).
|
43
|
#
|
44
|
# THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY
|
45
|
# EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
46
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
47
|
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR
|
48
|
# ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
49
|
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
50
|
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
51
|
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
52
|
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
53
|
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
54
|
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
55
|
# OF THE POSSIBILITY OF SUCH DAMAGE.
|
56
|
|
57
|
#/bin/stty status '^T'
|
58
|
#/bin/stty susp '^-' intr '^-' quit '^-'
|
59
|
|
60
|
#trap : 2
|
61
|
#trap : 3
|
62
|
|
63
|
HOME=/
|
64
|
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
|
65
|
export HOME PATH
|
66
|
|
67
|
# Set our operating platform
|
68
|
PLATFORM=`/bin/cat /etc/platform`
|
69
|
|
70
|
get_version ()
|
71
|
{
|
72
|
# Set our current version
|
73
|
version=`/bin/cat /etc/version`
|
74
|
|
75
|
# Version patch
|
76
|
version_patch="0"
|
77
|
if [ -f /etc/version.patch ]; then
|
78
|
version_patch=`/bin/cat /etc/version.patch`
|
79
|
fi
|
80
|
|
81
|
if [ "${version_patch}" = "0" ]; then
|
82
|
version_patch=""
|
83
|
else
|
84
|
version_patch=" (Patch ${version_patch})"
|
85
|
fi
|
86
|
}
|
87
|
|
88
|
get_version
|
89
|
|
90
|
# Read product_name from $g, defaults to pfSense
|
91
|
# Use php -n here because we are not ready to load extensions yet
|
92
|
product=$(/usr/local/bin/php -n /usr/local/sbin/read_global_var product_name pfSense)
|
93
|
|
94
|
# Setup dumpdev/ddb/savecore"
|
95
|
echo "Configuring crash dumps..."
|
96
|
if [ "$PLATFORM" = "${product}" ]; then
|
97
|
/etc/rc.dumpon
|
98
|
fi
|
99
|
|
100
|
# Setup ddb on all platforms. On full install it will save the dump, on NanoBSD it will print to console and auto-reboot.
|
101
|
if [ ! -z "`sysctl -Nq debug.ddb.scripting.scripts`" ]; then
|
102
|
/sbin/ddb /etc/ddb.conf
|
103
|
fi
|
104
|
|
105
|
if [ -e /root/force_fsck ]; then
|
106
|
echo "Forcing filesystem(s) check..."
|
107
|
/sbin/fsck -y -t ufs
|
108
|
fi
|
109
|
|
110
|
if [ "${PLATFORM}" != "cdrom" ]; then
|
111
|
FSCK_ACTION_NEEDED=0
|
112
|
/sbin/fsck -p
|
113
|
case $? in
|
114
|
0)
|
115
|
echo "Filesystems are clean, continuing..."
|
116
|
echo "Mounting filesystems..."
|
117
|
;;
|
118
|
8)
|
119
|
echo "Preen mode recommended running a check that will be performed now."
|
120
|
FSCK_ACTION_NEEDED=1
|
121
|
;;
|
122
|
*)
|
123
|
echo "Stopping boot is recommended because filesystem manual action is needed, nevertheless automated repair of the filesystem will be attempted."
|
124
|
FSCK_ACTION_NEEDED=1
|
125
|
;;
|
126
|
esac
|
127
|
|
128
|
if [ ${FSCK_ACTION_NEEDED} = 1 ]; then
|
129
|
echo "WARNING: Trying to recover filesystem from inconsistency..."
|
130
|
/sbin/fsck -y -t ufs
|
131
|
fi
|
132
|
|
133
|
/sbin/mount -a 2>/dev/null
|
134
|
mount_rc=$?
|
135
|
attempts=0
|
136
|
while [ ${mount_rc} -ne 0 -a ${attempts} -lt 10 ]; do
|
137
|
/sbin/fsck -y -t ufs
|
138
|
/sbin/mount -a 2>/dev/null
|
139
|
mount_rc=$?
|
140
|
attempts=$((attempts+1))
|
141
|
done
|
142
|
|
143
|
if [ ${mount_rc} -ne 0 ]; then
|
144
|
echo "ERROR: Impossible to mount filesystem, use interactive shell to attempt to recover it"
|
145
|
/bin/sh
|
146
|
/sbin/reboot
|
147
|
fi
|
148
|
|
149
|
if [ "${PLATFORM}" = "nanobsd" ]; then
|
150
|
# XXX This script does need all filesystems rw!!!!
|
151
|
# Put this workaround for now until better ways are found.
|
152
|
/sbin/mount -u -w -o sync,noatime /
|
153
|
/sbin/mount -u -w -o sync,noatime /cf
|
154
|
fi
|
155
|
|
156
|
# If /conf is a directory, convert it to a symlink to /cf/conf
|
157
|
if [ -d "/conf" ]; then
|
158
|
# If item is not a symlink then rm and recreate
|
159
|
CONFPOINTSTO=`readlink /conf`
|
160
|
if ! test "x$CONFPOINTSTO" = "x/cf/conf"; then
|
161
|
/bin/rm -rf /conf
|
162
|
/bin/ln -s /cf/conf /conf
|
163
|
fi
|
164
|
fi
|
165
|
|
166
|
USE_MFS_TMPVAR=$(/usr/local/sbin/read_xml_tag.sh boolean system/use_mfs_tmpvar)
|
167
|
unset MOVE_PKG_DATA
|
168
|
if [ "$PLATFORM" = "${product}" ]; then
|
169
|
# If use MFS var is disabled, move files back to place
|
170
|
if [ "${USE_MFS_TMPVAR}" != "true" -a -f /root/var/db/pkg/local.sqlite ]; then
|
171
|
MOVE_PKG_DATA=1
|
172
|
rm -rf /var/db/pkg 2>/dev/null
|
173
|
rm -rf /var/cache/pkg 2>/dev/null
|
174
|
mv -f /root/var/db/pkg /var/db
|
175
|
mv -f /root/var/cache/pkg /var/cache
|
176
|
# If use MFS var is enabled, move files to a safe place
|
177
|
elif [ "${USE_MFS_TMPVAR}" = "true" -a -f /var/db/pkg/local.sqlite ]; then
|
178
|
MOVE_PKG_DATA=1
|
179
|
rm -rf /root/var/db/pkg 2>/dev/null
|
180
|
rm -rf /root/var/cache/pkg 2>/dev/null
|
181
|
/bin/mkdir -p /root/var/db /root/var/cache
|
182
|
mv -f /var/db/pkg /root/var/db
|
183
|
mv -f /var/cache/pkg /root/var/cache
|
184
|
fi
|
185
|
elif [ "${PLATFORM}" = "nanobsd" ]; then
|
186
|
MOVE_PKG_DATA=1
|
187
|
fi
|
188
|
|
189
|
if [ "${PLATFORM}" = "nanobsd" ] || [ "${USE_MFS_TMPVAR}" = "true" ]; then
|
190
|
/etc/rc.embedded
|
191
|
fi
|
192
|
|
193
|
if [ -n "${MOVE_PKG_DATA}" -o "${USE_MFS_TMPVAR}" = "true" ]; then
|
194
|
/bin/mkdir -p /var/db /var/cache
|
195
|
ln -sf ../../root/var/db/pkg /var/db/pkg
|
196
|
ln -sf ../../root/var/cache/pkg /var/cache/pkg
|
197
|
fi
|
198
|
fi
|
199
|
|
200
|
/bin/rm -f /root/force_fsck
|
201
|
/bin/rm -f /root/TRIM_set
|
202
|
/bin/rm -f /root/TRIM_unset
|
203
|
|
204
|
if [ "${PLATFORM}" = "nanobsd" ]; then
|
205
|
/sbin/kldstat -qm zfs
|
206
|
if [ $? -eq 0 ]; then
|
207
|
/sbin/kldunload zfs
|
208
|
fi
|
209
|
elif [ "$PLATFORM" = "${product}" ]; then
|
210
|
# Handle ZFS read-only case
|
211
|
/sbin/kldstat -qm zfs
|
212
|
if [ $? -eq 0 ]; then
|
213
|
ZFSFSAVAILABLE=$(/sbin/zfs mount 2>/dev/null | wc -l)
|
214
|
if [ $ZFSFSAVAILABLE -eq 0 ]; then
|
215
|
/sbin/kldunload zfs
|
216
|
elif [ -f /usr/bin/grep ]; then
|
217
|
ZFSROOT=`/sbin/zfs mount | /usr/bin/grep ' /$' | /usr/bin/cut -d ' ' -f 1`
|
218
|
if [ "$ZFSROOT" != "" ]; then
|
219
|
/sbin/zfs set readonly=off $ZFSROOT
|
220
|
fi
|
221
|
fi
|
222
|
fi
|
223
|
elif [ "${PLATFORM}" = "cdrom" ]; then
|
224
|
/etc/rc.cdrom
|
225
|
fi
|
226
|
|
227
|
# Disable APM on ATA drives. Leaving this on will kill drives long-term, especially laptop drives, by generating excessive Load Cycles.
|
228
|
if [ -f /etc/rc.disable_hdd_apm ]; then
|
229
|
/etc/rc.disable_hdd_apm
|
230
|
fi
|
231
|
|
232
|
# Eject CD devices on 3G modems
|
233
|
MANUFACTURER="huawei|zte"
|
234
|
CDDEVICE=`dmesg |egrep -ie "($MANUFACTURER)" | awk -F: '/cd/ {print $1}'`
|
235
|
if [ "$CDDEVICE" != "" ]; then
|
236
|
cdcontrol -f /dev/"$CDDEVICE" eject
|
237
|
fi
|
238
|
|
239
|
# Use php -n here because we are not ready to load extensions yet
|
240
|
varrunpath=$(/usr/local/bin/php -n /usr/local/sbin/read_global_var varrun_path "/var/run")
|
241
|
|
242
|
if [ "$PLATFORM" = "${product}" ] && [ "${USE_MFS_TMPVAR}" != "true" ]; then
|
243
|
/sbin/mdmfs -S -M -s 4m md $varrunpath
|
244
|
fi
|
245
|
|
246
|
# Use php -n here because we are not ready to load extensions yet
|
247
|
hideplatform=$(/usr/local/bin/php -n /usr/local/sbin/read_global_var hideplatform)
|
248
|
if [ "$hideplatform" = "true" ]; then
|
249
|
platformbanner="" # hide the platform
|
250
|
else
|
251
|
platformbanner=" on the '${PLATFORM}' platform"
|
252
|
fi
|
253
|
|
254
|
echo
|
255
|
cat /etc/ascii-art/pfsense-logo-small.txt
|
256
|
echo
|
257
|
echo
|
258
|
echo "Welcome to ${product} ${version}${version_patch}${platformbanner}..."
|
259
|
echo
|
260
|
|
261
|
/sbin/conscontrol mute off >/dev/null
|
262
|
|
263
|
if [ "$PLATFORM" = "${product}" ]; then
|
264
|
SWAPDEVICE=`/bin/cat /etc/fstab | /usr/bin/grep swap | /usr/bin/cut -f1`
|
265
|
/sbin/swapon -a 2>/dev/null >/dev/null
|
266
|
/etc/rc.savecore
|
267
|
fi
|
268
|
|
269
|
if [ "$PLATFORM" = "cdrom" ] ; then
|
270
|
echo -n "Mounting unionfs directories..."
|
271
|
/bin/mkdir /tmp/unionfs
|
272
|
/bin/mkdir /tmp/unionfs/usr
|
273
|
/bin/mkdir /tmp/unionfs/root
|
274
|
/bin/mkdir /tmp/unionfs/sbin
|
275
|
/bin/mkdir /tmp/unionfs/bin
|
276
|
/bin/mkdir /tmp/unionfs/boot
|
277
|
/bin/mkdir /tmp/unionfs/confdefault
|
278
|
/sbin/mount_unionfs /tmp/unionfs/usr /usr/
|
279
|
/sbin/mount_unionfs /tmp/unionfs/root /root/
|
280
|
/sbin/mount_unionfs /tmp/unionfs/bin /bin/
|
281
|
/sbin/mount_unionfs /tmp/unionfs/sbin /sbin/
|
282
|
/sbin/mount_unionfs /tmp/unionfs/boot /boot/
|
283
|
/sbin/mount_unionfs /tmp/unionfs/confdefault /conf.default/
|
284
|
echo "done."
|
285
|
fi
|
286
|
|
287
|
# make some directories in /var
|
288
|
/bin/mkdir -p $varrunpath /var/log /var/etc /var/db/entropy /var/db/rrd /var/at/jobs/ /var/empty /var/log/nginx 2>/dev/null
|
289
|
/bin/rm -rf $varrunpath/*
|
290
|
if [ "$PLATFORM" != "${product}" ]; then
|
291
|
/bin/rm /var/log/* 2>/dev/null
|
292
|
fi
|
293
|
|
294
|
# Cleanup configuration files from previous instance
|
295
|
/bin/rm -rf /var/etc/*
|
296
|
|
297
|
# Workaround for ipsec symlinks, otherwise it's going to break
|
298
|
# strongswan pkg upgrade
|
299
|
|
300
|
if [ -L /usr/local/etc/ipsec.d ]; then
|
301
|
rm -f /usr/local/etc/ipsec.d
|
302
|
fi
|
303
|
if [ -L /usr/local/etc/ipsec.conf ]; then
|
304
|
rm -f /usr/local/etc/ipsec.conf
|
305
|
fi
|
306
|
if [ -L /usr/local/etc/strongswan.d ]; then
|
307
|
rm -f /usr/local/etc/strongswan.d
|
308
|
fi
|
309
|
if [ -L /usr/local/etc/strongswan.conf ]; then
|
310
|
rm -f /usr/local/etc/strongswan.conf
|
311
|
fi
|
312
|
|
313
|
echo -n "Creating symlinks..."
|
314
|
# Repair symlinks if they are broken
|
315
|
if [ -f /etc/newsyslog.conf ]; then
|
316
|
/bin/rm -f /etc/newsyslog.conf
|
317
|
fi
|
318
|
if [ ! -L /etc/syslog.conf ]; then
|
319
|
/bin/rm -rf /etc/syslog.conf
|
320
|
if [ ! -f /var/etc/syslog.conf ]; then
|
321
|
touch /var/etc/syslog.conf
|
322
|
fi
|
323
|
/bin/ln -s /var/etc/syslog.conf /etc/syslog.conf
|
324
|
fi
|
325
|
|
326
|
# Repair symlinks if they are broken
|
327
|
if [ ! -L /etc/hosts ]; then
|
328
|
/bin/rm -rf /etc/hosts
|
329
|
/bin/ln -s /var/etc/hosts /etc/hosts
|
330
|
fi
|
331
|
|
332
|
if [ ! -L /etc/resolv.conf ]; then
|
333
|
/bin/rm -rf /etc/resolv.conf
|
334
|
/bin/ln -s /var/etc/resolv.conf /etc/resolv.conf
|
335
|
fi
|
336
|
|
337
|
if [ ! -L /etc/resolvconf.conf ]; then
|
338
|
/bin/rm -rf /etc/resolvconf.conf
|
339
|
/bin/ln -s /var/etc/resolvconf.conf /etc/resolvconf.conf
|
340
|
fi
|
341
|
|
342
|
# Setup compatibility link for packages that
|
343
|
# have trouble overriding the PREFIX configure
|
344
|
# argument since we build our packages in a
|
345
|
# separated PREFIX area
|
346
|
# Only create if symlink does not exist.
|
347
|
if [ ! -h /tmp/tmp ]; then
|
348
|
/bin/ln -hfs / /tmp/tmp
|
349
|
fi
|
350
|
|
351
|
# Make sure our /tmp is 777 + Sticky
|
352
|
if [ ! "$PLATFORM" = "cdrom" ] ; then
|
353
|
/bin/rm -rf /tmp/*
|
354
|
fi
|
355
|
/bin/chmod 1777 /tmp
|
356
|
|
357
|
if [ ! "$PLATFORM" = "cdrom" ] ; then
|
358
|
# Malloc debugging check
|
359
|
if [ -L /etc/malloc.conf ]; then
|
360
|
#ln -s aj /etc/malloc.conf
|
361
|
/bin/rm /etc/malloc.conf
|
362
|
fi
|
363
|
fi
|
364
|
|
365
|
if [ ! -L /etc/dhclient.conf ]; then
|
366
|
/bin/rm -rf /etc/dhclient.conf
|
367
|
fi
|
368
|
|
369
|
if [ ! -d /var/tmp ]; then
|
370
|
/bin/mkdir -p /var/tmp
|
371
|
fi
|
372
|
/bin/chmod 1777 /var/tmp
|
373
|
|
374
|
set -T
|
375
|
trap "echo 'Reboot interrupted'; exit 1" 3
|
376
|
|
377
|
# Remove old nameserver resolution files
|
378
|
/bin/rm -f /var/etc/nameserver*
|
379
|
|
380
|
echo -n "."
|
381
|
DISABLESYSLOGCLOG=$(/usr/local/sbin/read_xml_tag.sh boolean system/disablesyslogclog)
|
382
|
LOG_FILES="system filter dhcpd vpn poes l2tps openvpn portalauth ipsec ppp relayd wireless nginx ntpd gateways resolver routing"
|
383
|
|
384
|
DEFAULT_LOG_FILE_SIZE=$(/usr/local/sbin/read_xml_tag.sh string syslog/logfilesize)
|
385
|
DEFAULT_LOG_FILE_SIZE=${DEFAULT_LOG_FILE_SIZE:-"511488"}
|
386
|
|
387
|
for logfile in $LOG_FILES; do
|
388
|
if [ "$DISABLESYSLOGCLOG" = "true" ]; then
|
389
|
/usr/bin/touch /var/log/$logfile.log
|
390
|
else
|
391
|
if [ ! -f /var/log/$logfile.log ]; then
|
392
|
/usr/local/sbin/clog -i -s ${DEFAULT_LOG_FILE_SIZE} /var/log/$logfile.log
|
393
|
fi
|
394
|
fi
|
395
|
done
|
396
|
|
397
|
# change permissions on newly created log files.
|
398
|
/bin/chmod 0600 /var/log/*.log
|
399
|
|
400
|
echo -n "."
|
401
|
DEVFS=`/sbin/mount | /usr/bin/grep devfs | /usr/bin/wc -l | /usr/bin/cut -d" " -f8`
|
402
|
if [ "$DEVFS" = "0" ]; then
|
403
|
mount_devfs devfs /dev
|
404
|
fi
|
405
|
|
406
|
# Create an initial utmp file
|
407
|
cd $varrunpath && /bin/cp /dev/null utmp && /bin/chmod 644 utmp
|
408
|
|
409
|
echo -n "."
|
410
|
/sbin/ldconfig -elf /usr/lib /usr/local/lib /lib
|
411
|
/etc/rc.d/ldconfig start 2>/dev/null
|
412
|
|
413
|
# Launching kbdmux(4)
|
414
|
if [ -f "/dev/kbdmux0" ]; then
|
415
|
echo -n "."
|
416
|
/usr/sbin/kbdcontrol -k /dev/kbdmux0 < /dev/console
|
417
|
[ -c "/dev/atkbd0" ] && kbdcontrol -a atkbd0 < /dev/console
|
418
|
[ -c "/dev/ukbd0" ] && kbdcontrol -a ukbd0 < /dev/console
|
419
|
fi
|
420
|
|
421
|
# Fire up unionfs if mount points exist.
|
422
|
if [ -f /dist/uniondirs ]; then
|
423
|
echo -n "."
|
424
|
/etc/rc.d/unionfs start
|
425
|
fi
|
426
|
|
427
|
echo "done."
|
428
|
|
429
|
# Recreate capabilities DB
|
430
|
/usr/bin/cap_mkdb /etc/login.conf
|
431
|
|
432
|
if [ "${PLATFORM}" != "cdrom" ]; then
|
433
|
# Second upgrade stage
|
434
|
/usr/local/sbin/${product}-upgrade -y -b 2
|
435
|
fi
|
436
|
|
437
|
# Run the php.ini setup file and populate
|
438
|
# /usr/local/etc/php.ini
|
439
|
/etc/rc.php_ini_setup 2>/tmp/php_errors.txt
|
440
|
/usr/local/sbin/php-fpm -c /usr/local/etc/php.ini -y /usr/local/lib/php-fpm.conf -RD 2>&1 >/dev/null
|
441
|
|
442
|
# Launch external configuration loader for supported platforms
|
443
|
if [ "$PLATFORM" = "nanobsd" ]; then
|
444
|
/usr/local/sbin/fcgicli -f /etc/ecl.php
|
445
|
fi
|
446
|
|
447
|
# Launch external configuration loader for supported platforms
|
448
|
if [ "$PLATFORM" = "${product}" ]; then
|
449
|
/usr/local/sbin/fcgicli -f /etc/ecl.php
|
450
|
fi
|
451
|
|
452
|
if [ -f /etc/rc.custom_boot_early ]; then
|
453
|
/bin/echo -n "Launching /etc/rc.custom_boot_early...";
|
454
|
/etc/rc.custom_boot_early
|
455
|
echo "Done"
|
456
|
fi
|
457
|
|
458
|
export fcgipath=/var/run/php-fpm.socket
|
459
|
/usr/bin/nice -n20 /usr/local/sbin/check_reload_status
|
460
|
|
461
|
# let the PHP-based configuration subsystem set up the system now
|
462
|
echo -n "Launching the init system..."
|
463
|
/bin/rm -f /cf/conf/backup/backup.cache
|
464
|
/usr/bin/touch $varrunpath/booting
|
465
|
|
466
|
if [ "${PLATFORM}" = "nanobsd" ]; then
|
467
|
# XXX This script does need all filesystems rw!!!!
|
468
|
# Put this workaround for now until better ways are found.
|
469
|
/sbin/mount -u -f -r -o sync,noatime /
|
470
|
/sbin/mount -u -f -r -o sync,noatime /cf
|
471
|
fi
|
472
|
|
473
|
# Copy custom logo over if it's present
|
474
|
if [ -d /usr/local/share/${product}/custom_logos ]; then
|
475
|
cp -f /usr/local/share/${product}/custom_logos/*png \
|
476
|
/usr/local/www
|
477
|
fi
|
478
|
|
479
|
/etc/rc.bootup
|
480
|
|
481
|
# /etc/rc.bootup unset $g['booting'], and removes file
|
482
|
# Be sure the file is removed to not create troubles after
|
483
|
if [ -f $varrunpath/booting ]; then
|
484
|
/bin/rm $varrunpath/booting
|
485
|
fi
|
486
|
|
487
|
echo -n "Starting CRON... "
|
488
|
cd /tmp && /usr/sbin/cron -s 2>/dev/null
|
489
|
echo "done."
|
490
|
|
491
|
# Start packages
|
492
|
/usr/local/sbin/fcgicli -f /etc/rc.start_packages
|
493
|
|
494
|
/bin/rm -rf /usr/local/pkg/pf/CVS
|
495
|
|
496
|
# Start ping handler every 240 seconds
|
497
|
/usr/local/bin/minicron 240 $varrunpath/ping_hosts.pid /usr/local/bin/ping_hosts.sh
|
498
|
|
499
|
# Start account expire handler every hour
|
500
|
/usr/local/bin/minicron 3600 $varrunpath/expire_accounts.pid '/usr/local/sbin/fcgicli -f /etc/rc.expireaccounts'
|
501
|
|
502
|
# Start alias url updater every 24 hours
|
503
|
/usr/local/bin/minicron 86400 $varrunpath/update_alias_url_data.pid '/usr/local/sbin/fcgicli -f /etc/rc.update_alias_url_data'
|
504
|
|
505
|
/bin/chmod a+rw /tmp/.
|
506
|
|
507
|
# Check for GEOM mirrors
|
508
|
GMIRROR_STATUS=`/sbin/gmirror status`
|
509
|
if [ "${GMIRROR_STATUS}" != "" ]; then
|
510
|
# Using a flag file at bootup saves an expensive exec/check on each page load.
|
511
|
/usr/bin/touch /var/run/gmirror_active
|
512
|
# Setup monitoring/notifications
|
513
|
/usr/local/bin/minicron 60 /var/run/gmirror_status_check.pid /usr/local/sbin/gmirror_status_check.php
|
514
|
fi
|
515
|
|
516
|
if [ "${PLATFORM}" != "cdrom" ]; then
|
517
|
/usr/local/sbin/${product}-upgrade -y -b 3
|
518
|
|
519
|
# Update pkg metadata
|
520
|
/etc/rc.update_pkg_metadata now
|
521
|
fi
|
522
|
|
523
|
# Log product version to syslog
|
524
|
get_version
|
525
|
BUILDTIME=`cat /etc/version.buildtime`
|
526
|
ARCH=`uname -m`
|
527
|
echo "$product ($PLATFORM) ${version}${version_patch} $ARCH $BUILDTIME"
|
528
|
|
529
|
echo "Bootup complete"
|
530
|
|
531
|
/usr/local/bin/beep.sh start 2>&1 >/dev/null
|
532
|
|
533
|
# Reset the cache. read-only requires this.
|
534
|
/bin/rm -f /tmp/config.cache
|
535
|
|
536
|
exit 0
|