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 | |
parent | 425f88e9ec5feed5fa323d3eb0176bf8b99b8da1 (diff) | |
download | live-build-db5d2b0dcdae96e712661605e17bc9875e224f9f.zip live-build-db5d2b0dcdae96e712661605e17bc9875e224f9f.tar.gz |
Syncing internal lockfile functions.
-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 93da69e..c4010fb 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}" |