index : builder | |
Archlinux32 build system | gitolite user |
summaryrefslogtreecommitdiff |
author | Erich Eckner <git@eckner.net> | 2017-05-17 14:44:48 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2017-05-17 14:45:15 +0200 |
commit | b5e64080699536e7802e1b3dd105032386573f63 (patch) | |
tree | e46848bcc5fac023c0a0f02809038900d6a121e7 /bin/return-assignment | |
parent | a689951e9d6ace2e1d617cdd8ab337a60fe56c74 (diff) |
-rwxr-xr-x | bin/return-assignment | 25 |
diff --git a/bin/return-assignment b/bin/return-assignment index 3468f49..b8d1bb4 100755 --- a/bin/return-assignment +++ b/bin/return-assignment @@ -9,16 +9,31 @@ # exit codes: # 0: ok -# 1: outdated package -# 2: signature error +# 1: another instance was already running +# 2: outdated package +# 3: signature error # TODO: -# use lock file(s) +# use lock file for build list # remove old version(s) of newly compiled packages # check that received archive contains the expected packages . "${0%/*}/../conf/default.conf" +# Create a lock file and a trap. + +exec 9> "${lock_file}" +if ! flock -n 9; then + >&2 echo 'come back (shortly) later - I was running already' + exit 1 +fi + +function clean_up { + rm -f "${lock_file}" +} + +trap clean_up EXIT + if [ "$5" == 'ERROR' ]; then # the build failed on the build slave @@ -51,7 +66,7 @@ fi if ! grep -q "^${1//./\\.} $2 $3 $4\$" "${work_dir}/build-list"; then >&2 echo 'Sorry, the sent package is outdated.' - exit 1 + exit 2 fi function clean_up { @@ -78,7 +93,7 @@ signature_errors="$( if [ -n "${signature_errors}" ]; then >&2 echo 'The following packages lack a signature or vice versa:' >&2 echo "${signature_errors}" - exit 2 + exit 3 fi # move packages |