summaryrefslogtreecommitdiff
path: root/lib/common.sh
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@parabola.nu>2017-03-28 19:14:54 -0400
committerLuke Shumaker <lukeshu@parabola.nu>2017-04-20 00:23:25 -0400
commitf52d44084734e30e795205162f4ab142f0fef181 (patch)
tree9f43447c665a28c6b20425b06f428ebcf44f2512 /lib/common.sh
parent3d9d47697c768a04504638495489c4ac83565275 (diff)
downloaddevtools32-f52d44084734e30e795205162f4ab142f0fef181.tar.xz
Make slightly more involved changes to make shellcheck happy.
- Use `read -r` instead of other forms of read or looping - Use arrays instead of strings with whitespaces. - In one instance, use ${var%%.*} instead of $(echo $var|cut -f. -d1)
Diffstat (limited to 'lib/common.sh')
-rw-r--r--lib/common.sh15
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/common.sh b/lib/common.sh
index 4a15d9a..12d594e 100644
--- a/lib/common.sh
+++ b/lib/common.sh
@@ -123,24 +123,27 @@ in_array() {
##
get_full_version() {
# set defaults if they weren't specified in buildfile
- pkgbase=${pkgbase:-${pkgname[0]}}
- epoch=${epoch:-0}
+ local pkgbase=${pkgbase:-${pkgname[0]}}
+ local epoch=${epoch:-0}
+ local pkgver=${pkgver}
+ local pkgrel=${pkgrel}
if [[ -z $1 ]]; then
if (( ! epoch )); then
- echo $pkgver-$pkgrel
+ printf '%s\n' "$pkgver-$pkgrel"
else
- echo $epoch:$pkgver-$pkgrel
+ printf '%s\n' "$epoch:$pkgver-$pkgrel"
fi
else
+ local pkgver_override= pkgrel_override= epoch_override=
for i in pkgver pkgrel epoch; do
local indirect="${i}_override"
eval "$(declare -f "package_$1" | sed -n "s/\(^[[:space:]]*$i=\)/${i}_override=/p")"
[[ -z ${!indirect} ]] && eval ${indirect}=\"${!i}\"
done
if (( ! epoch_override )); then
- echo $pkgver_override-$pkgrel_override
+ printf '%s\n' "$pkgver_override-$pkgrel_override"
else
- echo $epoch_override:$pkgver_override-$pkgrel_override
+ printf '%s\n' "$epoch_override:$pkgver_override-$pkgrel_override"
fi
fi
}