Cause rc to abort if mounting any of the critical local filesystems fails

rather than just ignoring the error.

Don't bother attempting to clear the contents of /var/run if /var/run
does not exist.

In that case the mkdir of /var/run/lvm would have failed - correct that
by using mkdir -p (which as a side effect will ensure /var/run exists
and is available for later scripts to use if for some reason it did not exist.)
This commit is contained in:
kre 2016-07-23 01:38:35 +00:00
parent 96f7f6331a
commit a5229b934a
1 changed files with 6 additions and 4 deletions

View File

@ -1,6 +1,6 @@
#!/bin/sh
#
# $NetBSD: mountcritlocal,v 1.14 2014/07/22 17:11:09 wiz Exp $
# $NetBSD: mountcritlocal,v 1.15 2016/07/23 01:38:35 kre Exp $
#
# PROVIDE: mountcritlocal
@ -18,19 +18,21 @@ mountcritlocal_start()
# (as specified in $critical_filesystems_local)
# This usually includes /var.
#
mount_critical_filesystems local
mount_critical_filesystems local || return $?
# clean up left-over files.
# this could include the cleanup of lock files and /var/run, etc.
#
rm -f /etc/nologin /var/spool/lock/LCK.*
(cd /var/run && rm -rf -- *)
test -d /var/run && (cd /var/run && rm -rf -- *)
# create LVM locking directory, it needs to be owned by operator
# group and has parmissions to allow lock file creation.
#
mkdir /var/run/lvm
mkdir -p /var/run/lvm
chown root:operator /var/run/lvm
chmod 770 /var/run/lvm
return 0
}
load_rc_config $name