summaryrefslogtreecommitdiff
path: root/db-update
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 /db-update
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 'db-update')
-rwxr-xr-xdb-update40
1 files changed, 20 insertions, 20 deletions
diff --git a/db-update b/db-update
index db8cb91..0544e7c 100755
--- a/db-update
+++ b/db-update
@@ -1,7 +1,7 @@
#!/bin/bash
-. "$(dirname $0)/config"
-. "$(dirname $0)/db-functions"
+. "$(dirname "$0")/config"
+. "$(dirname "$0")/db-functions"
if [ $# -ge 1 ]; then
warning "Calling ${0##*/} with a specific repository is no longer supported"
@@ -15,34 +15,34 @@ if [ $? -ge 1 ]; then
fi
repos=()
-for staging_repo in ${staging_repos[@]##*/}; do
- if in_array ${staging_repo} ${PKGREPOS[@]}; then
- repos+=(${staging_repo})
+for staging_repo in "${staging_repos[@]##*/}"; do
+ if in_array "${staging_repo}" "${PKGREPOS[@]}"; then
+ repos+=("${staging_repo}")
fi
done
# TODO: this might lock too much (architectures)
-for repo in ${repos[@]}; do
- for pkgarch in ${ARCHES[@]}; do
- repo_lock ${repo} ${pkgarch} || exit 1
+for repo in "${repos[@]}"; do
+ for pkgarch in "${ARCHES[@]}"; do
+ repo_lock "${repo}" "${pkgarch}" || exit 1
done
done
# check if packages are valid
-for repo in ${repos[@]}; do
+for repo in "${repos[@]}"; do
if ! check_repo_permission "${repo}"; then
die "You don't have permission to update packages in ${repo}"
fi
pkgs=($(getpkgfiles "${STAGING}/${repo}/"*${PKGEXT}))
if [ $? -eq 0 ]; then
- for pkg in ${pkgs[@]}; do
+ for pkg in "${pkgs[@]}"; do
if [ -h "${pkg}" ]; then
die "Package ${repo}/${pkg##*/} is a symbolic link"
fi
if ! check_pkgfile "${pkg}"; then
die "Package ${repo}/${pkg##*/} is not consistent with its meta data"
fi
- if ${REQUIRE_SIGNATURE} && ! pacman-key -v "${pkg}.sig" >/dev/null 2>&1; then
+ if "${REQUIRE_SIGNATURE}" && ! pacman-key -v "${pkg}.sig" >/dev/null 2>&1; then
die "Package ${repo}/${pkg##*/} does not have a valid signature"
fi
if ! check_pkgsvn "${pkg}" "${repo}"; then
@@ -61,7 +61,7 @@ for repo in ${repos[@]}; do
die "Package ${repo}/${pkg##*/} was not built in a chroot"
fi
done
- if ! check_splitpkgs ${repo} ${pkgs[@]}; then
+ if ! check_splitpkgs "${repo}" "${pkgs[@]}"; then
die "Missing split packages for ${repo}"
fi
else
@@ -69,13 +69,13 @@ for repo in ${repos[@]}; do
fi
done
-for repo in ${repos[@]}; do
+for repo in "${repos[@]}"; do
msg "Updating [${repo}]..."
any_pkgs=($(getpkgfiles "${STAGING}/${repo}/"*-any${PKGEXT} 2>/dev/null))
- for pkgarch in ${ARCHES[@]}; do
+ for pkgarch in "${ARCHES[@]}"; do
add_pkgs=()
- arch_pkgs=($(getpkgfiles "${STAGING}/${repo}/"*-${pkgarch}${PKGEXT} 2>/dev/null))
- for pkg in ${arch_pkgs[@]} ${any_pkgs[@]}; do
+ arch_pkgs=($(getpkgfiles "${STAGING}/${repo}/"*-"${pkgarch}"${PKGEXT} 2>/dev/null))
+ for pkg in "${arch_pkgs[@]}" "${any_pkgs[@]}"; do
pkgfile="${pkg##*/}"
msg2 "${pkgfile} (${pkgarch})"
# any packages might have been moved by the previous run
@@ -93,13 +93,13 @@ for repo in ${repos[@]}; do
add_pkgs[${#add_pkgs[*]}]=${pkgfile}
done
if [ ${#add_pkgs[@]} -ge 1 ]; then
- arch_repo_add "${repo}" "${pkgarch}" ${add_pkgs[@]}
+ arch_repo_add "${repo}" "${pkgarch}" "${add_pkgs[@]}"
fi
done
done
-for repo in ${repos[@]}; do
- for pkgarch in ${ARCHES[@]}; do
- repo_unlock ${repo} ${pkgarch}
+for repo in "${repos[@]}"; do
+ for pkgarch in "${ARCHES[@]}"; do
+ repo_unlock "${repo}" "${pkgarch}"
done
done