commit:     2b69063f19a03e9224eeaa6cecd35dd2004127c0
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Tue Oct  5 01:11:27 2021 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Tue Oct  5 01:11:27 2021 +0000
URL:        
https://gitweb.gentoo.org/proj/build-docbook-catalog.git/commit/?id=2b69063f

add explicit check & error message for /run/lock

If the system is missing its lock dir, show an explicit error message
instead of confusing bash "file does not exist" errors.

Bug: https://bugs.gentoo.org/816303
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

 build-docbook-catalog | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/build-docbook-catalog b/build-docbook-catalog
index 9064d72..5b6cd85 100755
--- a/build-docbook-catalog
+++ b/build-docbook-catalog
@@ -66,7 +66,12 @@ main() {
                mkdir -p "${ROOT}${ROOTCONFDIR}" || error "could not create 
${ROOTCONFDIR}"
        fi
 
-       local lock="${ROOT}/run/lock/build-docbook-catalog.lock"
+       local lock_dir="${ROOT}/run/lock"
+       if [[ ! -d ${lock_dir} ]] ; then
+               error "${lock_dir}: missing critical system path; please create 
it"
+       fi
+
+       local lock="${lock_dir}/build-docbook-catalog.lock"
        (
        # Lock the dir to avoid trashing other runs that might
        # be running parallel.

Reply via email to