mirror of
https://github.com/mtan93/Installomator.git
synced 2026-03-25 05:04:15 +00:00
Merge pull request #691 from Theile/Fall-back-on-GitHub-downloadURL
If GitHub does not give an URL we can fall back on API call
This commit is contained in:
@@ -162,11 +162,19 @@ downloadURLFromGit() { # $1 git user name, $2 git repo name
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
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 -sfL "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)
|
if [[ "$(echo $downloadURL | grep -ioE "https.*$archiveName")" == "" ]]; then
|
||||||
|
printlog "GitHub API not returning URL, trying https://github.com/$gitusername/$gitreponame/releases/latest."
|
||||||
|
#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 "$(curl -sfL "https://github.com/$gitusername/$gitreponame/releases/latest" | tr '"' "\n" | grep -i "expanded_assets" | head -1)" | tr '"' "\n" | grep -i "^/.*\/releases\/download\/.*$archiveName" | head -1)"
|
||||||
|
fi
|
||||||
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 -sfL "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)
|
if [[ "$(echo $downloadURL | grep -ioE "https.*.$filetype")" == "" ]]; then
|
||||||
|
printlog "GitHub API not returning URL, trying https://github.com/$gitusername/$gitreponame/releases/latest."
|
||||||
|
#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 "$(curl -sfL "https://github.com/$gitusername/$gitreponame/releases/latest" | tr '"' "\n" | grep -i "expanded_assets" | head -1)" | tr '"' "\n" | grep -i "^/.*\/releases\/download\/.*\.$filetype" | head -1)"
|
||||||
|
fi
|
||||||
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
|
||||||
|
|||||||
Reference in New Issue
Block a user