Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/etc/rc.d Cause rc to abort if mounting any of the critical l...



details:   https://anonhg.NetBSD.org/src/rev/6d0da7d2b7b1
branches:  trunk
changeset: 346626:6d0da7d2b7b1
user:      kre <kre%NetBSD.org@localhost>
date:      Sat Jul 23 01:38:35 2016 +0000

description:
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.)

diffstat:

 etc/rc.d/mountcritlocal |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (36 lines):

diff -r 37c6e2ff65da -r 6d0da7d2b7b1 etc/rc.d/mountcritlocal
--- a/etc/rc.d/mountcritlocal   Fri Jul 22 19:50:44 2016 +0000
+++ b/etc/rc.d/mountcritlocal   Sat Jul 23 01:38:35 2016 +0000
@@ -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 @@
        #       (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



Home | Main Index | Thread Index | Old Index