summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-03-21 10:17:00 +0100
committerErich Eckner <git@eckner.net>2018-03-21 10:17:00 +0100
commitec84ed09ff3683eb002765f06d585fb08d9a4671 (patch)
tree32c90fd11465a3eb0c3f7037ba6e427c3e671fb8 /bin
parent3c1f6750e8f906d8230266f904d69ce76d8909b9 (diff)
downloadbuilder-ec84ed09ff3683eb002765f06d585fb08d9a4671.tar.xz
bin/modify-package-state: --wait new
Diffstat (limited to 'bin')
-rwxr-xr-xbin/modify-package-state12
1 files changed, 9 insertions, 3 deletions
diff --git a/bin/modify-package-state b/bin/modify-package-state
index 36fee85..76b8c1e 100755
--- a/bin/modify-package-state
+++ b/bin/modify-package-state
@@ -18,25 +18,28 @@ usage() {
>&2 echo ' -n|--no-report: Do not report what packages were modified.'
>&2 echo ' -t|--tested: Mark package(s) as tested.'
>&2 echo ' -u|--unblock: Unblock package(s).'
+ >&2 echo ' -w|--wait: Wait for lock if necessary.'
>&2 echo ''
>&2 echo 'Exactly one of -b|-t|-u is needed for actual operation.'
[ -z "$1" ] && exit 1 || exit "$1"
}
eval set -- "$(
- getopt -o bfhntu \
+ getopt -o bfhntuw \
--long block \
--long faulty \
--long help \
--long no-report \
--long tested \
--long unblock \
+ --long wait \
-n "$(basename "$0")" -- "$@" || \
echo usage
)"
action=''
report=true
+wait_for_lock='-n'
while true
do
@@ -75,6 +78,9 @@ do
fi
action='unblock'
;;
+ -w|--wait)
+ wait_for_lock=''
+ ;;
--)
shift
break
@@ -123,13 +129,13 @@ if ! [ -r "${input_file}" ]; then
fi
exec 9> "${sanity_check_lock_file}"
-if ! flock -s -n 9; then
+if ! flock -s ${wait_for_lock} 9; then
>&2 echo 'Cannot get sanity-check lock.'
exit
fi
exec 8> "${package_database_lock_file}"
-if ! flock -n 8; then
+if ! flock ${wait_for_lock} 8; then
>&2 echo 'Cannot get package-database lock.'
exit
fi