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.
This commit is contained in:
parent
9f240be2b0
commit
10237e9c72
26
etc/rc.d/tmp
26
etc/rc.d/tmp
@ -37,20 +37,20 @@ stop_cmd=':'
|
|||||||
|
|
||||||
load_rc_config $name
|
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
|
# If we do not have a writable /tmp, create a memory
|
||||||
# filesystem for /tmp. If /tmp is a symlink (e.g. to /var/tmp,
|
# filesystem for /tmp. If /tmp is a symlink (e.g. to /var/tmp,
|
||||||
# then it should already be writable).
|
# then it should already be writable).
|
||||||
#
|
#
|
||||||
case "${tmpmfs}" in
|
case "${tmpmfs}" in
|
||||||
[Yy][Ee][Ss])
|
[Aa][Uu][Tt][Oo])
|
||||||
if ! /bin/df /tmp | grep -q "^/dev/md[0-9]"; then
|
|
||||||
mount_md ${tmpsize} /tmp "${tmpmfs_flags}"
|
|
||||||
chmod 01777 /tmp
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
[Nn][Oo])
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
if _tmpdir=$(mktemp -d -q /tmp/.diskless.XXXXXX); then
|
if _tmpdir=$(mktemp -d -q /tmp/.diskless.XXXXXX); then
|
||||||
rmdir ${_tmpdir}
|
rmdir ${_tmpdir}
|
||||||
else
|
else
|
||||||
@ -59,9 +59,13 @@ case "${tmpmfs}" in
|
|||||||
echo "dropping into shell, ^D to continue anyway."
|
echo "dropping into shell, ^D to continue anyway."
|
||||||
/bin/sh
|
/bin/sh
|
||||||
else
|
else
|
||||||
mount_md ${tmpsize} /tmp "${tmpmfs_flags}"
|
mount_tmpmfs
|
||||||
chmod 01777 /tmp
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
*)
|
||||||
|
if checkyesno tmpmfs; then
|
||||||
|
mount_tmpmfs
|
||||||
|
fi
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
Loading…
Reference in New Issue
Block a user