[pacman-dev] [PATCH] makepkg: revert bash4-ism

Allan McRae allan at archlinux.org
Sun Jun 20 10:39:17 EDT 2010


Commit 3d67d9b1 introduced multiple bash4 string manipulations.
Revert those in order retain compatibility with bash-3.2 which
is still widely used.

Signed-off-by: Allan McRae <allan at archlinux.org>
---
 scripts/makepkg.sh.in |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index c6bc738..5b8d703 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -265,11 +265,11 @@ check_buildenv() {
 #          ? - not found
 ##
 in_opt_array() {
-	local needle="${1,,}"; shift
+	local needle=$(echo $1 | tr '[:upper:]' '[:lower:]'); shift
 
 	local opt
 	for opt in "$@"; do
-		opt="${opt,,}"
+		opt=$(echo $opt | tr '[:upper:]' '[:lower:]')
 		if [[ $opt = $needle ]]; then
 			echo 'y' # Enabled
 			return
@@ -554,7 +554,7 @@ generate_checksums() {
 
 	local integ
 	for integ in ${integlist[@]}; do
-		integ="${integ,,}"
+		integ=$(echo $integ | tr '[:upper:]' '[:lower:]')
 		case "$integ" in
 			md5|sha1|sha256|sha384|sha512) : ;;
 			*)
@@ -617,7 +617,7 @@ check_checksums() {
 				fi
 
 				if (( $found )) ; then
-					local expectedsum="${integrity_sums[$idx],,}"
+					local expectedsum=$(echo ${integrity_sums[$idx]} | tr '[:upper:]' '[:lower:]')
 					local realsum="$(openssl dgst -${integ} "$file")"
 					realsum="${realsum##* }"
 					if [[ $expectedsum = $realsum ]]; then
@@ -1665,7 +1665,7 @@ if (( CLEANCACHE )); then
 		echo -n "$(gettext "    Are you sure you wish to do this? ")"
 		echo -n "$(gettext "[y/N]")"
 		read answer
-		answer="${answer^^}"
+		answer=$(echo $answer | tr '[:lower:]' '[:upper:]')
 		if [[ $answer = $(gettext YES) || $answer = $(gettext Y) ]]; then
 			rm "$SRCDEST"/*
 			if (( $? )); then
-- 
1.7.1



More information about the pacman-dev mailing list