From aef1401ad4bf3c4c5f5020c548b39802809f6261 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Mon, 22 May 2017 12:49:08 -0400 Subject: always preserve exit statuses on return --- archweb.inc.sh | 2 +- package.inc.sh | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/archweb.inc.sh b/archweb.inc.sh index b660c29..15f0442 100644 --- a/archweb.inc.sh +++ b/archweb.inc.sh @@ -3,7 +3,7 @@ archweb_get_pkgbase() { pkgbase=$(curl -s "https://www.archlinux.org/packages/search/json/?q=$1" | jq -r --arg pkgname "$1" 'limit(1; .results[] | select(.pkgname == $pkgname).pkgbase)') - [[ $pkgbase ]] || return 1 + [[ $pkgbase ]] || return printf '%s\n' "$pkgbase" } diff --git a/package.inc.sh b/package.inc.sh index 94949bd..961e39b 100644 --- a/package.inc.sh +++ b/package.inc.sh @@ -26,7 +26,7 @@ package_init() { pkgname=$1 - package_resolve "$pkgname" "$2" || return 1 + package_resolve "$pkgname" "$2" || return (( do_update )) || return 0 @@ -130,7 +130,7 @@ package_export() { IFS=/ read -r repo pkgname <<<"$pkgname" fi - package_init "$pkgname" remote || return 1 + package_init "$pkgname" remote || return if [[ $repo ]]; then subtree=repos/$repo-$OPT_ARCH @@ -150,7 +150,7 @@ package_export() { if (( ! OPT_FORCE )); then # shellcheck disable=SC2154 - mkdir "$startdir/$pkgname" || return 1 + mkdir "$startdir/$pkgname" || return fi log_info 'exporting %s:%s' "$pkgname" "$subtree" @@ -162,13 +162,13 @@ package_checkout() { local remote pkgname=$1 - package_init "$pkgname" remote || return 1 + package_init "$pkgname" remote || return git show-ref -q "refs/heads/$remote/packages/$pkgname" || git branch -qf --no-track {,}"$remote/packages/$pkgname" quiet_git clone "$ASPROOT" --single-branch --branch "$remote/packages/$pkgname" \ - "$startdir/$pkgname" || return 1 + "$startdir/$pkgname" || return git --git-dir="$startdir/$pkgname/.git" config pull.rebase true } @@ -188,7 +188,7 @@ package_get_arches() { declare -A arches pkgname=$1 - package_init "$pkgname" remote || return 1 + package_init "$pkgname" remote || return while read -r _ arch; do arches["$arch"]=1 @@ -202,7 +202,7 @@ package_get_repos() { declare -A repos pkgname=$1 - package_init "$pkgname" remote || return 1 + package_init "$pkgname" remote || return while read -r repo _; do repos["$repo"]=1 -- cgit v1.2.3-54-g00ecf