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.
This commit is contained in:
Luke Shumaker 2017-05-05 18:41:07 -04:00 committed by Jan Alexander Steffens (heftig)
parent 430e1265fb
commit 3f72579b28
No known key found for this signature in database
GPG Key ID: A5E9288C4FA415FA
10 changed files with 23 additions and 24 deletions

View File

@ -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
}

View File

@ -15,7 +15,7 @@ _devtools_compgen() {
_archco_pkg() {
_devtools_compgen "$(
\pacman -$1
command pacman "-$1"
)"
}

View File

@ -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##*://*/}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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
;;
*)

View File

@ -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") ;;

View File

@ -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.'

View File

@ -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
}