diff --git a/functions/self_update.sh b/functions/self_update.sh index 44e07454..6aab3597 100644 --- a/functions/self_update.sh +++ b/functions/self_update.sh @@ -2,14 +2,15 @@ args=("$@") self_update() { -branch="main" + +latest_ver=$(git describe --tags "$(git rev-list --tags --max-count=1)") git fetch &> /dev/null echo "🅂 🄴 🄻 🄵" echo "🅄 🄿 🄳 🄰 🅃 🄴" -if git diff --name-only origin/$branch | grep -qs ".sh" ; then +if [[ "$hs_version" != "$latest_ver" ]] ; then echo "Found a new version of HeavyScript, updating myself..." git reset --hard -q - git pull --force -q + git checkout "$(latest_ver)" count=0 for i in "${args[@]}" do diff --git a/heavy_script.sh b/heavy_script.sh index b8878186..f772cb6d 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -1,7 +1,7 @@ #!/bin/bash #Version -hs_version=$(curl --silent "https://api.github.com/repos/HeavyBullets8/heavy_script/releases/latest" | jq -r .tag_name) +hs_version=$(git describe --tags) # cd to script, this ensures the script can find the source scripts below, even when ran from a seperate directory script=$(readlink -f "$0")