From 9b98ace894ac4641e789dd04637aa52b58d3c177 Mon Sep 17 00:00:00 2001 From: Mihai Moldovan Date: Mon, 4 Jul 2016 22:50:46 +0200 Subject: 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. --- bin/sbuild-deb-package | 14 +++++++++----- 1 file 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 -- cgit v1.2.3