From c50753477af4b1e963a25fa328762a54ff06ab36 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 5 Jun 2013 19:31:16 -0600 Subject: aur: cleanup quoting, etc. --- src/aur | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/aur b/src/aur index e951e0e..e468da1 100755 --- a/src/aur +++ b/src/aur @@ -21,7 +21,6 @@ . libremessages cmd=${0##*/} - usage() { echo "Usage: $cmd [-h] pkgname-from-aur1 [pkgname-from-aur2 ...]" echo @@ -35,8 +34,8 @@ usage() { main() { while getopts 'h' arg; do case $arg in - h) usage; exit 0;; - *) usage; exit 1;; + h) usage; return 0;; + *) usage >&2; return 1;; esac done if [[ $# -lt 1 ]]; then @@ -67,16 +66,14 @@ main() { msg "Downloading $_pkg..." local url=https://aur.archlinux.org/packages/${_pkg:0:2}/${_pkg}/$_pkg.tar.gz - wget -O - -q "$url" | tar xzf - >/dev/null 2>&1 - - if [[ $? -ne 0 ]]; then + if ! wget -O - -q "$url" | tar xzf - >&2; then error "Couldn't get $_pkg" continue fi pushd $_pkg &>/dev/null - if [[ ! -z "$_diff" ]]; then + if [[ ! -z $_diff ]]; then msg2 "Diffing files" # Diff all files with our difftool for file in *; do @@ -84,7 +81,7 @@ main() { done # Go back to our copy to continue working - pushd ${_diff} &>/dev/null + pushd "${_diff}" &>/dev/null fi . PKGBUILD @@ -101,8 +98,8 @@ main() { msg2 "Checking license..." local free=0 - for _license in ${license[@]}; do - if [[ ! -d /usr/share/licenses/common/$_license ]]; then + for _license in "${license[@]}"; do + if [[ ! -d "/usr/share/licenses/common/$_license" ]]; then warning "License $_license is not a common license" free=1 fi @@ -129,12 +126,10 @@ main() { popd &>/dev/null done - [[ ${#missing_deps[*]} -gt 0 ]] && { - msg2 "Retrieving missing deps: ${missing_deps[@]}" - $0 ${missing_deps[@]} - } - - exit 0 + if [[ ${#missing_deps[*]} -gt 0 ]]; then + msg2 "Retrieving missing deps: %s" "${missing_deps[*]}" + "$0" "${missing_deps[@]}" + fi } main "$@" -- cgit v1.2.2