diff --git a/libexec/rc/rc.d/tmp b/libexec/rc/rc.d/tmp --- a/libexec/rc/rc.d/tmp +++ b/libexec/rc/rc.d/tmp @@ -40,10 +40,16 @@ mount_tmpmfs() { - if ! /bin/df /tmp | grep -q "^/dev/md[0-9].* /tmp"; then - mount_md ${tmpsize} /tmp "${tmpmfs_flags}" - chmod 01777 /tmp - fi + while read line; do + case $line in + /dev/md[0-9]*\ /tmp) + return;; + esac + done <<*EOF +$(df /tmp) +*EOF + mount_md ${tmpsize} /tmp "${tmpmfs_flags}" + chmod 01777 /tmp } # If we do not have a writable /tmp, create a memory @@ -52,7 +58,8 @@ # case "${tmpmfs}" in [Aa][Uu][Tt][Oo]) - if _tmpdir=$(mktemp -d -q /tmp/.diskless.XXXXXX); then + _tmpdir=/tmp/.diskless.$(dd if=/dev/random bs=32 count=1 2>/dev/null | sha256) + if mkdir $_tmpdir; then rmdir ${_tmpdir} else if [ -h /tmp ]; then