summaryrefslogtreecommitdiff
path: root/functions/lockfile.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel@debian.org>2008-11-01 14:40:21 +0100
committerDaniel Baumann <daniel@debian.org>2011-03-09 19:03:43 +0100
commitdb5d2b0dcdae96e712661605e17bc9875e224f9f (patch)
treec58dc5adcfccf5f23c27f67f8a73ef2b21b66680 /functions/lockfile.sh
parent425f88e9ec5feed5fa323d3eb0176bf8b99b8da1 (diff)
downloadvyos-live-build-db5d2b0dcdae96e712661605e17bc9875e224f9f.tar.gz
vyos-live-build-db5d2b0dcdae96e712661605e17bc9875e224f9f.zip
Syncing internal lockfile functions.
Diffstat (limited to 'functions/lockfile.sh')
-rwxr-xr-xfunctions/lockfile.sh15
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}"