From 04151adbfdae154b6a53a238f5e94a1c6ef7f93b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Theilgaard?= Date: Tue, 16 Nov 2021 16:43:54 +0100 Subject: [PATCH] Update buildLabel.sh --- utils/buildLabel.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/utils/buildLabel.sh b/utils/buildLabel.sh index cf1fa08..534adda 100755 --- a/utils/buildLabel.sh +++ b/utils/buildLabel.sh @@ -252,8 +252,19 @@ if echo "$downloadURL" | grep -i "github.com.*releases/download"; then echo "Try running again with URL: ${githubDownloadURL}" else echo "Not a version problem.\nTesting for difference in archiveName." - tempName=$(echo ${archiveName%.*} | grep -o "[0-9.]*" | tail -1) - archiveDestinationName="$(echo $archiveName | sed -E "s/^(.*)$tempName(.*)$/\1[0-9.]*\2/g")" + tempName=$(echo ${archiveName%.*} | grep -o "[0-9.]*" ) # | tail -1 + tempName=( $tempName ) + i=0 + max=0; tempString="" + echo $tempName | while read tempLine; do + ((i++)) + length[$i]=${#tempLine} + if [[ $max -lt $length[$i] ]] ; then + max=$length[$i] + tempString=$tempLine + fi + done + archiveDestinationName="$(echo $archiveName | sed -E "s/^(.*)$tempString(.*)$/\1[0-9.]*\2/g")" echo "archiveName=\"$archiveDestinationName\"" githubDownloadURL=$(downloadURLFromGit "$githubAuthor" "$githubRepo") githubAppNewVersion=$(versionFromGit "$githubAuthor" "$githubRepo")