diff options
Diffstat (limited to 'src/abslibre-tools/librerelease')
-rwxr-xr-x | src/abslibre-tools/librerelease | 56 |
1 files changed, 29 insertions, 27 deletions
diff --git a/src/abslibre-tools/librerelease b/src/abslibre-tools/librerelease index b441a4c..d72d88b 100755 --- a/src/abslibre-tools/librerelease +++ b/src/abslibre-tools/librerelease @@ -74,8 +74,7 @@ create_signature() { gpg --detach-sign --use-agent "${SIGNWITHKEY[@]}" --no-armor "$filename" &>/dev/null || ret=$EXIT_FAILURE - - if (( ! ret )); then + if ((!ret)); then msg2 "Created signature file %s." "$filename.sig" else error "Failed to sign package file." @@ -109,7 +108,7 @@ clean_files() ( local file_list=$1 local rmcmd=(rm -fv) - if [[ -n "${dryrun}" ]]; then + if [[ -n ${dryrun} ]]; then rmcmd=(printf "$(_ "removed '%s' (dry-run)")\n") fi @@ -117,7 +116,7 @@ clean_files() ( cd "${WORKDIR}/staging" xargs -0r -a "$file_list" "${rmcmd[@]}" find . -depth -mindepth 1 -type d \ - -exec rmdir --ignore-fail-on-non-empty -- '{}' + + -exec rmdir --ignore-fail-on-non-empty -- '{}' + ) ################################################################################ @@ -127,12 +126,12 @@ usage() { print 'Upload packages in $WORKDIR/staging to the Parabola server' echo print "Options:" - flag '-c' 'Clean; delete packages in $WORKDIR/staging' - flag '-l' "List; list packages but not upload them" - flag '-u' "Upload-only; do not run db-update on the server" + flag '-c' 'Clean; delete packages in $WORKDIR/staging' + flag '-l' "List; list packages but not upload them" + flag '-u' "Upload-only; do not run db-update on the server" - flag '-n' "Dry-run; don't actually do anything" - flag '-h' "Show this message" + flag '-n' "Dry-run; don't actually do anything" + flag '-h' "Show this message" } main() { @@ -150,7 +149,10 @@ main() { u) upload_only=true ;; n) dryrun="--dry-run" ;; h) mode=usage ;; - *) usage >&2; return $EXIT_INVALIDARGUMENT ;; + *) + usage >&2 + return $EXIT_INVALIDARGUMENT + ;; esac done shift $((OPTIND - 1)) @@ -167,12 +169,12 @@ main() { declare -i ret=0 load_conf makepkg.conf GPGKEY || ret=$? load_conf libretools.conf WORKDIR REPODEST DBSCRIPTS_CONFIG || ret=$? # and HOOK{PRE,POST}RELEASE, which are optional - [[ $ret = 0 ]] || exit $ret + [[ $ret == 0 ]] || exit $ret local re_url='^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$' local re_authority='^(([^@]*)@)?([^][@:]*|\[[^]]*\])(:([0-9]*))?$' local REPODEST_ok=false - if [[ "$REPODEST" =~ $re_url ]]; then + if [[ $REPODEST =~ $re_url ]]; then REPODEST_ok=true REPODEST_scheme=${BASH_REMATCH[2]} @@ -181,12 +183,12 @@ main() { REPODEST_query=${BASH_REMATCH[7]} REPODEST_fragment=${BASH_REMATCH[9]} - if [[ "$REPODEST_authority" =~ $re_authority ]]; then + if [[ $REPODEST_authority =~ $re_authority ]]; then REPODEST_userinfo=${BASH_REMATCH[2]} REPODEST_host=${BASH_REMATCH[3]} REPODEST_port=${BASH_REMATCH[5]} - if [[ "$REPODEST_host" = '['*']' ]]; then + if [[ $REPODEST_host == '['*']' ]]; then REPODEST_host=${REPODEST_HOST#'['} REPODEST_host=${REPODEST_HOST#']'} fi @@ -203,8 +205,8 @@ main() { plain 'Merge the /etc/libretools.conf.pacnew file!' return $EXIT_NOTCONFIGURED fi - if [[ "$REPODEST_path" = '/~'* ]]; then - if [[ "$REPODEST_path" = '/~/'* ]]; then + if [[ $REPODEST_path == '/~'* ]]; then + if [[ $REPODEST_path == '/~/'* ]]; then REPODEST_path=${REPODEST_path#'/~/'} else error 'Unfortunately, `~user` home-directory expansion is not (yet?) supported in libretools.conf:REPODEST' @@ -220,11 +222,11 @@ main() { pretty_print_packages() { find "$WORKDIR/staging/" -mindepth 1 -maxdepth 1 -type d -not -empty | sort | - while read -r path; do - msg2 "${path##*/}" - cd "$path" - find -L . -type f -not -name '*.lock' | sed 's|^\./| |' | sort - done + while read -r path; do + msg2 "${path##*/}" + cd "$path" + find -L . -type f -not -name '*.lock' | sed 's|^\./| |' | sort + done } clean() { @@ -234,7 +236,7 @@ clean() { local file_list file_list="$(mktemp -t "${0##*/}.XXXXXXXXXX")" trap "rm -f -- ${file_list@Q}" EXIT - list0_files > "$file_list" + list0_files >"$file_list" lock_close 8 @@ -263,7 +265,7 @@ release_packages() { local file_list="$(mktemp -t ${0##*/}.XXXXXXXXXX)" trap "rm -f -- ${file_list@Q}" EXIT - list0_files > "$file_list" + list0_files >"$file_list" lock_close 8 @@ -274,8 +276,7 @@ release_packages() { -e "ssh ${REPODEST_port:+-p $REPODEST_port}" \ -0 --files-from="$file_list" \ "${WORKDIR}/staging" \ - "$REPODEST_userhost:$REPODEST_path/" - then + "$REPODEST_userhost:$REPODEST_path/"; then error "Sync failed, try again" return $EXIT_FAILURE fi @@ -299,9 +300,10 @@ release_packages() { # notify pbot of the excellent work we have done local packages=${file_list} # TODO: parse package names? - this is gonna be messy - local login=${REPODEST_userinfo:-somebody} ; login=${login%%:*} ; + local login=${REPODEST_userinfo:-somebody} + login=${login%%:*} ssh ${REPODEST_port:+-p "$REPODEST_port"} "${REPODEST_userhost}" \ - "if type pbot-say &>/dev/null; then pbot-say ${login} just published: ${packages}; fi" + "if type pbot-say &>/dev/null; then pbot-say ${login} just published: ${packages}; fi" return $EXIT_SUCCESS } |