summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorjnqnfe <jnqnfe@gmail.com>2015-02-05 03:30:47 +0000
committerLyndon Brown <jnqnfe@gmail.com>2020-03-13 15:37:38 +0000
commitb27927724a5da017796d16de47979116d01455dc (patch)
treed8ca219d15a873198be13b8feb1d3ad8a10b63c8 /scripts
parent346e3e1c36f8dc61e93fdd76dd28174d85e2aa5d (diff)
downloadvyos-live-build-b27927724a5da017796d16de47979116d01455dc.tar.gz
vyos-live-build-b27927724a5da017796d16de47979116d01455dc.zip
locks: tidy lock acquisition
Combine the check+create done in each script. (The original functions are still callable as before, but a new combined `Aquire_lockfile` function can be called instead, as now used). Note, a further simplification could be done in removing the passing of the lock filename in as a parameter since every use of the functions is with ".lock". The lock functions already have a fallback to ".build/lock" though. Checking the history, the fallback used to be for a system wide lock, which was then replaced with this config-tree specific one. As long as that is not used implicitly by 3rd-party hooks then surely we are free to change the fallback to ".lock" and further remove passing in a name as a param...? history: db5d2b0dcdae96e712661605e17bc9875e224f9f 0aa8289a3773fd8a3885090b72622c2f95ab099c Gbp-Dch: Short Closes: #952918
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/build/binary_checksums7
-rwxr-xr-xscripts/build/binary_chroot7
-rwxr-xr-xscripts/build/binary_disk7
-rwxr-xr-xscripts/build/binary_grub-efi7
-rwxr-xr-xscripts/build/binary_grub-legacy7
-rwxr-xr-xscripts/build/binary_grub-pc7
-rwxr-xr-xscripts/build/binary_hdd7
-rwxr-xr-xscripts/build/binary_hooks7
-rwxr-xr-xscripts/build/binary_includes7
-rwxr-xr-xscripts/build/binary_iso7
-rwxr-xr-xscripts/build/binary_linux-image7
-rwxr-xr-xscripts/build/binary_loadlin8
-rwxr-xr-xscripts/build/binary_loopback_cfg7
-rwxr-xr-xscripts/build/binary_manifest7
-rwxr-xr-xscripts/build/binary_memtest7
-rwxr-xr-xscripts/build/binary_netboot7
-rwxr-xr-xscripts/build/binary_onie7
-rwxr-xr-xscripts/build/binary_package-lists7
-rwxr-xr-xscripts/build/binary_rootfs13
-rwxr-xr-xscripts/build/binary_syslinux7
-rwxr-xr-xscripts/build/binary_tar7
-rwxr-xr-xscripts/build/binary_win32-loader7
-rwxr-xr-xscripts/build/binary_zsync7
-rwxr-xr-xscripts/build/bootstrap_archives7
-rwxr-xr-xscripts/build/bootstrap_cache14
-rwxr-xr-xscripts/build/bootstrap_debootstrap7
-rwxr-xr-xscripts/build/chroot_apt14
-rwxr-xr-xscripts/build/chroot_archives14
-rwxr-xr-xscripts/build/chroot_cache14
-rwxr-xr-xscripts/build/chroot_debianchroot14
-rwxr-xr-xscripts/build/chroot_devpts14
-rwxr-xr-xscripts/build/chroot_dpkg14
-rwxr-xr-xscripts/build/chroot_firmware7
-rwxr-xr-xscripts/build/chroot_hacks7
-rwxr-xr-xscripts/build/chroot_hooks7
-rwxr-xr-xscripts/build/chroot_hostname14
-rwxr-xr-xscripts/build/chroot_hosts14
-rwxr-xr-xscripts/build/chroot_includes7
-rwxr-xr-xscripts/build/chroot_install-packages7
-rwxr-xr-xscripts/build/chroot_interactive7
-rwxr-xr-xscripts/build/chroot_linux-image7
-rwxr-xr-xscripts/build/chroot_package-lists7
-rwxr-xr-xscripts/build/chroot_preseed7
-rwxr-xr-xscripts/build/chroot_proc14
-rwxr-xr-xscripts/build/chroot_resolv14
-rwxr-xr-xscripts/build/chroot_selinuxfs14
-rwxr-xr-xscripts/build/chroot_sysfs14
-rwxr-xr-xscripts/build/chroot_sysv-rc14
-rwxr-xr-xscripts/build/chroot_tmpfs14
-rwxr-xr-xscripts/build/clean2
-rwxr-xr-xscripts/build/installer_debian-installer7
-rwxr-xr-xscripts/build/installer_preseed7
-rwxr-xr-xscripts/build/source_checksums7
-rwxr-xr-xscripts/build/source_debian7
-rwxr-xr-xscripts/build/source_disk7
-rwxr-xr-xscripts/build/source_hdd7
-rwxr-xr-xscripts/build/source_hooks7
-rwxr-xr-xscripts/build/source_iso7
-rwxr-xr-xscripts/build/source_live7
-rwxr-xr-xscripts/build/source_tar7
60 files changed, 152 insertions, 375 deletions
diff --git a/scripts/build/binary_checksums b/scripts/build/binary_checksums
index 3b2ce9d3d..c0993cbd6 100755
--- a/scripts/build/binary_checksums
+++ b/scripts/build/binary_checksums
@@ -32,11 +32,8 @@ Require_stagefile .build/config .build/bootstrap
# Checking stage file
Check_stagefile .build/binary_checksums
-# Checking lock file
-Check_lockfile .lock
-
-# Creating lock file
-Create_lockfile .lock
+# Aquire lock file
+Acquire_lockfile
for CHECKSUM in ${LB_CHECKSUMS}
do
diff --git a/scripts/build/binary_chroot b/scripts/build/binary_chroot
index 0a6e80753..f97489d02 100755
--- a/scripts/build/binary_chroot
+++ b/scripts/build/binary_chroot
@@ -29,11 +29,8 @@ Require_stagefile .build/config .build/bootstrap
# Checking stage file
Check_stagefile .build/binary_chroot
-# Checking lock file
-Check_lockfile .lock
-
-# Creating lock file
-Create_lockfile .lock
+# Aquire lock file
+Acquire_lockfile
# Normally, virtual filesystems are not mounted here, but people tend to be lazy
if [ -f chroot/proc/version ]
diff --git a/scripts/build/binary_disk b/scripts/build/binary_disk
index aed2a41e3..10175e88c 100755
--- a/scripts/build/binary_disk
+++ b/scripts/build/binary_disk
@@ -37,11 +37,8 @@ Require_stagefile .build/config .build/bootstrap
# Checking stage file
Check_stagefile .build/binary_disk
-# Checking lock file
-Check_lockfile .lock
-
-# Creating lock file
-Create_lockfile .lock
+# Aquire lock file
+Acquire_lockfile
mkdir -p binary/.disk
diff --git a/scripts/build/binary_grub-efi b/scripts/build/binary_grub-efi
index 1eaea3fb5..cc89f7d5e 100755
--- a/scripts/build/binary_grub-efi
+++ b/scripts/build/binary_grub-efi
@@ -31,11 +31,8 @@ Require_stagefile .build/config .build/bootstrap
# Checking stage file
Check_stagefile .build/binary_grub-efi
-# Checking lock file
-Check_lockfile .lock
-
-# Creating lock file
-Create_lockfile .lock
+# Aquire lock file
+Acquire_lockfile
# Check architecture
Check_architectures amd64 i386 arm64
diff --git a/scripts/build/binary_grub-legacy b/scripts/build/binary_grub-legacy
index f5c050e3b..f36ae4812 100755
--- a/scripts/build/binary_grub-legacy
+++ b/scripts/build/binary_grub-legacy
@@ -31,11 +31,8 @@ Require_stagefile .build/config .build/bootstrap
# Checking stage file
Check_stagefile .build/binary_grub-legacy
-# Checking lock file
-Check_lockfile .lock
-
-# Creating lock file
-Create_lockfile .lock
+# Aquire lock file
+Acquire_lockfile
# Check architecture
Check_architectures amd64 i386
diff --git a/scripts/build/binary_grub-pc b/scripts/build/binary_grub-pc
index c2ad7d7af..433f35370 100755
--- a/scripts/build/binary_grub-pc
+++ b/scripts/build/binary_grub-pc
@@ -31,11 +31,8 @@ Require_stagefile .build/config .build/bootstrap
# Checking stage file
Check_stagefile .build/binary_grub
-# Checking lock file
-Check_lockfile .lock
-
-# Creating lock file
-Create_lockfile .lock
+# Aquire lock file
+Acquire_lockfile
# Check architecture
Check_architectures amd64 i386
diff --git a/scripts/build/binary_hdd b/scripts/build/binary_hdd
index ee946c822..050fd584a 100755
--- a/scripts/build/binary_hdd
+++ b/scripts/build/binary_hdd
@@ -34,11 +34,8 @@ Require_stagefile .build/config .build/bootstrap .build/chroot_proc
# Checking stage file
Check_stagefile .build/binary_hdd
-# Checking lock file
-Check_lockfile .lock
-
-# Creating lock file
-Create_lockfile .lock
+# Aquire lock file
+Acquire_lockfile
# Checking depends
case "${LB_BINARY_FILESYSTEM}" in
diff --git a/scripts/build/binary_hooks b/scripts/build/binary_hooks
index 6a3b9bfec..5ed7d1b0f 100755
--- a/scripts/build/binary_hooks
+++ b/scripts/build/binary_hooks
@@ -29,11 +29,8 @@ Require_stagefile .build/config .build/bootstrap
# Checking stage file
Check_stagefile .build/binary_hooks
-# Checking lock file
-Check_lockfile .lock
-
-# Creating lock file
-Create_lockfile .lock
+# Aquire lock file
+Acquire_lockfile
## Processing distribution hooks
diff --git a/scripts/build/binary_includes b/scripts/build/binary_includes
index 6e0c79716..1514c035d 100755
--- a/scripts/build/binary_includes
+++ b/scripts/build/binary_includes
@@ -29,11 +29,8 @@ Require_stagefile .build/config .build/bootstrap
# Checking stage file
Check_stagefile .build/binary_includes
-# Checking lock file
-Check_lockfile .lock
-
-# Creating lock file
-Create_lockfile .lock
+# Aquire lock file
+Acquire_lockfile
if Find_files config/includes.binary/
then
diff --git a/scripts/build/binary_iso b/scripts/build/binary_iso
index 3aecf8a56..9a6b851ee 100755
--- a/scripts/build/binary_iso
+++ b/scripts/build/binary_iso
@@ -43,11 +43,8 @@ Require_stagefile .build/config .build/bootstrap
# Checking stage file
Check_stagefile .build/binary_iso
-# Checking lock file
-Check_lockfile .lock
-
-# Creating lock file
-Create_lockfile .lock
+# Aquire lock file
+Acquire_lockfile
# Checking depends
Check_package chroot /usr/bin/xorriso xorriso
diff --git a/scripts/build/binary_linux-image b/scripts/build/binary_linux-image
index 49e04c756..c3fec31ba 100755
--- a/scripts/build/binary_linux-image
+++ b/scripts/build/binary_linux-image
@@ -34,11 +34,8 @@ Require_stagefile .build/config .build/bootstrap
# Checking stage file
Check_stagefile .build/binary_linux-image
-# Checking lock file
-Check_lockfile .lock
-
-# Creating lock file
-Create_lockfile .lock
+# Aquire lock file
+Acquire_lockfile
case "${LB_INITRAMFS}" in
live-boot)
diff --git a/scripts/build/binary_loadlin b/scripts/build/binary_loadlin
index 5719c3dad..9c779bdcd 100755
--- a/scripts/build/binary_loadlin
+++ b/scripts/build/binary_loadlin
@@ -34,12 +34,8 @@ Require_stagefile .build/config .build/bootstrap
# Checking stage file
Check_stagefile .build/binary_loadlin
-# Checking lock file
-Check_lockfile .lock
-
-# Creating lock file
-Create_lockfile .lock
-
+# Aquire lock file
+Acquire_lockfile
case "${LB_ARCHITECTURES}" in
amd64|i386)
diff --git a/scripts/build/binary_loopback_cfg b/scripts/build/binary_loopback_cfg
index 63a9363a5..af0933b71 100755
--- a/scripts/build/binary_loopback_cfg
+++ b/scripts/build/binary_loopback_cfg
@@ -33,11 +33,8 @@ Require_stagefile .build/config .build/bootstrap
# Checking stage file
Check_stagefile .build/binary_loopback_cfg
-# Checking lock file
-Check_lockfile .lock
-
-# Creating lock file
-Create_lockfile .lock
+# Aquire lock file
+Acquire_lockfile
# Check architecture
Check_architectures amd64 i386
diff --git a/scripts/build/binary_manifest b/scripts/build/binary_manifest
index aabae77a8..d815c4440 100755
--- a/scripts/build/binary_manifest
+++ b/scripts/build/binary_manifest
@@ -34,11 +34,8 @@ Require_stagefile .build/config .build/bootstrap
# Checking stage file
Check_stagefile .build/binary_manifest
-# Checking lock file
-Check_lockfile .lock
-
-# Creating lock file
-Create_lockfile .lock
+# Aquire lock file
+Acquire_lockfile
case "${LB_INITRAMFS}" in
live-boot)
diff --git a/scripts/build/binary_memtest b/scripts/build/binary_memtest
index 221f77265..e4a954c8c 100755
--- a/scripts/build/binary_memtest
+++ b/scripts/build/binary_memtest
@@ -34,11 +34,8 @@ Require_stagefile .build/config .build/bootstrap
# Checking stage file
Check_stagefile .build/binary_memtest
-# Checking lock file
-Check_lockfile .lock
-
-# Creating lock file
-Create_lockfile .lock
+# Aquire lock file
+Acquire_lockfile
if [ "${LB_ARCHITECTURES}" != "amd64" ] && [ "${LB_ARCHITECTURES}" != "i386" ]
then
diff --git a/scripts/build/binary_netboot b/scripts/build/binary_netboot
index bed1662b9..2d7381993 100755
--- a/scripts/build/binary_netboot
+++ b/scripts/build/binary_netboot
@@ -39,11 +39,8 @@ Require_stagefile .build/config .build/bootstrap
# Checking stage file
Check_stagefile .build/binary_netboot
-# Checking lock file
-Check_lockfile .lock
-
-# Creating lock file
-Create_lockfile .lock
+# Aquire lock file
+Acquire_lockfile
# Remove old binary
rm -f ${LIVE_IMAGE_NAME}-${LB_ARCHITECTURES}.netboot.tar ${LIVE_IMAGE_NAME}-${LB_ARCHITECTURES}.netboot.tar.gz ${LIVE_IMAGE_NAME}-${LB_ARCHITECTURES}.netboot.tar.bz2 ${LIVE_IMAGE_NAME}-${LB_ARCHITECTURES}.netboot.tar.xz ${LIVE_IMAGE_NAME}-${LB_ARCHITECTURES}.netboot.tar.xz
diff --git a/scripts/build/binary_onie b/scripts/build/binary_onie
index 6f6b95fee..d12ab88e2 100755
--- a/scripts/build/binary_onie
+++ b/scripts/build/binary_onie
@@ -47,11 +47,8 @@ Require_stagefile .build/config .build/binary_iso
# Checking stage file
Check_stagefile .build/binary_onie
-# Checking lock file
-Check_lockfile .lock
-
-# Creating lock file
-Create_lockfile .lock
+# Aquire lock file
+Acquire_lockfile
Check_package host /bin/cpio cpio
Check_package host /usr/bin/file file
diff --git a/scripts/build/binary_package-lists b/scripts/build/binary_package-lists
index a5c47a2fc..b220335ff 100755
--- a/scripts/build/binary_package-lists
+++ b/scripts/build/binary_package-lists
@@ -29,11 +29,8 @@ Require_stagefile .build/config .build/bootstrap
# Checking stage file
Check_stagefile .build/binary_package-lists
-# Checking lock file
-Check_lockfile .lock
-
-# Creating lock file
-Create_lockfile .lock
+# Aquire lock file
+Acquire_lockfile
case "${LB_MODE}" in
progress-linux)
diff --git a/scripts/build/binary_rootfs b/scripts/build/binary_rootfs
index 2272d4e31..c02b389c5 100755
--- a/scripts/build/binary_rootfs
+++ b/scripts/build/binary_rootfs
@@ -29,11 +29,8 @@ Require_stagefile .build/config .build/bootstrap .build/binary_chroot
# Checking stage file
Check_stagefile .build/binary_rootfs
-# Checking lock file
-Check_lockfile .lock
-
-# Creating lock file
-Create_lockfile .lock
+# Aquire lock file
+Acquire_lockfile
case "${LB_ARCHITECTURES}" in
amd64|i386)
@@ -135,7 +132,7 @@ case "${LB_CHROOT_FILESYSTEM}" in
if [ -e chroot/chroot.cache ]
then
- rm -f .lock
+ Remove_lockfile
mv chroot/chroot chroot.tmp
lb chroot_archives binary remove ${@}
@@ -223,7 +220,7 @@ case "${LB_CHROOT_FILESYSTEM}" in
if [ -e chroot/chroot.cache ]
then
- rm -f .lock
+ Remove_lockfile
mv chroot/chroot chroot.tmp
lb chroot_archives binary remove ${@}
@@ -358,7 +355,7 @@ case "${LB_CHROOT_FILESYSTEM}" in
if [ -e chroot/chroot.cache ]
then
- rm -f .lock
+ Remove_lockfile
mv chroot/chroot chroot.tmp
lb chroot_archives binary remove ${@}
diff --git a/scripts/build/binary_syslinux b/scripts/build/binary_syslinux
index 288ee4670..f7ba743bf 100755
--- a/scripts/build/binary_syslinux
+++ b/scripts/build/binary_syslinux
@@ -31,11 +31,8 @@ Require_stagefile .build/config .build/bootstrap
# Checking stage file
Check_stagefile .build/binary_syslinux
-# Checking lock file
-Check_lockfile .lock
-
-# Creating lock file
-Create_lockfile .lock
+# Aquire lock file
+Acquire_lockfile
# Check architecture
Check_architectures amd64 i386
diff --git a/scripts/build/binary_tar b/scripts/build/binary_tar
index d4eb16a93..eadfa5b41 100755
--- a/scripts/build/binary_tar
+++ b/scripts/build/binary_tar
@@ -34,11 +34,8 @@ Require_stagefile .build/config .build/bootstrap
# Checking stage file
Check_stagefile .build/binary_tar
-# Checking lock file
-Check_lockfile .lock
-
-# Creating lock file
-Create_lockfile .lock
+# Aquire lock file
+Acquire_lockfile
# Remove old binary
rm -f ${LIVE_IMAGE_NAME}-${LB_ARCHITECTURES}.tar.bz2 ${LIVE_IMAGE_NAME}-${LB_ARCHITECTURES}.tar.gz ${LIVE_IMAGE_NAME}-${LB_ARCHITECTURES}.tar.lz ${LIVE_IMAGE_NAME}-${LB_ARCHITECTURES}.tar
diff --git a/scripts/build/binary_win32-loader b/scripts/build/binary_win32-loader
index 03868f2f6..1f97ec4cc 100755
--- a/scripts/build/binary_win32-loader
+++ b/scripts/build/binary_win32-loader
@@ -34,11 +34,8 @@ Require_stagefile .build/config .build/bootstrap
# Checking stage file
Check_stagefile .build/binary_win32-loader
-# Checking lock file
-Check_lockfile .lock
-
-# Creating lock file
-Create_lockfile .lock
+# Aquire lock file
+Acquire_lockfile
case "${LB_MODE}" in
progress-linux)
diff --git a/scripts/build/binary_zsync b/scripts/build/binary_zsync
index ca84b202d..2cf8554b6 100755
--- a/scripts/build/binary_zsync
+++ b/scripts/build/binary_zsync
@@ -39,11 +39,8 @@ Require_stagefile .build/config .build/bootstrap
# Checking stage file
Check_stagefile .build/binary_zsync
-# Checking lock file
-Check_lockfile .lock
-
-# Creating lock file
-Create_lockfile .lock
+# Aquire lock file
+Acquire_lockfile
# Checking depends
Check_package chroot /usr/bin/zsyncmake zsync
diff --git a/scripts/build/bootstrap_archives b/scripts/build/bootstrap_archives
index f49fd9ede..a9be7d11e 100755
--- a/scripts/build/bootstrap_archives
+++ b/scripts/build/bootstrap_archives
@@ -36,11 +36,8 @@ Echo_message "Configuring file /etc/apt/sources.list"
# Checking stage file
Check_stagefile .build/bootstrap_archives
-# Checking lock file
-Check_lockfile .lock
-
-# Creating lock file
-Create_lockfile .lock
+# Aquire lock file
+Acquire_lockfile
# Restoring cache
Restore_package_cache chroot
diff --git a/scripts/build/bootstrap_cache b/scripts/build/bootstrap_cache
index 5ed474090..994cf82cf 100755
--- a/scripts/build/bootstrap_cache
+++ b/scripts/build/bootstrap_cache
@@ -38,11 +38,8 @@ case "${1}" in
then
Echo_message "Restoring bootstrap stage from cache..."
- # Checking lock file
- Check_lockfile .lock
-
- # Creating lock file
- Create_lockfile .lock
+ # Aquire lock file
+ Acquire_lockfile
# Removing old chroot
rm -rf chroot
@@ -64,11 +61,8 @@ case "${1}" in
# Checking stage file
Check_stagefile .build/bootstrap_cache.save
- # Checking lock file
- Check_lockfile .lock
-
- # Creating lock file
- Create_lockfile .lock
+ # Aquire lock file
+ Acquire_lockfile
rm -rf cache/bootstrap
diff --git a/scripts/build/bootstrap_debootstrap b/scripts/build/bootstrap_debootstrap
index 6da968343..87d96b725 100755
--- a/scripts/build/bootstrap_debootstrap
+++ b/scripts/build/bootstrap_debootstrap
@@ -40,11 +40,8 @@ Check_package chroot bin/debootstrap debootstrap
Check_stagefile .build/bootstrap
Check_stagefile .build/bootstrap_cache.restore
-# Checking lock file
-Check_lockfile .lock
-
-# Creating lock file
-Create_lockfile .lock
+# Aquire lock file
+Acquire_lockfile
# Creating chroot directory
mkdir -p chroot
diff --git a/scripts/build/chroot_apt b/scripts/build/chroot_apt
index 424d05336..2fbd58391 100755
--- a/scripts/build/chroot_apt
+++ b/scripts/build/chroot_apt
@@ -31,11 +31,8 @@ case "${1}" in
# Checking stage file
Check_stagefile .build/chroot_apt
- # Checking lock file
- Check_lockfile .lock
-
- # Creating lock file
- Create_lockfile .lock
+ # Aquire lock file
+ Acquire_lockfile
mkdir -p chroot/etc/apt/apt.conf.d
@@ -214,11 +211,8 @@ EOF
remove)
Echo_message "Deconfiguring file /etc/apt/apt.conf"
- # Checking lock file
- Check_lockfile .lock
-
- # Creating lock file
- Create_lockfile .lock
+ # Aquire lock file
+ Acquire_lockfile
# Deconfiguring aptitude ftp proxy
rm -f chroot/etc/apt/apt.conf.d/00ftp-proxy
diff --git a/scripts/build/chroot_archives b/scripts/build/chroot_archives
index b602caf4b..2457b534d 100755
--- a/scripts/build/chroot_archives
+++ b/scripts/build/chroot_archives
@@ -38,11 +38,8 @@ case "${1}" in
# Checking stage file
Check_stagefile .build/chroot_archives
- # Checking lock file
- Check_lockfile .lock
-
- # Creating lock file
- Create_lockfile .lock
+ # Aquire lock file
+ Acquire_lockfile
# Restoring cache
Restore_package_cache chroot
@@ -321,11 +318,8 @@ case "${1}" in
remove)
Echo_message "Deconfiguring file /etc/apt/sources.list"
- # Checking lock file
- Check_lockfile .lock
-
- # Creating lock file
- Create_lockfile .lock
+ # Aquire lock file
+ Acquire_lockfile
# Restore top-level sources
if [ -e chroot/etc/apt/sources.list.d/zz-sources.list ]
diff --git a/scripts/build/chroot_cache b/scripts/build/chroot_cache
index 7fea36381..913a37545 100755
--- a/scripts/build/chroot_cache
+++ b/scripts/build/chroot_cache
@@ -35,11 +35,8 @@ case "${1}" in
if [ -d cache/chroot ]
then
- # Checking lock file
- Check_lockfile .lock
-
- # Creating lock file
- Create_lockfile .lock
+ # Aquire lock file
+ Acquire_lockfile
# Removing old chroot
rm -rf chroot
@@ -60,11 +57,8 @@ case "${1}" in
# Checking stage file
Check_stagefile .build/chroot_cache.save
- # Checking lock file
- Check_lockfile .lock
-
- # Creating lock file
- Create_lockfile .lock
+ # Aquire lock file
+ Acquire_lockfile
rm -rf cache/chroot
diff --git a/scripts/build/chroot_debianchroot b/scripts/build/chroot_debianchroot
index 5e7322f73..49c2984a6 100755
--- a/scripts/build/chroot_debianchroot
+++ b/scripts/build/chroot_debianchroot
@@ -31,11 +31,8 @@ case "${1}" in
# Checking stage file
Check_stagefile .build/chroot_debianchroot
- # Checking lock file
- Check_lockfile .lock
-
- # Creating lock file
- Create_lockfile .lock
+ # Aquire lock file
+ Acquire_lockfile
if [ -f chroot/etc/debian_chroot ]
then
@@ -53,11 +50,8 @@ case "${1}" in
remove)
Echo_message "Deconfiguring file /etc/debian_chroot"
- # Checking lock file
- Check_lockfile .lock
-
- # Creating lock file
- Create_lockfile .lock
+ # Aquire lock file
+ Acquire_lockfile
if [ -f chroot/etc/debian_chroot.orig ]
then
diff --git a/scripts/build/chroot_devpts b/scripts/build/chroot_devpts
index 3d62d9270..320859746 100755
--- a/scripts/build/chroot_devpts
+++ b/scripts/build/chroot_devpts
@@ -31,11 +31,8 @@ case "${1}" in
# Checking stage file
Check_stagefile .build/chroot_devpts
- # Checking lock file
- Check_lockfile .lock
-
- # Creating lock file
- Create_lockfile .lock
+ # Aquire lock file
+ Acquire_lockfile
# Creating mountpoint
mkdir -p chroot/dev/pts
@@ -50,11 +47,8 @@ case "${1}" in
remove)
Echo_message "Begin unmounting /dev/pts..."
- # Checking lock file
- Check_lockfile .lock
-
- # Creating lock file
- Create_lockfile .lock
+ # Aquire lock file
+ Acquire_lockfile
# Unmounting /dev/pts
if grep -qs "$(pwd)/chroot/dev/pts" /proc/mounts || Find_files chroot/dev/pts/*
diff --git a/scripts/build/chroot_dpkg b/scripts/build/chroot_dpkg
index e0a81756a..eaaf3585f 100755
--- a/scripts/build/chroot_dpkg
+++ b/scripts/build/chroot_dpkg
@@ -31,11 +31,8 @@ case "${1}" in
# Checking stage file
Check_stagefile .build/chroot_dpkg
- # Checking lock file
- Check_lockfile .lock
-
- # Creating lock file
- Create_lockfile .lock
+ # Aquire lock file
+ Acquire_lockfile
# Create custom start-stop-daemon program
Chroot chroot dpkg-divert --rename --quiet --add /sbin/start-stop-daemon
@@ -65,11 +62,8 @@ EOF
remove)
Echo_message "Deconfiguring file /sbin/start-stop-daemon"
- # Checking lock file
- Check_lockfile .lock
-
- # Creating lock file
- Create_lockfile .lock
+ # Aquire lock file
+ Acquire_lockfile
# Manual hacks for special packages
diff --git a/scripts/build/chroot_firmware b/scripts/build/chroot_firmware
index 673962455..12a1f1a60 100755
--- a/scripts/build/chroot_firmware
+++ b/scripts/build/chroot_firmware
@@ -32,11 +32,8 @@ Require_stagefile .build/config .build/bootstrap
# Checking stage file
Check_stagefile .build/chroot_firmware
-# Checking lock file
-Check_lockfile .lock
-
-# Creating lock file
-Create_lockfile .lock
+# Aquire lock file
+Acquire_lockfile
# Checking depends
Check_package host /usr/bin/wget wget
diff --git a/scripts/build/chroot_hacks b/scripts/build/chroot_hacks
index 28c1eadcc..99021a8ae 100755
--- a/scripts/build/chroot_hacks
+++ b/scripts/build/chroot_hacks
@@ -29,11 +29,8 @@ Require_stagefile .build/config .build/bootstrap
# Checking stage file
Check_stagefile .build/chroot_hacks
-# Checking lock file
-Check_lockfile .lock
-
-# Creating lock file
-Create_lockfile .lock
+# Aquire lock file
+Acquire_lockfile
case "${LIVE_IMAGE_TYPE}" in
netboot)
diff --git a/scripts/build/chroot_hooks b/scripts/build/chroot_hooks
index eb113bb6a..de5c826a9 100755
--- a/scripts/build/chroot_hooks
+++ b/scripts/build/chroot_hooks
@@ -29,11 +29,8 @@ Require_stagefile .build/config .build/bootstrap
# Checking stage file
Check_stagefile .build/chroot_hooks
-# Checking lock file
-Check_lockfile .lock
-
-# Creating lock file
-Create_lockfile .lock
+# Aquire lock file
+Acquire_lockfile
## Processing distribution hooks
diff --git a/scripts/build/chroot_hostname b/scripts/build/chroot_hostname
index 4f393755f..b0206bdc9 100755
--- a/scripts/build/chroot_hostname
+++ b/scripts/build/chroot_hostname
@@ -29,11 +29,8 @@ case "${1}" in
# Checking stage file
Check_stagefile .build/chroot_hostname
- # Checking lock file
- Check_lockfile .lock
-
- # Creating lock file
- Create_lockfile .lock
+ # Aquire lock file
+ Acquire_lockfile
# Create hostname file
Echo_message "Configuring file /etc/hostname"
@@ -60,11 +57,8 @@ EOF
remove)
Echo_message "Deconfiguring file /etc/hostname"
- # Checking lock file
- Check_lockfile .lock
-
- # Creating lock file
- Create_lockfile .lock
+ # Aquire lock file
+ Acquire_lockfile
# Copying hostname from includes, if existing
if [ -e config/includes.chroot/etc/hostname ]
diff --git a/scripts/build/chroot_hosts b/scripts/build/chroot_hosts
index edbcb3793..d7e97fa70 100755
--- a/scripts/build/chroot_hosts
+++ b/scripts/build/chroot_hosts
@@ -31,11 +31,8 @@ case "${1}" in
# Checking stage file
Check_stagefile .build/chroot_hosts
- # Checking lock file
- Check_lockfile .lock
-
- # Creating lock file
- Create_lockfile .lock
+ # Aquire lock file
+ Acquire_lockfile
if [ -f chroot/etc/hosts ]
then
@@ -64,11 +61,8 @@ EOF
remove)
Echo_message "Deconfiguring file /etc/hosts"
- # Checking lock file
- Check_lockfile .lock
-
- # Creating lock file
- Create_lockfile .lock
+ # Aquire lock file
+ Acquire_lockfile
if [ -e config/includes.chroot/etc/hosts ]
then
diff --git a/scripts/build/chroot_includes b/scripts/build/chroot_includes
index 603d58256..fe34fc2d6 100755
--- a/scripts/build/chroot_includes
+++ b/scripts/build/chroot_includes
@@ -29,11 +29,8 @@ Require_stagefile .build/config .build/bootstrap
# Checking stage file
Check_stagefile .build/includes.chroot
-# Checking lock file
-Check_lockfile .lock
-
-# Creating lock file
-Create_lockfile .lock
+# Aquire lock file
+Acquire_lockfile
if Find_files config/includes.chroot/
then
diff --git a/scripts/build/chroot_install-packages b/scripts/build/chroot_install-packages
index b4313cf4c..5f092d5f2 100755
--- a/scripts/build/chroot_install-packages
+++ b/scripts/build/chroot_install-packages
@@ -32,11 +32,8 @@ Require_stagefile .build/config .build/bootstrap
# Checking stage file
Check_stagefile .build/chroot_install-packages.${PASS}
-# Checking lock file
-Check_lockfile .lock
-
-# Creating lock file
-Create_lockfile .lock
+# Aquire lock file
+Acquire_lockfile
# Check for packages specified with foreign architecture
_FOREIGN_ARCHITECTURES_FILE="chroot/root/packages.foreign-architectures"
diff --git a/scripts/build/chroot_interactive b/scripts/build/chroot_interactive
index dbb352ed7..df411b008 100755
--- a/scripts/build/chroot_interactive
+++ b/scripts/build/chroot_interactive
@@ -34,11 +34,8 @@ Require_stagefile .build/config .build/bootstrap
# Checking stage file
Check_stagefile .build/chroot_interactive
-# Checking lock file
-Check_lockfile .lock
-
-# Creating lock file
-Create_lockfile .lock
+# Aquire lock file
+Acquire_lockfile
case "${LB_INTERACTIVE}" in
true|shell)
diff --git a/scripts/build/chroot_linux-image b/scripts/build/chroot_linux-image
index 4cd8664a1..7f342e206 100755
--- a/scripts/build/chroot_linux-image
+++ b/scripts/build/chroot_linux-image
@@ -32,11 +32,8 @@ Require_stagefile .build/config .build/bootstrap
# Checking stage file
Check_stagefile .build/chroot_linux-image
-# Checking lock file
-Check_lockfile .lock
-
-# Creating lock file
-Create_lockfile .lock
+# Aquire lock file
+Acquire_lockfile
# Diverting update-initramfs
#case "${LB_INITRAMFS}" in
diff --git a/scripts/build/chroot_package-lists b/scripts/build/chroot_package-lists
index d74a1e135..c9e8cd9da 100755
--- a/scripts/build/chroot_package-lists
+++ b/scripts/build/chroot_package-lists
@@ -32,11 +32,8 @@ Require_stagefile .build/config .build/bootstrap
# Checking stage file
Check_stagefile .build/chroot_package-lists.${_PASS}
-# Checking lock file
-Check_lockfile .lock
-
-# Creating lock file
-Create_lockfile .lock
+# Aquire lock file
+Acquire_lockfile
# Handling local package lists
if ! ( ls config/package-lists/*.list > /dev/null 2>&1 || \
diff --git a/scripts/build/chroot_preseed b/scripts/build/chroot_preseed
index e5a5fe3a5..0ce6218fa 100755
--- a/scripts/build/chroot_preseed
+++ b/scripts/build/chroot_preseed
@@ -29,11 +29,8 @@ Require_stagefile .build/config .build/bootstrap
# Checking stage file
Check_stagefile .build/chroot_preseed
-# Checking lock file
-Check_lockfile .lock
-
-# Creating lock file
-Create_lockfile .lock
+# Aquire lock file
+Acquire_lockfile
if ls config/preseed/*.cfg > /dev/null 2>&1 || \
ls config/preseed/*.cfg.chroot > /dev/null 2>&1 || \
diff --git a/scripts/build/chroot_proc b/scripts/build/chroot_proc
index 6d1ae8800..52cb72665 100755
--- a/scripts/build/chroot_proc
+++ b/scripts/build/chroot_proc
@@ -31,11 +31,8 @@ case "${1}" in
# Checking stage file
Check_stagefile .build/chroot_proc
- # Checking lock file
- Check_lockfile .lock
-
- # Creating lock file
- Create_lockfile .lock
+ # Aquire lock file
+ Acquire_lockfile
# Creating mountpoint
mkdir -p chroot/proc
@@ -50,11 +47,8 @@ case "${1}" in
remove)
Echo_message "Begin unmounting /proc..."
- # Checking lock file
- Check_lockfile .lock
-
- # Creating lock file
- Create_lockfile .lock
+ # Aquire lock file
+ Acquire_lockfile
# Workaround binfmt-support /proc locking
if [ -e chroot/proc/sys/fs/binfmt_misc/status ]
diff --git a/scripts/build/chroot_resolv b/scripts/build/chroot_resolv
index 160875c24..48fa9412d 100755
--- a/scripts/build/chroot_resolv
+++ b/scripts/build/chroot_resolv
@@ -31,11 +31,8 @@ case "${1}" in
# Checking stage file
Check_stagefile .build/chroot_resolv
- # Checking lock file
- Check_lockfile .lock
-
- # Creating lock file
- Create_lockfile .lock
+ # Aquire lock file
+ Acquire_lockfile
if [ -e chroot/etc/resolv.conf ]
then
@@ -67,11 +64,8 @@ case "${1}" in
remove)
Echo_message "Deconfiguring file /etc/resolv.conf"
- # Checking lock file
- Check_lockfile .lock
-
- # Creating lock file
- Create_lockfile .lock
+ # Aquire lock file
+ Acquire_lockfile
if [ -e config/includes.chroot/etc/resolv.conf ]
then
diff --git a/scripts/build/chroot_selinuxfs b/scripts/build/chroot_selinuxfs
index 7c847dfee..521ba0501 100755
--- a/scripts/build/chroot_selinuxfs
+++ b/scripts/build/chroot_selinuxfs
@@ -33,11 +33,8 @@ case "${1}" in
# Checking stage file
Check_stagefile .build/chroot_selinuxfs
- # Checking lock file
- Check_lockfile .lock
-
- # Creating lock file
- Create_lockfile .lock
+ # Aquire lock file
+ Acquire_lockfile
# Create mountpoint
mkdir -p chroot/sys/fs/selinux
@@ -53,11 +50,8 @@ case "${1}" in
remove)
Echo_message "Begin unmounting /sys/fs/selinux..."
- # Checking lock file
- Check_lockfile .lock
-
- # Creating lock file
- Create_lockfile .lock
+ # Aquire lock file
+ Acquire_lockfile
# Unmounting /sys/fs/selinux
if [ -e chroot/sys/fs/selinux/enforce ]
diff --git a/scripts/build/chroot_sysfs b/scripts/build/chroot_sysfs
index 7882a13d5..2742aacc4 100755
--- a/scripts/build/chroot_sysfs
+++ b/scripts/build/chroot_sysfs
@@ -31,11 +31,8 @@ case "${1}" in
# Checking stage file
Check_stagefile .build/chroot_sysfs
- # Checking lock file
- Check_lockfile .lock
-
- # Creating lock file
- Create_lockfile .lock
+ # Aquire lock file
+ Acquire_lockfile
# Create mountpoint
mkdir -p chroot/sys
@@ -50,11 +47,8 @@ case "${1}" in
remove)
Echo_message "Begin unmounting /sys..."
- # Checking lock file
- Check_lockfile .lock
-
- # Creating lock file
- Create_lockfile .lock
+ # Aquire lock file
+ Acquire_lockfile
# Unmounting /sys
if [ -e chroot/sys/class ]
diff --git a/scripts/build/chroot_sysv-rc b/scripts/build/chroot_sysv-rc
index 5ac968e20..574d9c7c9 100755
--- a/scripts/build/chroot_sysv-rc
+++ b/scripts/build/chroot_sysv-rc
@@ -31,11 +31,8 @@ case "${1}" in
# Checking stage file
Check_stagefile .build/chroot_sysv-rc
- # Checking lock file
- Check_lockfile .lock
-
- # Creating lock file
- Create_lockfile .lock
+ # Aquire lock file
+ Acquire_lockfile
if [ -e chroot/usr/sbin/policy-rc.d ]
then
@@ -59,11 +56,8 @@ EOF
remove)
Echo_message "Deconfiguring file /usr/sbin/policy-rc.d"
- # Checking lock file
- Check_lockfile .lock
-
- # Creating lock file
- Create_lockfile .lock
+ # Aquire lock file
+ Acquire_lockfile
# Remove custom policy-rc.d file
rm -f chroot/usr/sbin/policy-rc.d
diff --git a/scripts/build/chroot_tmpfs b/scripts/build/chroot_tmpfs
index fb6262b6e..f21a8aca0 100755
--- a/scripts/build/chroot_tmpfs
+++ b/scripts/build/chroot_tmpfs
@@ -36,11 +36,8 @@ case "${1}" in
# Checking stage file
Check_stagefile .build/chroot_tmpfs
- # Checking lock file
- Check_lockfile .lock
-
- # Creating lock file
- Create_lockfile .lock
+ # Aquire lock file
+ Acquire_lockfile
mv chroot/var/lib/dpkg chroot/var/lib/dpkg.tmp
mkdir chroot/var/lib/dpkg
@@ -55,11 +52,8 @@ case "${1}" in
remove)
Echo_message "Deconfiguring tmpfs for /var/lib/dpkg"
- # Checking lock file
- Check_lockfile .lock
-
- # Creating lock file
- Create_lockfile .lock
+ # Aquire lock file
+ Acquire_lockfile
mkdir -p chroot/var/lib/dpkg.tmp
mv chroot/var/lib/dpkg/* chroot/var/lib/dpkg.tmp
diff --git a/scripts/build/clean b/scripts/build/clean
index dbbe50386..c1cf3bba7 100755
--- a/scripts/build/clean
+++ b/scripts/build/clean
@@ -37,7 +37,7 @@ then
exit 1
fi
-rm -f .lock
+Remove_lockfile
if [ -z "${1}" ]
then
diff --git a/scripts/build/installer_debian-installer b/scripts/build/installer_debian-installer
index f4fb4e70e..3eb16d56f 100755
--- a/scripts/build/installer_debian-installer
+++ b/scripts/build/installer_debian-installer
@@ -54,11 +54,8 @@ Require_stagefile .build/config .build/bootstrap
# Checking stage file
Check_stagefile .build/installer_debian-installer
-# Checking lock file
-Check_lockfile .lock
-
-# Creating lock file
-Create_lockfile .lock
+# Aquire lock file
+Acquire_lockfile
# Checking depends
Check_package host /usr/bin/wget wget
diff --git a/scripts/build/installer_preseed b/scripts/build/installer_preseed
index 6bef6c46b..14b40775e 100755
--- a/scripts/build/installer_preseed
+++ b/scripts/build/installer_preseed
@@ -33,11 +33,8 @@ Echo_message "Begin including local preseeds..."
# Checking stage file
Check_stagefile .build/installer_preseed
-# Checking lock file
-Check_lockfile .lock
-
-# Creating lock file
-Create_lockfile .lock
+# Aquire lock file
+Acquire_lockfile
if ls config/preseed/*.cfg > /dev/null 2>&1 || \
ls config/preseed/*.cfg.installer > /dev/null 2>&1 || \
diff --git a/scripts/build/source_checksums b/scripts/build/source_checksums
index 983f54569..ed9628eeb 100755
--- a/scripts/build/source_checksums
+++ b/scripts/build/source_checksums
@@ -32,11 +32,8 @@ Require_stagefile .build/config .build/source_debian
# Checking stage file
Check_stagefile .build/source_checksums
-# Checking lock file
-Check_lockfile .lock
-
-# Creating lock file
-Create_lockfile .lock
+# Aquire lock file
+Acquire_lockfile
for DIRECTORY in source/debian source/live
do
diff --git a/scripts/build/source_debian b/scripts/build/source_debian
index efd65036d..0ac71137b 100755
--- a/scripts/build/source_debian
+++ b/scripts/build/source_debian
@@ -34,11 +34,8 @@ Require_stagefile .build/config .build/bootstrap
# Checking stage file
Check_stagefile .build/source_debian
-# Checking lock file
-Check_lockfile .lock
-
-# Creating lock file
-Create_lockfile .lock
+# Aquire lock file
+Acquire_lockfile
# Remove old sources
if [ -d source/debian ]
diff --git a/scripts/build/source_disk b/scripts/build/source_disk
index 2e7fa4242..e4485f7fe 100755
--- a/scripts/build/source_disk
+++ b/scripts/build/source_disk
@@ -38,11 +38,8 @@ Require_stagefile .build/config .build/bootstrap
# Checking stage file
Check_stagefile .build/source_disk
-# Checking lock file
-Check_lockfile .lock
-
-# Creating lock file
-Create_lockfile .lock
+# Aquire lock file
+Acquire_lockfile
mkdir -p source/.disk
diff --git a/scripts/build/source_hdd b/scripts/build/source_hdd
index 123e758fa..e913ab891 100755
--- a/scripts/build/source_hdd
+++ b/scripts/build/source_hdd
@@ -39,11 +39,8 @@ Require_stagefile .build/config .build/source_debian
# Checking stage file
Check_stagefile .build/source_hdd
-# Checking lock file
-Check_lockfile .lock
-
-# Creating lock file
-Create_lockfile .lock
+# Aquire lock file
+Acquire_lockfile
# Checking depends
Check_package chroot /sbin/mkdosfs dosfstools
diff --git a/scripts/build/source_hooks b/scripts/build/source_hooks
index fa85e05d5..0f5755314 100755
--- a/scripts/build/source_hooks
+++ b/scripts/build/source_hooks
@@ -29,11 +29,8 @@ Require_stagefile .build/config .build/bootstrap
# Checking stage file
Check_stagefile .build/source_hooks
-# Checking lock file
-Check_lockfile .lock
-
-# Creating lock file
-Create_lockfile .lock
+# Aquire lock file
+Acquire_lockfile
## Processing distribution hooks
diff --git a/scripts/build/source_iso b/scripts/build/source_iso
index 6716ffba5..cdcb7a7ea 100755
--- a/scripts/build/source_iso
+++ b/scripts/build/source_iso
@@ -43,11 +43,8 @@ Require_stagefile .build/config .build/source_debian
# Checking stage file
Check_stagefile .build/source_iso
-# Checking lock file
-Check_lockfile .lock
-
-# Creating lock file
-Create_lockfile .lock
+# Aquire lock file
+Acquire_lockfile
# Checking depends
Check_package chroot /usr/bin/xorriso xorriso
diff --git a/scripts/build/source_live b/scripts/build/source_live
index 28f6bd2e4..89da67cb2 100755
--- a/scripts/build/source_live
+++ b/scripts/build/source_live
@@ -34,11 +34,8 @@ Require_stagefile .build/config .build/bootstrap
# Checking stage file
Check_stagefile .build/source_live
-# Checking lock file
-Check_lockfile .lock
-
-# Creating lock file
-Create_lockfile .lock
+# Aquire lock file
+Acquire_lockfile
# Remove old sources
if [ -d source/live ]
diff --git a/scripts/build/source_tar b/scripts/build/source_tar
index d5107b362..38a42db51 100755
--- a/scripts/build/source_tar
+++ b/scripts/build/source_tar
@@ -40,11 +40,8 @@ Require_stagefile .build/config .build/source_debian
# Checking stage file
Check_stagefile .build/source_tar
-# Checking lock file
-Check_lockfile .lock
-
-# Creating lock file
-Create_lockfile .lock
+# Aquire lock file
+Acquire_lockfile
# Remove old source
rm -f ${LIVE_IMAGE_NAME}-source.debian.tar.bz2 ${LIVE_IMAGE_NAME}-source.debian.tar.gz ${LIVE_IMAGE_NAME}-source.debian.tar.lz ${LIVE_IMAGE_NAME}-source.debian.tar