summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@parabola.nu>2018-03-14 16:52:05 -0400
committerEli Schwartz <eschwartz@archlinux.org>2018-03-19 23:50:20 -0400
commit36087fbd8b030fa6f908fdbb667292e3c078b615 (patch)
tree36806a5dbd44c112c1f5a3e98bc402d8a3511e5f
parent23c2b82c336bf19b7a29a90d19bca4423d8b8839 (diff)
Remove uses of the "v=true; if $v ..." anti-pattern
Instead, compare the value of $v to 'true'.
-rwxr-xr-xcron-jobs/ftpdir-cleanup6
-rwxr-xr-xcron-jobs/sourceballs6
-rw-r--r--db-functions2
-rwxr-xr-xtesting2x4
4 files changed, 9 insertions, 9 deletions
diff --git a/cron-jobs/ftpdir-cleanup b/cron-jobs/ftpdir-cleanup
index e24e614..d54cdec 100755
--- a/cron-jobs/ftpdir-cleanup
+++ b/cron-jobs/ftpdir-cleanup
@@ -7,7 +7,7 @@ clean_pkg() {
local pkg
local target
- if ! ${CLEANUP_DRYRUN}; then
+ if [[ $CLEANUP_DRYRUN != true ]]; then
for pkg in "$@"; do
if [[ -h $pkg ]]; then
rm -f "$pkg" "$pkg.sig"
@@ -30,7 +30,7 @@ for repo in ${PKGREPOS[@]}; do
done
done
-${CLEANUP_DRYRUN} && warning 'dry run mode is active'
+[[ $CLEANUP_DRYRUN = true ]] && warning 'dry run mode is active'
for repo in ${PKGREPOS[@]}; do
for arch in ${ARCHES[@]}; do
@@ -92,7 +92,7 @@ if (( ${#old_pkgs[@]} >= 1 )); then
msg "Removing old packages from the cleanup directory..."
for old_pkg in ${old_pkgs[@]}; do
msg2 '%s' "${old_pkg}"
- if ! ${CLEANUP_DRYRUN}; then
+ if [[ $CLEANUP_DRYRUN != true ]]; then
rm -f "${CLEANUP_DESTDIR}/${old_pkg}"
rm -f "${CLEANUP_DESTDIR}/${old_pkg}.sig"
fi
diff --git a/cron-jobs/sourceballs b/cron-jobs/sourceballs
index 7370594..5908758 100755
--- a/cron-jobs/sourceballs
+++ b/cron-jobs/sourceballs
@@ -127,10 +127,10 @@ old_pkgs=($(comm -23 "${WORKDIR}/available-src-pkgs.sort" "${WORKDIR}/expected-s
if (( ${#old_pkgs[@]} >= 1 )); then
msg "Removing old source packages..."
- ${SOURCE_CLEANUP_DRYRUN} && warning 'dry run mode is active'
+ [[ $SOURCE_CLEANUP_DRYRUN = true ]] && warning 'dry run mode is active'
for old_pkg in ${old_pkgs[@]}; do
msg2 '%s' "${old_pkg}"
- if ! ${SOURCE_CLEANUP_DRYRUN}; then
+ if [[ $SOURCE_CLEANUP_DRYRUN != true ]]; then
mv_acl "$FTP_BASE/${SRCPOOL}/${old_pkg}" "${SOURCE_CLEANUP_DESTDIR}/${old_pkg}"
touch "${SOURCE_CLEANUP_DESTDIR}/${old_pkg}"
fi
@@ -149,7 +149,7 @@ if (( ${#old_pkgs[@]} >= 1 )); then
msg "Removing old source packages from the cleanup directory..."
for old_pkg in ${old_pkgs[@]}; do
msg2 '%s' "${old_pkg}"
- ${SOURCE_CLEANUP_DRYRUN} || rm -f "${SOURCE_CLEANUP_DESTDIR}/${old_pkg}"
+ [[ $SOURCE_CLEANUP_DRYRUN = true ]] || rm -f "${SOURCE_CLEANUP_DESTDIR}/${old_pkg}"
done
fi
diff --git a/db-functions b/db-functions
index 4731f36..cb44ba9 100644
--- a/db-functions
+++ b/db-functions
@@ -139,7 +139,7 @@ repo_lock () {
fi
_count=0
- while (( _count <= _trial )) || $_lockblock ; do
+ while (( _count <= _trial )) || [[ $_lockblock = true ]]; do
if ! mkdir "$LOCKDIR" >/dev/null 2>&1 ; then
_owner="$(/usr/bin/stat -c %U $LOCKDIR)"
warning "Repo [%s] (%s) is already locked by %s." "$1" "$2" "$_owner"
diff --git a/testing2x b/testing2x
index d68e405..f0f1e3a 100755
--- a/testing2x
+++ b/testing2x
@@ -30,7 +30,7 @@ for pkgbase in $*; do
break
fi
done
- ${found_source} || die "%s not found in [%s]" "$pkgbase" "$TESTING_REPO"
+ [[ $found_source = true ]] || die "%s not found in [%s]" "$pkgbase" "$TESTING_REPO"
found_target=false
for pkgarch in ${ARCHES[@]} 'any'; do
for repo in ${STABLE_REPOS[@]}; do
@@ -42,7 +42,7 @@ for pkgbase in $*; do
fi
done
done
- ${found_target} || die "%s not found in any of these repos: %s" "$pkgbase" "${STABLE_REPOS[*]}"
+ [[ $found_target = true ]] || die "%s not found in any of these repos: %s" "$pkgbase" "${STABLE_REPOS[*]}"
fi
done