From ec38bbbddab5e3fc23f2b53161f42ce8551bce80 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Fri, 20 Nov 2009 00:03:49 +0000 Subject: [PATCH] If mounting tmpfs fails, try ramfs. This is because buggy kernels always report tmpfs even when not present. --- sh/init.sh.Linux.in | 18 ++++++++++-------- 1 file 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