summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@parabola.nu>2017-03-28 18:48:29 -0400
committerLuke Shumaker <lukeshu@parabola.nu>2017-05-04 21:09:14 -0400
commit168341e04931b1203740870e57966ce0f1d19e0d (patch)
treeedee1932dc765b04962ce5d087312f4dfb0bd116
parent368a6d2a37a8eb88da4a5a393b1f685c240835d5 (diff)
Make purely stylistic changes to make shellcheck happier.
These are purely stylistic changes that make shellcheck complain less. This does NOT include things like quoting currently unquoted variables.
-rw-r--r--arch-nspawn.in8
-rw-r--r--bash_completion.in2
-rw-r--r--checkpkg.in7
-rw-r--r--commitpkg.in2
-rw-r--r--find-libdeps.in2
-rw-r--r--finddeps.in2
-rw-r--r--lib/common.sh4
-rw-r--r--makechrootpkg.in16
-rw-r--r--mkarchroot.in2
-rw-r--r--rebuildpkgs.in2
10 files changed, 23 insertions, 24 deletions
diff --git a/arch-nspawn.in b/arch-nspawn.in
index 08ed2fa..548ebec 100644
--- a/arch-nspawn.in
+++ b/arch-nspawn.in
@@ -42,7 +42,7 @@ while getopts 'hC:M:c:f:s' arg; do
*) error "invalid argument '%s'" "$arg"; usage ;;
esac
done
-shift $(($OPTIND - 1))
+shift $((OPTIND - 1))
(( $# < 1 )) && die 'You must specify a directory.'
check_root
@@ -66,13 +66,13 @@ build_mount_args() {
declare -g mount_args=()
if [[ -n $host_mirror_path ]]; then
- mount_args+=(--bind-ro="$host_mirror_path")
+ mount_args+=("--bind-ro=$host_mirror_path")
fi
- mount_args+=(--bind="${cache_dirs[0]}")
+ mount_args+=("--bind=${cache_dirs[0]}")
for cache_dir in ${cache_dirs[@]:1}; do
- mount_args+=(--bind-ro="$cache_dir")
+ mount_args+=("--bind-ro=$cache_dir")
done
}
diff --git a/bash_completion.in b/bash_completion.in
index f5a3077..f0a6bd0 100644
--- a/bash_completion.in
+++ b/bash_completion.in
@@ -15,7 +15,7 @@ _devtools_compgen() {
_archco_pkg() {
_devtools_compgen "$(
- \pacman -$1
+ command pacman "-$1"
)"
}
diff --git a/checkpkg.in b/checkpkg.in
index ec58ff6..03e29f7 100644
--- a/checkpkg.in
+++ b/checkpkg.in
@@ -24,7 +24,7 @@ if [[ ! -f PKGBUILD ]]; then
fi
. ./PKGBUILD
-if [[ $arch == 'any' ]]; then
+if [[ ${arch[0]} == 'any' ]]; then
CARCH='any'
fi
@@ -39,11 +39,8 @@ for _pkgname in "${pkgname[@]}"; do
ln -s "$pkgfile" "$TEMPDIR"
- pkgurl=$(pacman -Spdd --print-format '%l' --noconfirm "$_pkgname")
-
- if [[ $? -ne 0 ]]; then
+ pkgurl=$(pacman -Spdd --print-format '%l' --noconfirm "$_pkgname") ||
die "Couldn't download previous package for %s." "$_pkgname"
- fi
oldpkg=${pkgurl##*://*/}
diff --git a/commitpkg.in b/commitpkg.in
index 1f9492c..87f5b8b 100644
--- a/commitpkg.in
+++ b/commitpkg.in
@@ -64,7 +64,7 @@ if (( ${#needsversioning[*]} )); then
(( ${#unversioned[*]} )) && die "%s is not under version control" "${unversioned[@]}"
fi
-rsyncopts=(-e ssh -p --chmod=ug=rw,o=r -c -h -L --progress --partial -y)
+rsyncopts=(-e ssh -p '--chmod=ug=rw,o=r' -c -h -L --progress --partial -y)
archreleaseopts=()
while getopts ':l:a:s:f' flag; do
case $flag in
diff --git a/find-libdeps.in b/find-libdeps.in
index 5c350a9..c596f48 100644
--- a/find-libdeps.in
+++ b/find-libdeps.in
@@ -45,7 +45,7 @@ process_sofile() {
soname="${sofile%.so?(+(.+([0-9])))}".so
# extract the major version: 1
soversion="${sofile##*\.so\.}"
- if [[ "$soversion" = "$sofile" ]] && (($IGNORE_INTERNAL)); then
+ if [[ "$soversion" = "$sofile" ]] && ((IGNORE_INTERNAL)); then
continue
fi
if ! in_array "${soname}=${soversion}-${soarch}" ${soobjects[@]}; then
diff --git a/finddeps.in b/finddeps.in
index 89ccc41..03e5501 100644
--- a/finddeps.in
+++ b/finddeps.in
@@ -19,7 +19,7 @@ fi
find . -type d | while read d; do
if [[ -f "$d/PKGBUILD" ]]; then
- unset pkgname depends makedepends optdepends
+ pkgname=() depends=() makedepends=() optdepends=()
. "$d/PKGBUILD"
for dep in "${depends[@]}"; do
# lose the version comparator, if any
diff --git a/lib/common.sh b/lib/common.sh
index c9afc36..8f043e8 100644
--- a/lib/common.sh
+++ b/lib/common.sh
@@ -137,7 +137,7 @@ get_full_version() {
eval $(declare -f package_$1 | sed -n "s/\(^[[:space:]]*$i=\)/${i}_override=/p")
[[ -z ${!indirect} ]] && eval ${indirect}=\"${!i}\"
done
- if (( ! $epoch_override )); then
+ if (( ! epoch_override )); then
echo $pkgver_override-$pkgrel_override
else
echo $epoch_override:$pkgver_override-$pkgrel_override
@@ -247,7 +247,7 @@ find_cached_package() {
return 1
;;
1)
- printf '%s\n' "$results"
+ printf '%s\n' "${results[0]}"
return 0
;;
*)
diff --git a/makechrootpkg.in b/makechrootpkg.in
index 2a19dbb..f8e8505 100644
--- a/makechrootpkg.in
+++ b/makechrootpkg.in
@@ -190,8 +190,9 @@ prepare_chroot() {
$repack || rm -rf "$copydir/build"
- local builduser_uid="${SUDO_UID:-$UID}"
- local builduser_gid="$(id -g "$builduser_uid")"
+ local builduser_uid builduser_gid
+ builduser_uid="${SUDO_UID:-$UID}"
+ builduser_gid="$(id -g "$builduser_uid")"
local install="install -o $builduser_uid -g $builduser_gid"
local x
@@ -264,18 +265,19 @@ download_sources() {
local copydir=$1
local makepkg_user=$2
- local builddir="$(mktemp -d)"
+ local builddir
+ builddir="$(mktemp -d)"
chmod 1777 "$builddir"
# Ensure sources are downloaded
if [[ "$(id -u "$makepkg_user")" != 0 ]]; then
sudo -u "$makepkg_user" env SRCDEST="$SRCDEST" BUILDDIR="$builddir" \
- makepkg --config="$copydir/etc/makepkg.conf" --verifysource -o
+ makepkg --config="$copydir/etc/makepkg.conf" --verifysource -o ||
+ die "Could not download sources."
else
error "Running makepkg as root is not allowed."
exit 1
fi
- (( $? != 0 )) && die "Could not download sources."
# Clean up garbage from verifysource
rm -rf "$builddir"
@@ -320,8 +322,8 @@ main() {
while getopts 'hcur:I:l:nTD:d:U:' arg; do
case "$arg" in
c) clean_first=true ;;
- D) bindmounts_ro+=(--bind-ro="$OPTARG") ;;
- d) bindmounts_rw+=(--bind="$OPTARG") ;;
+ D) bindmounts_ro+=("--bind-ro=$OPTARG") ;;
+ d) bindmounts_rw+=("--bind=$OPTARG") ;;
u) update_first=true ;;
r) passeddir="$OPTARG" ;;
I) install_pkgs+=("$OPTARG") ;;
diff --git a/mkarchroot.in b/mkarchroot.in
index 3aff357..152d323 100644
--- a/mkarchroot.in
+++ b/mkarchroot.in
@@ -40,7 +40,7 @@ while getopts 'hC:M:c:f:s' arg; do
*) error "invalid argument '%s'" "$arg"; usage ;;
esac
done
-shift $(($OPTIND - 1))
+shift $((OPTIND - 1))
(( $# < 2 )) && die 'You must specify a directory and one or more packages.'
diff --git a/rebuildpkgs.in b/rebuildpkgs.in
index 9197231..be3fd33 100644
--- a/rebuildpkgs.in
+++ b/rebuildpkgs.in
@@ -42,7 +42,7 @@ bump_pkgrel() {
#remove decimals
rel=$(echo $oldrel | cut -d. -f1)
- newrel=$(($rel + 1))
+ newrel=$((rel + 1))
sed -i "s/pkgrel=$oldrel/pkgrel=$newrel/" PKGBUILD
}