Skip to content

Commit

Permalink
Merge pull request #168 from crazy-max/alpine-var-lock
Browse files Browse the repository at this point in the history
ensure /var/lock dir exists
  • Loading branch information
crazy-max authored Aug 20, 2024
2 parents a173e98 + b555f9b commit b4e4c45
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 b4e4c45

Please sign in to comment.