From b555f9ba58bd8baa05741f42f8e1cc3cff8f088f Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Tue, 20 Aug 2024 18:21:54 +0200 Subject: [PATCH] ensure /var/lock dir exists Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- src/xx-apk | 5 +++++ src/xx-apt | 5 +++++ src/xx-cargo | 5 +++++ src/xx-cc | 5 +++++ src/xx-verify | 5 +++++ 5 files changed, 25 insertions(+) diff --git a/src/xx-apk b/src/xx-apk index efc1f7ec..6f533b25 100755 --- a/src/xx-apk +++ b/src/xx-apk @@ -3,6 +3,11 @@ set -e if [ -z "$XX_APK_NOLOCK" ]; then + if [ -L /var/lock ] && [ ! -e "$(readlink -f /var/lock)" ]; then + mkdir -p "$(readlink -f /var/lock)" + elif [ ! -d /var/lock ]; then + mkdir -p /var/lock + fi lock="/var/lock/xx-apk" exec 9>$lock flock -x 9 diff --git a/src/xx-apt b/src/xx-apt index 0fc79ffc..08c16c40 100755 --- a/src/xx-apt +++ b/src/xx-apt @@ -3,6 +3,11 @@ set -e if [ -z "$XX_APT_NOLOCK" ]; then + if [ -L /var/lock ] && [ ! -e "$(readlink -f /var/lock)" ]; then + mkdir -p "$(readlink -f /var/lock)" + elif [ ! -d /var/lock ]; then + mkdir -p /var/lock + fi lock="/var/lock/xx-apt" exec 9>$lock flock -x 9 diff --git a/src/xx-cargo b/src/xx-cargo index 1af1b1bb..a24e0c20 100755 --- a/src/xx-cargo +++ b/src/xx-cargo @@ -10,6 +10,11 @@ execSilent() { } if [ -z "$XX_CARGO_NOLOCK" ]; then + if [ -L /var/lock ] && [ ! -e "$(readlink -f /var/lock)" ]; then + mkdir -p "$(readlink -f /var/lock)" + elif [ ! -d /var/lock ]; then + mkdir -p /var/lock + fi lock="/var/lock/xx-cargo" exec 9>$lock flock -x 9 diff --git a/src/xx-cc b/src/xx-cc index 1a9fcb33..445c0ebc 100755 --- a/src/xx-cc +++ b/src/xx-cc @@ -301,6 +301,11 @@ fi setup() { if [ -z "$XX_CC_NOLOCK" ]; then + if [ -L /var/lock ] && [ ! -e "$(readlink -f /var/lock)" ]; then + mkdir -p "$(readlink -f /var/lock)" + elif [ ! -d /var/lock ]; then + mkdir -p /var/lock + fi lock="/var/lock/xx-cc" exec 9>$lock flock -x 9 diff --git a/src/xx-verify b/src/xx-verify index 4951aa43..ef51e7ce 100755 --- a/src/xx-verify +++ b/src/xx-verify @@ -3,6 +3,11 @@ set -e if [ -z "$XX_VERIFY_NOLOCK" ]; then + if [ -L /var/lock ] && [ ! -e "$(readlink -f /var/lock)" ]; then + mkdir -p "$(readlink -f /var/lock)" + elif [ ! -d /var/lock ]; then + mkdir -p /var/lock + fi lock="/var/lock/xx-verify" exec 9>$lock flock -x 9