Skip to content

Commit

Permalink
ensure /var/lock dir exists
Browse files Browse the repository at this point in the history
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
  • Loading branch information
crazy-max committed Aug 20, 2024
1 parent a173e98 commit b555f9b
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/xx-apk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions src/xx-apt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions src/xx-cargo
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions src/xx-cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions src/xx-verify
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b555f9b

Please sign in to comment.