diff --git a/roles/git_auto_update/templates/update.sh b/roles/git_auto_update/templates/update.sh index 9f9e7c6..5140969 100644 --- a/roles/git_auto_update/templates/update.sh +++ b/roles/git_auto_update/templates/update.sh @@ -9,6 +9,10 @@ readonly DEST_GROUP={{ group | quote }}; readonly PREFIX={{ tag_prefix | quote }}; readonly GPG_FINGERPRINT={{ gpg_fingerprint | quote }}; +function error() { + echo "$@" >&2; +} + cd "$DEST"; if [ ! -d .git ]; then @@ -26,10 +30,10 @@ if [ -z "$GPG_FINGERPRINT" ] || (git verify-tag --raw "$TAG" 2>&1 | grep --fixed git checkout --quiet --recurse-submodules "$TAG"; chown --recursive "$DEST_USER:$DEST_GROUP" .; if ! sh -c {{ reload_command | default('true') | quote }}; then - echo "Reload command failed" >&2; + error "Reload command failed"; exit 2; fi else - echo "Invalid or missing signature for $TAG" >&2; + error "Invalid or missing signature for $TAG"; exit 1; fi