FreeBSD-7 and NetBSD support tmpfs, so try and use this first.
This commit is contained in:
parent
8a328b7408
commit
97f707db0d
@ -58,7 +58,9 @@ if [ "${RC_SYS}" = "VPS" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# If $svcdir is still mounted, preserve it if we can
|
# If $svcdir is still mounted, preserve it if we can
|
||||||
if mountinfo -q "${RC_SVCDIR}" && [ -w "${RC_LIBDIR}" ] ; then
|
|
||||||
|
mnt=$(mountinfo --node "${RC_SVCDIR}")
|
||||||
|
if [ -n "${mnt}" -a -w "${RC_LIBDIR}" ] ; then
|
||||||
f_opts="-m -c"
|
f_opts="-m -c"
|
||||||
[ "${RC_UNAME}" = "Linux" ] && f_opts="-c"
|
[ "${RC_UNAME}" = "Linux" ] && f_opts="-c"
|
||||||
if [ -n "$(fuser ${f_opts} "${svcdir}" 2>/dev/null)" ] ; then
|
if [ -n "$(fuser ${f_opts} "${svcdir}" 2>/dev/null)" ] ; then
|
||||||
|
@ -37,24 +37,30 @@ single_user() {
|
|||||||
# FreeBSD has a nice ramdisk - we don't set a size as we should always
|
# 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
|
# be fairly small and we unmount them after the boot level is done anyway
|
||||||
# NOTE we don't set a size for Linux either
|
# NOTE we don't set a size for Linux either
|
||||||
|
# FreeBSD-7 supports tmpfs now :)
|
||||||
mount_svcdir() {
|
mount_svcdir() {
|
||||||
local dotmp=false
|
local dotmp=false release=false
|
||||||
if [ -e "${RC_SVCDIR}"/deptree ] ; then
|
if [ -e "${RC_SVCDIR}"/deptree ] ; then
|
||||||
dotmp=true
|
dotmp=true
|
||||||
|
if ! mount -t tmpfs none "${RC_LIBDIR}"/tmp 2>/dev/null; then
|
||||||
try mdconfig -a -t malloc -s 1m -u 1
|
try mdconfig -a -t malloc -s 1m -u 1
|
||||||
try newfs /dev/md1
|
try newfs /dev/md1
|
||||||
try mount /dev/md1 "${RC_LIBDIR}"/tmp
|
try mount /dev/md1 "${RC_LIBDIR}"/tmp
|
||||||
|
release=true
|
||||||
|
fi
|
||||||
cp -p "${RC_SVCDIR}"/deptree "${RC_SVCDIR}"/depconfig \
|
cp -p "${RC_SVCDIR}"/deptree "${RC_SVCDIR}"/depconfig \
|
||||||
"${RC_SVCDIR}"/nettree "${RC_LIBDIR}"/tmp 2>/dev/null
|
"${RC_SVCDIR}"/nettree "${RC_LIBDIR}"/tmp 2>/dev/null
|
||||||
fi
|
fi
|
||||||
|
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 mdconfig -a -t malloc -s "${rc_svcsize:-1024}"k -u 0
|
||||||
try newfs -b 4096 -i 1024 -n /dev/md0
|
try newfs -b 4096 -i 1024 -n /dev/md0
|
||||||
try mount -o rw,noexec,nosuid /dev/md0 "${RC_SVCDIR}"
|
try mount -o rw,noexec,nosuid /dev/md0 "${RC_SVCDIR}"
|
||||||
|
fi
|
||||||
if ${dotmp} ; then
|
if ${dotmp} ; then
|
||||||
cp -p "${RC_LIBDIR}"/tmp/deptree "${RC_LIBDIR}"/tmp/depconfig \
|
cp -p "${RC_LIBDIR}"/tmp/deptree "${RC_LIBDIR}"/tmp/depconfig \
|
||||||
"${RC_LIBDIR}"/tmp/nettree "${RC_SVCDIR}" 2>/dev/null
|
"${RC_LIBDIR}"/tmp/nettree "${RC_SVCDIR}" 2>/dev/null
|
||||||
try umount "${RC_LIBDIR}"/tmp
|
try umount "${RC_LIBDIR}"/tmp
|
||||||
try mdconfig -d -u 1
|
${release} && try mdconfig -d -u 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user