diff options
author | Erich Eckner <git@eckner.net> | 2018-06-25 14:26:49 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2018-06-25 14:26:49 +0200 |
commit | 3e8f769d8d4b6bceb758f7bc68240967acde2911 (patch) | |
tree | dd56b562635bcbfc441e06184aa1731bd28035ed /bin/seed-build-list | |
parent | 7d7be2ea8e78214535066497b399d408161890ac (diff) | |
download | builder-3e8f769d8d4b6bceb758f7bc68240967acde2911.tar.xz |
bin/seed-build-list: -c new: exit-code=0 for unavailable lock
Diffstat (limited to 'bin/seed-build-list')
-rwxr-xr-x | bin/seed-build-list | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/bin/seed-build-list b/bin/seed-build-list index 7905a17..31deb08 100755 --- a/bin/seed-build-list +++ b/bin/seed-build-list @@ -19,6 +19,9 @@ usage() { >&2 echo ' -a|--auto:' >&2 echo ' Automatically reschedule packages which have run-time' >&2 echo ' dependencies that are not available anywhere.' + >&2 echo ' -c|--cron-exit:' + >&2 echo ' Exit with 0 if not getting a lock - makes the script' + >&2 echo ' suitable for a crontab.' >&2 echo ' -h|--help:' >&2 echo ' Show this help and exit.' >&2 echo ' -i|--ignore $package:' @@ -39,8 +42,9 @@ tmp_dir=$(mktemp -d 'tmp.seed-build-list.XXXXXXXXXX' --tmpdir) trap "rm -rf --one-file-system '${tmp_dir:?}'" EXIT eval set -- "$( - getopt -o ahi:m:np:w \ + getopt -o achi:m:np:w \ --long auto \ + --long cron-exit \ --long help \ --long ignore: \ --long mirror: \ @@ -58,6 +62,7 @@ touch "${tmp_dir}/ignore-packages" auto=false update=true wait_for_lock='-n' +lock_error=1 if [ -r "${base_dir}/conf/seed-ignore-packages" ]; then cp "${base_dir}/conf/seed-ignore-packages" "${tmp_dir}/ignore-packages" @@ -69,6 +74,9 @@ do -a|--auto) auto=true ;; + -c|--cron-exit) + lock_error=0 + ;; -h|--help) usage 0 ;; @@ -121,13 +129,13 @@ if ${update}; then exec 9> "${sanity_check_lock_file}" if ! verbose_flock -s ${wait_for_lock} 9; then >&2 echo 'Cannot get sanity-check lock.' - exit 1 + exit ${lock_error} fi exec 8> "${build_list_lock_file}" if ! verbose_flock ${wait_for_lock} 8; then >&2 echo 'Cannot get build-list lock.' - exit 1 + exit ${lock_error} fi fi |