summaryrefslogtreecommitdiff
path: root/test/test.d/db-update.sh
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2014-06-18 12:07:09 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-04-16 13:49:57 -0400
commit7850874b1ef1b18de585be108e3be899d95a3a2a (patch)
tree173896aa05b68545672124dbe28b098fec98ee0a /test/test.d/db-update.sh
parent282bf65c81e278b9237b4c202d325642bc0aa1a3 (diff)
Fix quoting around variables, especially arrays.
Other than pure quoting, this involved: - swapping */@ for array access in a few places - fiddling with printf in a pipeline - replacing `$(echo ${array[@]})` with `${array[*]}` - replacing `echo $(...)` with `...` When searching for these things, I used the command: grep -Prn --exclude-dir=.git '(?<!["=]|\[\[ |\[\[ -[zn] )\$(?!{?#|\(|\? )' and ignored a bunch of false positives.
Diffstat (limited to 'test/test.d/db-update.sh')
-rwxr-xr-xtest/test.d/db-update.sh48
1 files changed, 24 insertions, 24 deletions
diff --git a/test/test.d/db-update.sh b/test/test.d/db-update.sh
index 7a5ce4c..c83d51b 100755
--- a/test/test.d/db-update.sh
+++ b/test/test.d/db-update.sh
@@ -1,6 +1,6 @@
#!/bin/bash
-curdir=$(readlink -e $(dirname $0))
+curdir=$(readlink -e "$(dirname "$0")")
. "${curdir}/../lib/common.inc"
testAddSimplePackages() {
@@ -9,17 +9,17 @@ testAddSimplePackages() {
local pkgbase
local arch
- for pkgbase in ${pkgs[@]}; do
- for arch in ${arches[@]}; do
- releasePackage extra ${pkgbase} ${arch}
+ for pkgbase in "${pkgs[@]}"; do
+ for arch in "${arches[@]}"; do
+ releasePackage extra "${pkgbase}" "${arch}"
done
done
../db-update
- for pkgbase in ${pkgs[@]}; do
- for arch in ${arches[@]}; do
- checkPackage extra ${pkgbase}-1-1-${arch}.pkg.tar.xz ${arch}
+ for pkgbase in "${pkgs[@]}"; do
+ for arch in "${arches[@]}"; do
+ checkPackage extra "${pkgbase}-1-1-${arch}.pkg.tar.xz" "${arch}"
done
done
}
@@ -40,14 +40,14 @@ testAddAnyPackages() {
local pkgs=('pkg-any-a' 'pkg-any-b')
local pkgbase
- for pkgbase in ${pkgs[@]}; do
- releasePackage extra ${pkgbase} any
+ for pkgbase in "${pkgs[@]}"; do
+ releasePackage extra "${pkgbase}" any
done
../db-update
- for pkgbase in ${pkgs[@]}; do
- checkAnyPackage extra ${pkgbase}-1-1-any.pkg.tar.xz
+ for pkgbase in "${pkgs[@]}"; do
+ checkAnyPackage extra "${pkgbase}-1-1-any.pkg.tar.xz"
done
}
@@ -58,18 +58,18 @@ testAddSplitPackages() {
local pkgbase
local arch
- for pkgbase in ${pkgs[@]}; do
- for arch in ${arches[@]}; do
- releasePackage extra ${pkgbase} ${arch}
+ for pkgbase in "${pkgs[@]}"; do
+ for arch in "${arches[@]}"; do
+ releasePackage extra "${pkgbase}" "${arch}"
done
done
../db-update
- for pkgbase in ${pkgs[@]}; do
- for arch in ${arches[@]}; do
- for pkg in "${pkgdir}/${pkgbase}"/*-${arch}${PKGEXT}; do
- checkPackage extra ${pkg##*/} ${arch}
+ for pkgbase in "${pkgs[@]}"; do
+ for arch in "${arches[@]}"; do
+ for pkg in "${pkgdir}/${pkgbase}"/*-"${arch}"${PKGEXT}; do
+ checkPackage extra "${pkg##*/}" "${arch}"
done
done
done
@@ -134,7 +134,7 @@ testUpdateSameAnyPackageToDifferentRepositories() {
local arch
for arch in i686 x86_64; do
( [ -r "${FTP_BASE}/testing/os/${arch}/testing${DBEXT%.tar.*}" ] \
- && bsdtar -xf "${FTP_BASE}/testing/os/${arch}/testing${DBEXT%.tar.*}" -O | grep -q ${pkgbase}) \
+ && bsdtar -xf "${FTP_BASE}/testing/os/${arch}/testing${DBEXT%.tar.*}" -O | grep -q "${pkgbase}") \
&& fail "${pkgbase} should not be in testing/os/${arch}/testing${DBEXT%.tar.*}"
done
}
@@ -146,18 +146,18 @@ testAddIncompleteSplitPackage() {
local pkgbase='pkg-split-a'
local arch
- for arch in ${arches[@]}; do
- releasePackage ${repo} ${pkgbase} ${arch}
+ for arch in "${arches[@]}"; do
+ releasePackage "${repo}" "${pkgbase}" "${arch}"
done
# remove a split package to make db-update fail
- rm "${STAGING}"/extra/${pkgbase}1-*
+ rm "${STAGING}/extra/${pkgbase}1-"*
../db-update >/dev/null 2>&1 && fail "db-update should fail when a split package is missing!"
- for arch in ${arches[@]}; do
+ for arch in "${arches[@]}"; do
( [ -r "${FTP_BASE}/${repo}/os/${arch}/${repo}${DBEXT%.tar.*}" ] \
- && bsdtar -xf "${FTP_BASE}/${repo}/os/${arch}/${repo}${DBEXT%.tar.*}" -O | grep -q ${pkgbase}) \
+ && bsdtar -xf "${FTP_BASE}/${repo}/os/${arch}/${repo}${DBEXT%.tar.*}" -O | grep -q "${pkgbase}") \
&& fail "${pkgbase} should not be in ${repo}/os/${arch}/${repo}${DBEXT%.tar.*}"
done
}