From a5229b934af8dda2e807aa4cbee42869d0986c46 Mon Sep 17 00:00:00 2001 From: kre Date: Sat, 23 Jul 2016 01:38:35 +0000 Subject: [PATCH] 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.) --- etc/rc.d/mountcritlocal | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/etc/rc.d/mountcritlocal b/etc/rc.d/mountcritlocal index f74f70a70f87..d3f0f7c90b73 100755 --- a/etc/rc.d/mountcritlocal +++ b/etc/rc.d/mountcritlocal @@ -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