Update NonSteamLaunchers.sh

added code for a silent update notification that way nobody misses an update no matter what
This commit is contained in:
moraroy 2023-05-06 14:50:52 -07:00 committed by GitHub
parent 8488f1fe84
commit 3ec585ea50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,9 +17,21 @@ check_for_updates() {
if [ "$version" != "$latest_version" ]; then
# Display a Zenity window to notify the user that a new version is available
zenity --info --text="A new version is available: $latest_version\nPlease download it from GitHub." --width=200 --height=100
else
# Set the URL to the raw content of the script on GitHub
local raw_url=$(curl -s "$api_url" | grep '"tarball_url":' | sed -E 's/.*"([^"]+)".*/\1/')
# Download the latest version of the script from GitHub
curl -Ls "$raw_url" | tar -xzO --wildcards "*/script.sh" > /tmp/latest_script.sh
# Compare the latest version of the script against the local version
if ! cmp -s "$0" /tmp/latest_script.sh; then
# Display a Zenity window to notify the user that a new version is available
zenity --info --text="A new version is available\nPlease download it from GitHub." --width=200 --height=100
else
echo "You are already running the latest version: $version"
fi
fi
}
check_for_updates
@ -50,6 +62,7 @@ check_for_updates
# Set the paths to the launcher executables