diff --git a/02-topgrade.sh b/02-topgrade.sh index 8a80418..e82b389 100644 --- a/02-topgrade.sh +++ b/02-topgrade.sh @@ -14,13 +14,17 @@ fi echo "* Checking for topgrade binary" topgrade_binary="/opt/topgrade/topgrade" topgrade_tar="/opt/topgrade/topgrade.tar.gz" -topgrade_git_user="r-darwish" +topgrade_git_owner="r-darwish" topgrade_git_repo="topgrade" if [ ! -f "$topgrade_binary" ]; then echo "** topgrade binary missing, installing now" - wget "https://github.com/r-darwish/topgrade/releases/download/v8.2.0/topgrade-v8.2.0-x86_64-unknown-linux-gnu.tar.gz" -O "$topgrade_tar" + newest_release=$(curl -sL https://api.github.com/repos/$topgrade_git_owner/$topgrade_git_repo/releases/latest | jq -r ".tag_name") + echo $newest_release + wget "https://github.com/$topgrade_git_owner/$topgrade_git_repo/releases/download/v8.2.0/topgrade-v8.2.0-x86_64-unknown-linux-gnu.tar.gz" -O "$topgrade_tar" # curl -s -L "https://github.com/$topgrade_git_user/$topgrade_git_repo/releases/latest" | egrep -o '/$topgrade_git_user/$topgrade_git_repo/releases/download/[0-9]*/[0-9]*-x86_64-unknown-linux-gnu.tar.gz' | wget --base=http://github.com/ -i - -O "$topgrade_tar" tar -xvf $topgrade_tar -C $topgrade_install_directory + rm $topgrade_tar + chmod +x $topgrade_binary else echo "** topgrade binary exists" fi