This commit is contained in:
2025-01-06 10:35:31 +01:00
parent ddb25adba3
commit 11bad4f0cd

View File

@@ -30,13 +30,13 @@ RawUrl="https://x-access-token:$GITHUB_TOKEN@raw.githubusercontent.com/Bruno21/b
### Check if there's a new release of the script: ### Check if there's a new release of the script:
LatestRelease="$(curl -s -r 0-50 $RawUrl | sed -n "/VERSION/s/VERSION=//p" | tr -d '"')" LatestRelease="$(curl -s -r 0-50 $RawUrl | sed -n "/VERSION/s/VERSION=//p" | tr -d '"')"
#LatestChanges="$(curl -s -r 0-200 $RawUrl | sed -n "/ChangeNotes/s/### ChangeNotes: //p")" #LatestChanges="$(curl -s -r 0-2000 $RawUrl | sed -n "/ChangeNotes/s/# ChangeNotes: //p")"
LatestChanges="$(curl -s -r 0-2000 $RawUrl | sed -n "/ChangeNotes/s/# ChangeNotes: //p")" LatestChanges="$(curl -s -r 0-2000 $RawUrl | grep "^### ChangeNotes:" | sed 's/### ChangeNotes://g')"
#[[ $LatestRelease != $VERSION ]] && new="($LatestRelease)" || new="" #[[ $LatestRelease != $VERSION ]] && new="($LatestRelease)" || new=""
echo "$LatestRelease" #echo "$LatestRelease"
echo "$LatestChanges" #echo "$LatestChanges"
red="\033[1;31m" red="\033[1;31m"
greenbold="\033[1;32m" greenbold="\033[1;32m"
@@ -342,7 +342,7 @@ self_update_curl() {
cp "$ScriptPath" "$ScriptPath".bak cp "$ScriptPath" "$ScriptPath".bak
if [[ $(builtin type -P curl) ]]; then if [[ $(builtin type -P curl) ]]; then
curl -L $RawUrl > "$ScriptPath" ; chmod +x "$ScriptPath" curl -L $RawUrl > "$ScriptPath" ; chmod +x "$ScriptPath"
printf "\n%s\n" "--- starting over with the updated version ---" printf "\n%s\n" "--- starting over with the updated version ---"
exec "$ScriptPath" "${ScriptArgs[@]}" >/dev/null # run the new script with old arguments exec "$ScriptPath" "${ScriptArgs[@]}" >/dev/null # run the new script with old arguments
exit 1 # exit the old instance exit 1 # exit the old instance
elif [[ $(builtin type -P wget) ]]; then elif [[ $(builtin type -P wget) ]]; then
@@ -371,7 +371,7 @@ self_update() {
} }
### Version check & initiate self update ### Version check & initiate self update
if [[ "$VERSION" != "$LatestRelease" ]] ; then if [[ "$VERSION" != "$LatestRelease" ]] ; then
printf "New version available! %b%s%b ⇒ %b%s%b \nChange Notes:\n%s \n" "$c_yellow" "$VERSION" "$c_reset" "$c_green" "$LatestRelease" "$c_reset" "$LatestChanges" printf "New version available! %b%s%b ⇒ %b%s%b \nChange Notes:\n%s \n" "$c_yellow" "$VERSION" "$c_reset" "$c_green" "$LatestRelease" "$c_reset" "$LatestChanges"
if [[ -z "$AutoUp" ]] ; then if [[ -z "$AutoUp" ]] ; then
read -r -p "Would you like to update? y/[n]: " SelfUpdate read -r -p "Would you like to update? y/[n]: " SelfUpdate