summaryrefslogtreecommitdiff
path: root/sh.BSD
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2007-11-28 10:06:13 +0000
committerRoy Marples <roy@marples.name>2007-11-28 10:06:13 +0000
commit97f707db0d42e816b90bcd0a3dee25a197ae5ac0 (patch)
tree1a7255b42a0ee327af12a7330938f74dcc52acb0 /sh.BSD
parent8a328b7408e888a88c5e81ac89c10e9d267709f7 (diff)
downloadopenrc-97f707db0d42e816b90bcd0a3dee25a197ae5ac0.tar.gz
openrc-97f707db0d42e816b90bcd0a3dee25a197ae5ac0.tar.bz2
openrc-97f707db0d42e816b90bcd0a3dee25a197ae5ac0.tar.xz
FreeBSD-7 and NetBSD support tmpfs, so try and use this first.
Diffstat (limited to 'sh.BSD')
-rwxr-xr-xsh.BSD/init.sh22
1 files changed, 14 insertions, 8 deletions
diff --git a/sh.BSD/init.sh b/sh.BSD/init.sh
index 3a9ad81..f5e4327 100755
--- a/sh.BSD/init.sh
+++ b/sh.BSD/init.sh
@@ -37,24 +37,30 @@ single_user() {
# FreeBSD has a nice ramdisk - we don't set a size as we should always
# be fairly small and we unmount them after the boot level is done anyway
# NOTE we don't set a size for Linux either
+# FreeBSD-7 supports tmpfs now :)
mount_svcdir() {
- local dotmp=false
+ local dotmp=false release=false
if [ -e "${RC_SVCDIR}"/deptree ] ; then
dotmp=true
- try mdconfig -a -t malloc -s 1m -u 1
- try newfs /dev/md1
- try mount /dev/md1 "${RC_LIBDIR}"/tmp
+ if ! mount -t tmpfs none "${RC_LIBDIR}"/tmp 2>/dev/null; then
+ try mdconfig -a -t malloc -s 1m -u 1
+ try newfs /dev/md1
+ try mount /dev/md1 "${RC_LIBDIR}"/tmp
+ release=true
+ fi
cp -p "${RC_SVCDIR}"/deptree "${RC_SVCDIR}"/depconfig \
"${RC_SVCDIR}"/nettree "${RC_LIBDIR}"/tmp 2>/dev/null
fi
- try mdconfig -a -t malloc -s "${rc_svcsize:-1024}"k -u 0
- try newfs -b 4096 -i 1024 -n /dev/md0
- try mount -o rw,noexec,nosuid /dev/md0 "${RC_SVCDIR}"
+ if ! mount -t tmpfs -o rw,noexec,nosuid none "${RC_SVCDIR}" 2>/dev/null; then
+ try mdconfig -a -t malloc -s "${rc_svcsize:-1024}"k -u 0
+ try newfs -b 4096 -i 1024 -n /dev/md0
+ try mount -o rw,noexec,nosuid /dev/md0 "${RC_SVCDIR}"
+ fi
if ${dotmp} ; then
cp -p "${RC_LIBDIR}"/tmp/deptree "${RC_LIBDIR}"/tmp/depconfig \
"${RC_LIBDIR}"/tmp/nettree "${RC_SVCDIR}" 2>/dev/null
try umount "${RC_LIBDIR}"/tmp
- try mdconfig -d -u 1
+ ${release} && try mdconfig -d -u 1
fi
}