summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordougb <dougb@FreeBSD.org>2011-04-25 06:03:22 +0000
committerdougb <dougb@FreeBSD.org>2011-04-25 06:03:22 +0000
commit10237e9c726f9580fb6c35d77694fe690c6c6881 (patch)
treecbadea11c766a3d66295c6d142be2c6d5b428fe4
parent9f240be2b005579c35cf1fd16b121c3115ef227a (diff)
downloadFreeBSD-src-10237e9c726f9580fb6c35d77694fe690c6c6881.zip
FreeBSD-src-10237e9c726f9580fb6c35d77694fe690c6c6881.tar.gz
Create a function for the code from r192246 so that it can be used both
times mount is called. Limit the automatic behavior to when AUTO is specified (as it is in etc/defaults/rc.conf) and for everything else take advantage of all of the goodness in checkyesno.
-rwxr-xr-xetc/rc.d/tmp26
1 files changed, 15 insertions, 11 deletions
diff --git a/etc/rc.d/tmp b/etc/rc.d/tmp
index 282709e..dfb439e 100755
--- a/etc/rc.d/tmp
+++ b/etc/rc.d/tmp
@@ -37,20 +37,20 @@ stop_cmd=':'
load_rc_config $name
+mount_tmpmfs ()
+{
+ if ! /bin/df /tmp | grep -q "^/dev/md[0-9]"; then
+ mount_md ${tmpsize} /tmp "${tmpmfs_flags}"
+ chmod 01777 /tmp
+ fi
+}
+
# If we do not have a writable /tmp, create a memory
# filesystem for /tmp. If /tmp is a symlink (e.g. to /var/tmp,
# then it should already be writable).
#
case "${tmpmfs}" in
-[Yy][Ee][Ss])
- if ! /bin/df /tmp | grep -q "^/dev/md[0-9]"; then
- mount_md ${tmpsize} /tmp "${tmpmfs_flags}"
- chmod 01777 /tmp
- fi
- ;;
-[Nn][Oo])
- ;;
-*)
+[Aa][Uu][Tt][Oo])
if _tmpdir=$(mktemp -d -q /tmp/.diskless.XXXXXX); then
rmdir ${_tmpdir}
else
@@ -59,9 +59,13 @@ case "${tmpmfs}" in
echo "dropping into shell, ^D to continue anyway."
/bin/sh
else
- mount_md ${tmpsize} /tmp "${tmpmfs_flags}"
- chmod 01777 /tmp
+ mount_tmpmfs
fi
fi
;;
+*)
+ if checkyesno tmpmfs; then
+ mount_tmpmfs
+ fi
+ ;;
esac
OpenPOWER on IntegriCloud