Scripts: Set errexit to catch errors

This commit is contained in:
Unrud
2022-06-05 14:07:24 +02:00
committed by Matthias Mailänder
parent 7cd0d8c079
commit 946cd8f322
17 changed files with 84 additions and 41 deletions

View File

@@ -1,6 +1,8 @@
#!/bin/bash
# OpenRA packaging script for versioned source tarball
set -o errexit || exit $?
if [ $# -ne "2" ]; then
echo "Usage: $(basename "$0") tag outputdir"
exit 1
@@ -19,7 +21,7 @@ make version VERSION="${TAG}"
# The output from `git ls-tree` is too long to fit in a single command (overflows MAX_ARG_STRLEN)
# so `xargs` will automatically split the input across multiple `tar` commands.
# Use the amend flag (r) to prevent each call erasing the output from earlier calls.
rm "${OUTPUTDIR}/OpenRA-${TAG}-source.tar"
rm "${OUTPUTDIR}/OpenRA-${TAG}-source.tar" || :
git ls-tree HEAD --name-only -r -z | xargs -0 tar vrf "${OUTPUTDIR}/OpenRA-${TAG}-source.tar"
bzip2 "${OUTPUTDIR}/OpenRA-${TAG}-source.tar"