summaryrefslogtreecommitdiff
path: root/cron-jobs/update-web-db
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 /cron-jobs/update-web-db
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 'cron-jobs/update-web-db')
-rwxr-xr-xcron-jobs/update-web-db20
1 files changed, 10 insertions, 10 deletions
diff --git a/cron-jobs/update-web-db b/cron-jobs/update-web-db
index 195d1fc..1a725dc 100755
--- a/cron-jobs/update-web-db
+++ b/cron-jobs/update-web-db
@@ -1,7 +1,7 @@
#!/bin/bash
-. "$(dirname $0)/../config"
-. "$(dirname $0)/../db-functions"
+. "$(dirname "$0")/../config"
+. "$(dirname "$0")/../db-functions"
# setup paths
SPATH="/srv/http/archweb"
@@ -43,26 +43,26 @@ case "$cmd" in
esac
# Lock the repos and get a copy of the db files to work on
-for repo in ${REPOS[@]}; do
- for arch in ${ARCHES[@]}; do
- repo_lock ${repo} ${arch} || exit 1
+for repo in "${REPOS[@]}"; do
+ for arch in "${ARCHES[@]}"; do
+ repo_lock "${repo}" "${arch}" || exit 1
dbfile="/srv/ftp/${repo}/os/${arch}/${repo}${dbfileext}"
if [ -f "${dbfile}" ]; then
mkdir -p "${WORKDIR}/${repo}/${arch}"
cp "${dbfile}" "${WORKDIR}/${repo}/${arch}/${repo}${dbfileext}"
fi
- repo_unlock ${repo} ${arch}
+ repo_unlock "${repo}" "${arch}"
done
done
# Run reporead on our db copy
-pushd $SPATH >/dev/null
-for repo in ${REPOS[@]}; do
- for arch in ${ARCHES[@]}; do
+pushd "$SPATH" >/dev/null
+for repo in "${REPOS[@]}"; do
+ for arch in "${ARCHES[@]}"; do
dbcopy="${WORKDIR}/${repo}/${arch}/${repo}${dbfileext}"
if [ -f "${dbcopy}" ]; then
echo "Updating ${repo}-${arch}" >> "${LOGOUT}"
- ./manage.py reporead ${flags} ${arch} "${dbcopy}" >> "${LOGOUT}" 2>&1
+ ./manage.py reporead "${flags}" "${arch}" "${dbcopy}" >> "${LOGOUT}" 2>&1
echo "" >> "${LOGOUT}"
fi
done