summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMihai Moldovan <ionic@ionic.de>2016-07-04 22:50:46 +0200
committerMihai Moldovan <ionic@ionic.de>2016-07-04 22:50:46 +0200
commit9b98ace894ac4641e789dd04637aa52b58d3c177 (patch)
tree10d02fbc37e883880b2471eb25658fe6cf315b22
parente00a37895b6b56f28d9b0d3d360af500397dd39e (diff)
downloadbuildscripts-9b98ace894ac4641e789dd04637aa52b58d3c177.tar.gz
buildscripts-9b98ace894ac4641e789dd04637aa52b58d3c177.tar.bz2
buildscripts-9b98ace894ac4641e789dd04637aa52b58d3c177.zip
bin/build-deb-package: fix various issues:
- typeset -l makes the content lowercase, not the variable "local" (that's implied by using typeset.) Hence, drop it where inappropriate. - typeset -l is only available in BASH 4 and higher. Use it conditionally only. - Use tr to convert strings to lowercase when using a BASH version lower than 4. - Don't accept empty numerical version values.
-rwxr-xr-xbin/sbuild-deb-package14
1 files changed, 9 insertions, 5 deletions
diff --git a/bin/sbuild-deb-package b/bin/sbuild-deb-package
index 6519c4b..84f43ad 100755
--- a/bin/sbuild-deb-package
+++ b/bin/sbuild-deb-package
@@ -233,7 +233,11 @@ build_packages() {
}
# for Ubuntu version is the codename of the distribution release
- typeset -l codename="${l_CODENAME}"
+ if [ -n "${BASH_VERSINFO[0]}" ] && [ "${BASH_VERSINFO[0]}" -gt 3 ]; then
+ typeset -l codename="${l_CODENAME}"
+ else
+ typeset codename="$(tr '[:upper:]' '[:lower:]' <<< "${l_CODENAME}")"
+ fi
# translate the version name for Debian releases
[ "x${l_CODENAME}" = "xsid" ] && codename="unstable"
@@ -241,9 +245,9 @@ build_packages() {
#[ "x$l_CODENAME" = "xwheezy" ] && codename=stable
#[ "x$l_CODENAME" = "xoldstable" ] && codename=oldstable
- typeset -l numerical_version=""
- typeset -l -i tmp_ret="1"
- typeset -l pretty_dist=""
+ typeset numerical_version=""
+ typeset -i tmp_ret="1"
+ typeset pretty_dist=""
if [ -n "${l_DIST}" ] && [ "${l_DIST}" = "debian" ]; then
pretty_dist="Debian"
@@ -257,7 +261,7 @@ build_packages() {
tmp_ret="${?}"
fi
- if [ "${tmp_ret}" -ne "0" ]; then
+ if [ "${tmp_ret}" -ne "0" ] || [ -z "${numerical_version}" ]; then
echo "Error: unable to map code name \"${codename}\" to Debian or Ubuntu numerical versions. Unknown code name or not applicable to distribution \"${dist_pretty}\"? Aborting." >&2
exit 1
fi