From owner-svn-src-stable-7@FreeBSD.ORG Fri Apr 29 20:55:15 2011 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D9EDF106564A; Fri, 29 Apr 2011 20:55:15 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C94838FC12; Fri, 29 Apr 2011 20:55:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p3TKtFxU015145; Fri, 29 Apr 2011 20:55:15 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p3TKtFUN015143; Fri, 29 Apr 2011 20:55:15 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201104292055.p3TKtFUN015143@svn.freebsd.org> From: Doug Barton Date: Fri, 29 Apr 2011 20:55:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221224 - stable/7/etc/rc.d X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Apr 2011 20:55:16 -0000 Author: dougb Date: Fri Apr 29 20:55:15 2011 New Revision: 221224 URL: http://svn.freebsd.org/changeset/base/221224 Log: MFC r192246: do not create and mount new file systems on top of the old ones on every invocation of this script once we already have one (in case tmpmfs="YES"). MFC r221007: 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: stable/7/etc/rc.d/tmp Directory Properties: stable/7/etc/ (props changed) Modified: stable/7/etc/rc.d/tmp ============================================================================== --- stable/7/etc/rc.d/tmp Fri Apr 29 20:46:09 2011 (r221223) +++ stable/7/etc/rc.d/tmp Fri Apr 29 20:55:15 2011 (r221224) @@ -37,18 +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]) - mount_md ${tmpsize} /tmp "${tmpmfs_flags}" - chmod 01777 /tmp - ;; -[Nn][Oo]) - ;; -*) +[Aa][Uu][Tt][Oo]) if _tmpdir=$(mktemp -d -q /tmp/.diskless.XXXXXX); then rmdir ${_tmpdir} else @@ -57,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