If mounting tmpfs fails, try ramfs.

This is because buggy kernels always report tmpfs even when not present.
This commit is contained in:
Roy Marples 2009-11-20 00:03:49 +00:00
parent 509e34d425
commit ec38bbbdda

View File

@ -8,14 +8,19 @@
# tmpfs and ramfs are easy, so force one or the other. # tmpfs and ramfs are easy, so force one or the other.
mount_svcdir() mount_svcdir()
{ {
# mount from fstab if we can
fstabinfo --mount "$RC_SVCDIR" && return 0
local fs= fsopts="-o rw,noexec,nodev,nosuid" local fs= fsopts="-o rw,noexec,nodev,nosuid"
local devdir="rc-svcdir" x=
local svcsize=${rc_svcsize:-1024} local svcsize=${rc_svcsize:-1024}
# Some buggy kernels report tmpfs even when not present :(
if grep -Eq "[[:space:]]+tmpfs$" /proc/filesystems; then if grep -Eq "[[:space:]]+tmpfs$" /proc/filesystems; then
fs="tmpfs" mount -n -t tmpfs $fsopts,mode=755,size=${svcsize}k \
fsopts="$fsopts,mode=0755,size=${svcsize}k" rc-svcdir "$RC_SVCDIR" && return 0
elif grep -Eq "[[:space:]]+ramfs$" /proc/filesystems; then fi
if grep -Eq "[[:space:]]+ramfs$" /proc/filesystems; then
fs="ramfs" fs="ramfs"
# ramfs has no special options # ramfs has no special options
elif [ -e /dev/ram0 ] \ elif [ -e /dev/ram0 ] \
@ -32,10 +37,7 @@ mount_svcdir()
return 1 return 1
fi fi
# If we have no entry in fstab for $RC_SVCDIR, provide our own mount -n -t "$fs" $fsopts rc-svcdir "$RC_SVCDIR"
if ! fstabinfo --mount "$RC_SVCDIR"; then
mount -n -t "$fs" $fsopts "$devdir" "$RC_SVCDIR"
fi
} }
. "$RC_LIBEXECDIR"/sh/functions.sh . "$RC_LIBEXECDIR"/sh/functions.sh