Final fix for GitHub downloadURL

For all labels tested it gives the same results as API-URL.
This commit is contained in:
Søren Theilgaard
2022-08-29 12:50:28 +02:00
parent 9157d4763b
commit f7e2c5e000
3 changed files with 5 additions and 5 deletions

View File

@@ -160,10 +160,10 @@ downloadURLFromGit() { # $1 git user name, $2 git repo name
if [ -n "$archiveName" ]; then if [ -n "$archiveName" ]; then
#downloadURL=$(curl -L --silent --fail "https://api.github.com/repos/$gitusername/$gitreponame/releases/latest" | awk -F '"' "/browser_download_url/ && /$archiveName\"/ { print \$4; exit }") #downloadURL=$(curl -L --silent --fail "https://api.github.com/repos/$gitusername/$gitreponame/releases/latest" | awk -F '"' "/browser_download_url/ && /$archiveName\"/ { print \$4; exit }")
downloadURL=https://github.com$(curl -sfL "https://github.com/$gitusername/$gitreponame/releases/latest" | tr '"' "\n" | grep -i "\/releases\/download\/.*$archiveName" | head -1) downloadURL=https://github.com$(curl -sfL "https://github.com/$gitusername/$gitreponame/releases/latest" | tr '"' "\n" | grep -i "^/.*\/releases\/download\/.*$archiveName" | head -1)
else else
#downloadURL=$(curl -L --silent --fail "https://api.github.com/repos/$gitusername/$gitreponame/releases/latest" | awk -F '"' "/browser_download_url/ && /$filetype\"/ { print \$4; exit }") #downloadURL=$(curl -L --silent --fail "https://api.github.com/repos/$gitusername/$gitreponame/releases/latest" | awk -F '"' "/browser_download_url/ && /$filetype\"/ { print \$4; exit }")
downloadURL=https://github.com$(curl -sfL "https://github.com/$gitusername/$gitreponame/releases/latest" | tr '"' "\n" | grep -i "\/releases\/download\/.*\.$filetype" | head -1) downloadURL=https://github.com$(curl -sfL "https://github.com/$gitusername/$gitreponame/releases/latest" | tr '"' "\n" | grep -i "^/.*\/releases\/download\/.*\.$filetype" | head -1)
fi fi
if [ -z "$downloadURL" ]; then if [ -z "$downloadURL" ]; then
cleanupAndExit 14 "could not retrieve download URL for $gitusername/$gitreponame" ERROR cleanupAndExit 14 "could not retrieve download URL for $gitusername/$gitreponame" ERROR

View File

@@ -1,7 +1,6 @@
cocoapods) cocoapods)
name="CocoaPods" name="CocoaPods"
type="bz2" type="bz2"
archiveName="CocoaPods.app-[0-9.]*.tar.bz2"
downloadURL="$(downloadURLFromGit CocoaPods CocoaPods-app)" downloadURL="$(downloadURLFromGit CocoaPods CocoaPods-app)"
appNewVersion="$(versionFromGit CocoaPods CocoaPods-app)" appNewVersion="$(versionFromGit CocoaPods CocoaPods-app)"
expectedTeamID="AX2Q2BH2XR" expectedTeamID="AX2Q2BH2XR"

View File

@@ -64,9 +64,9 @@ downloadURLFromGit() { # $1 git user name, $2 git repo name
#echo "$githubPart" #echo "$githubPart"
#downloadURL="https://github.com/$gitusername/$gitreponame/releases/latest" #downloadURL="https://github.com/$gitusername/$gitreponame/releases/latest"
if [ -n "$archiveName" ]; then if [ -n "$archiveName" ]; then
downloadURL=https://github.com$(curl -sfL "https://github.com/$gitusername/$gitreponame/releases/latest" | tr '"' "\n" | grep -i "\/releases\/download\/.*$archiveName" | head -1) downloadURL=https://github.com$(curl -sfL "https://github.com/$gitusername/$gitreponame/releases/latest" | tr '"' "\n" | grep -i "^/.*\/releases\/download\/.*$archiveName" | head -1)
else else
downloadURL=https://github.com$(curl -sfL "https://github.com/$gitusername/$gitreponame/releases/latest" | tr '"' "\n" | grep -i "\/releases\/download\/.*\.$filetype" | head -1) downloadURL=https://github.com$(curl -sfL "https://github.com/$gitusername/$gitreponame/releases/latest" | tr '"' "\n" | grep -i "^/.*\/releases\/download\/.*\.$filetype" | head -1)
fi fi
echo "$downloadURL" echo "$downloadURL"
return 0 return 0
@@ -195,6 +195,7 @@ for fixedArch in i386 arm64; do
#caseLabel #caseLabel
if cat "${labels_dir}/${label}.sh" | grep -v -E '^[a-z0-9\_-]*(\)|\|\\)$' | grep -v ";;" > checkLabelCurrent.sh; then if cat "${labels_dir}/${label}.sh" | grep -v -E '^[a-z0-9\_-]*(\)|\|\\)$' | grep -v ";;" > checkLabelCurrent.sh; then
INSTALL=force # This is only to prevent various Microsoft labels from running "msupdate --list"
source checkLabelCurrent.sh source checkLabelCurrent.sh
echo "Name: $name" echo "Name: $name"