Skip to content

Commit

Permalink
freebsd-pkg: exit with non-zero when FATAL error happens
Browse files Browse the repository at this point in the history
  • Loading branch information
taoky committed May 30, 2024
1 parent d34eb24 commit d2742f4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions freebsd-pkg/sync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ export PARALLEL_SHELL=/bin/bash
# for curl-helper
export by_hash=$(realpath $TO/.by-hash)

EXIT_CODE=0

channel_sync() {
local baseurl=$1
local basedir=$2
Expand All @@ -38,6 +40,7 @@ channel_sync() {

if [[ $? -ne 0 ]]; then
echo "[FATAL] download meta-data failed."
EXIT_CODE=$((EXIT_CODE + 1))
return 1
fi

Expand All @@ -48,6 +51,7 @@ channel_sync() {
tar -C $tmpdir -xJf $tmpdir/packagesite.txz packagesite.yaml
if [[ $? -ne 0 ]]; then
echo '[FATAL] unzip packagesite.txz failed.'
EXIT_CODE=$((EXIT_CODE + 1))
return 1
fi
jq -r '"\(.sum) \(.repopath)"' $tmpdir/packagesite.yaml | sort -k2 > $meta
Expand Down Expand Up @@ -88,3 +92,5 @@ find $TO -type d -print0 | xargs -0 chmod 755
rm $FBSD_PLATFORMS

clean_hash_file

exit $EXIT_CODE

0 comments on commit d2742f4

Please sign in to comment.