summaryrefslogtreecommitdiff
path: root/lib/common.sh
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@parabola.nu>2017-03-28 19:13:52 -0400
committerLuke Shumaker <lukeshu@parabola.nu>2017-05-04 21:09:14 -0400
commitbab91f854240b950f8ab9142e949391406e6a43e (patch)
tree0dece2eae59cbdb0bef104e4b31f30245fb6fbf2 /lib/common.sh
parent168341e04931b1203740870e57966ce0f1d19e0d (diff)
downloaddevtools32-bab91f854240b950f8ab9142e949391406e6a43e.tar.xz
Quote strings that shellcheck warns about.
These changes are all strictly "slap some double-quotes in there". Anything more than that is not included in this commit.
Diffstat (limited to 'lib/common.sh')
-rw-r--r--lib/common.sh16
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/common.sh b/lib/common.sh
index 8f043e8..4a15d9a 100644
--- a/lib/common.sh
+++ b/lib/common.sh
@@ -79,7 +79,7 @@ cleanup() {
if [[ -n ${WORKDIR:-} ]] && $_setup_workdir; then
rm -rf "$WORKDIR"
fi
- exit ${1:-0}
+ exit "${1:-0}"
}
abort() {
@@ -112,7 +112,7 @@ in_array() {
local needle=$1; shift
local item
for item in "$@"; do
- [[ $item = $needle ]] && return 0 # Found
+ [[ $item = "$needle" ]] && return 0 # Found
done
return 1 # Not Found
}
@@ -134,7 +134,7 @@ get_full_version() {
else
for i in pkgver pkgrel epoch; do
local indirect="${i}_override"
- eval $(declare -f package_$1 | sed -n "s/\(^[[:space:]]*$i=\)/${i}_override=/p")
+ eval "$(declare -f "package_$1" | sed -n "s/\(^[[:space:]]*$i=\)/${i}_override=/p")"
[[ -z ${!indirect} ]] && eval ${indirect}=\"${!i}\"
done
if (( ! epoch_override )); then
@@ -155,9 +155,9 @@ lock() {
eval "exec $1>"'"$2"'
fi
- if ! flock -n $1; then
+ if ! flock -n "$1"; then
stat_busy "${@:3}"
- flock $1
+ flock "$1"
stat_done
fi
}
@@ -172,9 +172,9 @@ slock() {
eval "exec $1>"'"$2"'
fi
- if ! flock -sn $1; then
+ if ! flock -sn "$1"; then
stat_busy "${@:3}"
- flock -s $1
+ flock -s "$1"
stat_done
fi
}
@@ -184,6 +184,8 @@ slock() {
##
lock_close() {
local fd=$1
+ # https://github.com/koalaman/shellcheck/issues/862
+ # shellcheck disable=2034
exec {fd}>&-
}