aboutsummaryrefslogtreecommitdiff
path: root/sh
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2009-11-20 00:03:49 +0000
committerRoy Marples <roy@marples.name>2009-11-20 00:04:32 +0000
commitec38bbbddab5e3fc23f2b53161f42ce8551bce80 (patch)
treef4e051ae65e9901efb0a095ec0e506eb79fdb238 /sh
parent509e34d425d28998ca8f6f230cadc05bc89d2731 (diff)
If mounting tmpfs fails, try ramfs.
This is because buggy kernels always report tmpfs even when not present.
Diffstat (limited to 'sh')
-rw-r--r--sh/init.sh.Linux.in18
1 files changed, 10 insertions, 8 deletions
diff --git a/sh/init.sh.Linux.in b/sh/init.sh.Linux.in
index 23be1952..d3a4715b 100644
--- a/sh/init.sh.Linux.in
+++ b/sh/init.sh.Linux.in
@@ -8,14 +8,19 @@
# tmpfs and ramfs are easy, so force one or the other.
mount_svcdir()
{
+ # mount from fstab if we can
+ fstabinfo --mount "$RC_SVCDIR" && return 0
+
local fs= fsopts="-o rw,noexec,nodev,nosuid"
- local devdir="rc-svcdir" x=
local svcsize=${rc_svcsize:-1024}
+ # Some buggy kernels report tmpfs even when not present :(
if grep -Eq "[[:space:]]+tmpfs$" /proc/filesystems; then
- fs="tmpfs"
- fsopts="$fsopts,mode=0755,size=${svcsize}k"
- elif grep -Eq "[[:space:]]+ramfs$" /proc/filesystems; then
+ mount -n -t tmpfs $fsopts,mode=755,size=${svcsize}k \
+ rc-svcdir "$RC_SVCDIR" && return 0
+ fi
+
+ if grep -Eq "[[:space:]]+ramfs$" /proc/filesystems; then
fs="ramfs"
# ramfs has no special options
elif [ -e /dev/ram0 ] \
@@ -32,10 +37,7 @@ mount_svcdir()
return 1
fi
- # If we have no entry in fstab for $RC_SVCDIR, provide our own
- if ! fstabinfo --mount "$RC_SVCDIR"; then
- mount -n -t "$fs" $fsopts "$devdir" "$RC_SVCDIR"
- fi
+ mount -n -t "$fs" $fsopts rc-svcdir "$RC_SVCDIR"
}
. "$RC_LIBEXECDIR"/sh/functions.sh