Author: dougb
Date: Mon Apr 25 06:03:22 2011
New Revision: 221007
URL: http://svn.freebsd.org/changeset/base/221007

Log:
  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.

Modified:
  head/etc/rc.d/tmp

Modified: head/etc/rc.d/tmp
==============================================================================
--- head/etc/rc.d/tmp   Mon Apr 25 05:57:01 2011        (r221006)
+++ head/etc/rc.d/tmp   Mon Apr 25 06:03:22 2011        (r221007)
@@ -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
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to