diff --git a/src/etc/rc b/src/etc/rc index ad68b8325..2e8c91b19 100755 --- a/src/etc/rc +++ b/src/etc/rc @@ -135,7 +135,7 @@ fi /etc/rc.d/dmesg onestart # XXX pre-17.1 compat: avoid matching use_mfs_tmpvar -USE_MFS_TMP=`/usr/bin/grep -c 'use_mfs_tmp[^_]' /conf/config.xml` +USE_MFS_TMP=$(/usr/bin/grep -c 'use_mfs_tmp[^_]' /conf/config.xml) if [ ${USE_MFS_TMP} -ne 0 ]; then mount -t tmpfs -o mode=01777 tmpfs /tmp diff --git a/src/etc/rc.subr.d/var b/src/etc/rc.subr.d/var index f8a980fa1..465b79956 100755 --- a/src/etc/rc.subr.d/var +++ b/src/etc/rc.subr.d/var @@ -111,7 +111,17 @@ for RC_FILE in ${RC_FILES}; do done # XXX pre-17.1 compat: use_mfs_tmpvar matches both patterns -USE_MFS_VAR=`/usr/bin/grep -c 'use_mfs_.*var[^_]' /conf/config.xml` +USE_MFS_VAR=$(/usr/bin/grep -c 'use_mfs_.*var[^_]' /conf/config.xml) + +# see if / is writable (aka. non-LiveCD boot) +if _tmpdir=$(mktemp -d -q /.diskless.XXXXXX); then + # only remove the directory + rmdir ${_tmpdir} +else + # config restore for install media does not support + # this as neither /var nor /root are persistent + USE_MFS_VAR=0 +fi if [ ${USE_MFS_VAR} -ne 0 ]; then echo -n "Setting up memory disks..."