|
|
|
@ -65,11 +65,15 @@ verifySupported() {
|
|
|
|
|
# checkLatestVersion checks the latest available version.
|
|
|
|
|
checkLatestVersion() {
|
|
|
|
|
# Use the GitHub API to find the latest version for this project.
|
|
|
|
|
local latest_url="https://api.github.com/repos/kubernetes/helm/releases/latest"
|
|
|
|
|
local latest_url="https://github.com/kubernetes/helm/releases/latest"
|
|
|
|
|
if type "curl" > /dev/null; then
|
|
|
|
|
TAG=$(curl -s $latest_url | awk '/\"tag_name\":/{gsub( /[,\"]/,"", $2); print $2}')
|
|
|
|
|
TAG=$(curl -SsL $latest_url | awk '/\/tag\//' | head -n 1 | cut -d '"' -f 2 | awk '{n=split($NF,a,"/");print a[n]}')
|
|
|
|
|
elif type "wget" > /dev/null; then
|
|
|
|
|
TAG=$(wget -q -O - $latest_url | awk '/\"tag_name\":/{gsub( /[,\"]/,"", $2); print $2}')
|
|
|
|
|
TAG=$(wget -q -O - $latest_url | awk '/\/tag\//' | head -n 1 | cut -d '"' -f 2 | awk '{n=split($NF,a,"/");print a[n]}')
|
|
|
|
|
fi
|
|
|
|
|
if [ "x$TAG" == "x" ]; then
|
|
|
|
|
echo "Cannot determine latest tag."
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|