diff options
author | Daniel Baumann <daniel@debian.org> | 2008-11-01 14:40:21 +0100 |
---|---|---|
committer | Daniel Baumann <daniel@debian.org> | 2011-03-09 19:03:43 +0100 |
commit | db5d2b0dcdae96e712661605e17bc9875e224f9f (patch) | |
tree | c58dc5adcfccf5f23c27f67f8a73ef2b21b66680 /functions/lockfile.sh | |
parent | 425f88e9ec5feed5fa323d3eb0176bf8b99b8da1 (diff) | |
download | vyos-live-build-db5d2b0dcdae96e712661605e17bc9875e224f9f.tar.gz vyos-live-build-db5d2b0dcdae96e712661605e17bc9875e224f9f.zip |
Syncing internal lockfile functions.
Diffstat (limited to 'functions/lockfile.sh')
-rwxr-xr-x | functions/lockfile.sh | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/functions/lockfile.sh b/functions/lockfile.sh index 93da69e4d..c4010fb67 100755 --- a/functions/lockfile.sh +++ b/functions/lockfile.sh @@ -11,10 +11,15 @@ Check_lockfile () { FILE="${1}" + if [ -z "${FILE}" ] + then + FILE="/var/lock/${PROGRAM}.lock" + fi + # Checking lock file if [ -f "${FILE}" ] then - Echo_error "system locked" + Echo_error "${PROGRAM} locked" exit 1 fi } @@ -22,7 +27,13 @@ Check_lockfile () Create_lockfile () { FILE="${1}" - DIRECTORY="$(dirname ${1})" + + if [ -z "${FILE}" ] + then + FILE="/var/lock/${PROGRAM}.lock" + fi + + DIRECTORY="$(dirname ${FILE})" # Creating lock directory mkdir -p "${DIRECTORY}" |