summaryrefslogtreecommitdiffstats
path: root/lib/common.sh
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@parabola.nu>2017-05-06 00:41:08 +0200
committerJan Alexander Steffens (heftig) <jan.steffens@gmail.com>2017-07-05 18:21:56 +0200
commit78fabcfa0694ae8c81e1d5ec0e5dacaed533545e (patch)
tree0f6c24c5e0d7166fbe3540acff00d7e14d02e26c /lib/common.sh
parent3f72579b2813bd93c586aec80c48472f41c60d78 (diff)
downloaddevtools-78fabcfa0694ae8c81e1d5ec0e5dacaed533545e.tar.gz
devtools-78fabcfa0694ae8c81e1d5ec0e5dacaed533545e.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}>&-
}