summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2013-06-05 19:31:16 -0600
committerLuke Shumaker <LukeShu@sbcglobal.net>2013-06-05 19:40:10 -0600
commitc50753477af4b1e963a25fa328762a54ff06ab36 (patch)
tree7e18b82d97a33ae105a824406155262d65b84e45
parentb80db9fe6e1b435c294885394c9d4eb804fd6750 (diff)
aur: cleanup quoting, etc.
-rwxr-xr-xsrc/aur27
1 files changed, 11 insertions, 16 deletions
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 "$@"