| 1 |
#!/bin/sh |
| 2 |
# Copyright 1999-2007 Gentoo Foundation |
| 3 |
# Distributed under the terms of the GNU General Public License v2 |
| 4 |
|
| 5 |
# void single_user() |
| 6 |
# |
| 7 |
# Drop to a shell, remount / ro, and then reboot |
| 8 |
# |
| 9 |
single_user() { |
| 10 |
exit 1 |
| 11 |
} |
| 12 |
|
| 13 |
# This basically mounts $svcdir as a ramdisk, but preserving its content |
| 14 |
# which allows us to run depscan.sh |
| 15 |
# FreeBSD has a nice ramdisk - we don't set a size as we should always |
| 16 |
# be fairly small and we unmount them after the boot level is done anyway |
| 17 |
# NOTE we don't set a size for Linux either |
| 18 |
mount_svcdir() { |
| 19 |
local dotmp=false |
| 20 |
if [ -e "${RC_SVCDIR}"/deptree ] ; then |
| 21 |
dotmp=true |
| 22 |
try mdconfig -a -t malloc -s 1m -u 1 |
| 23 |
try newfs /dev/md1 |
| 24 |
try mount /dev/md1 "${RC_LIBDIR}"/tmp |
| 25 |
cp -p "${RC_SVCDIR}"/deptree "${RC_SVCDIR}"/nettree \ |
| 26 |
"${RC_LIBDIR}"/tmp 2>/dev/null |
| 27 |
fi |
| 28 |
try mdconfig -a -t malloc -s "${RC_SVCSIZE:-1024}"k -u 0 |
| 29 |
try newfs -b 4096 -i 1024 -n /dev/md0 |
| 30 |
try mount -o rw,noexec,nosuid /dev/md0 "${RC_SVCDIR}" |
| 31 |
if ${dotmp} ; then |
| 32 |
cp -p "${RC_LIBDIR}"/tmp/deptree "${RC_LIBDIR}"/tmp/nettree \ |
| 33 |
"${RC_SVCDIR}" 2>/dev/null |
| 34 |
try umount "${RC_LIBDIR}"/tmp |
| 35 |
try mdconfig -d -u 1 |
| 36 |
fi |
| 37 |
} |
| 38 |
|
| 39 |
. "${RC_LIBDIR}"/sh/init-functions.sh |
| 40 |
. "${RC_LIBDIR}"/sh/functions.sh |
| 41 |
|
| 42 |
# Disable devd until we need it |
| 43 |
[ "${RC_UNAME}" = "FreeBSD" ] && sysctl hw.bus.devctl_disable=1 >/dev/null |
| 44 |
|
| 45 |
. "${RC_LIBDIR}"/sh/init-common-post.sh |
| 46 |
|
| 47 |
# vim: set ts=4 : |