summaryrefslogtreecommitdiff
path: root/functions
diff options
context:
space:
mode:
authorDaniel Baumann <daniel@debian.org>2007-11-11 22:03:02 +0100
committerDaniel Baumann <daniel@debian.org>2011-03-09 18:22:29 +0100
commit7bbb741e1c10df33f565f8482046c95e4fe0287d (patch)
tree5893bc7561fce4dc1d88b82f37109449ae50653c /functions
parent2a9079644708eedd190b82675a76372f9c8abd7e (diff)
downloadlive-build-7bbb741e1c10df33f565f8482046c95e4fe0287d.zip
live-build-7bbb741e1c10df33f565f8482046c95e4fe0287d.tar.gz
Extending --force to also cover lockfiles to avoid recursive loop within trap.
Diffstat (limited to 'functions')
-rwxr-xr-xfunctions/lockfile.sh19
1 files changed, 11 insertions, 8 deletions
diff --git a/functions/lockfile.sh b/functions/lockfile.sh
index 8af6757..eda8d81 100755
--- a/functions/lockfile.sh
+++ b/functions/lockfile.sh
@@ -23,15 +23,18 @@ Check_lockfile ()
Create_lockfile ()
{
- FILE="${1}"
- DIRECTORY="$(dirname ${1})"
+ if [ "${LH_FORCE}" != "enabled" ]
+ then
+ FILE="${1}"
+ DIRECTORY="$(dirname ${1})"
- # Creating lock directory
- mkdir -p "${DIRECTORY}"
+ # Creating lock directory
+ mkdir -p "${DIRECTORY}"
- # Creating lock trap
- trap 'ret=${?}; '"rm -f \"${FILE}\"; "'for FILESYSTEM in devpts proc sysfs; do lh_chroot_${FILESYSTEM} remove; done; exit ${ret}' EXIT
+ # Creating lock trap
+ trap 'ret=${?}; '"rm -f \"${FILE}\"; "'for FILESYSTEM in devpts proc sysfs; do lh_chroot_${FILESYSTEM} remove --force; done; exit ${ret}' EXIT
- # Creating lock file
- touch "${FILE}"
+ # Creating lock file
+ touch "${FILE}"
+ fi
}