From 3ec585ea50e589d6fbd16665b6ca819c82455ff0 Mon Sep 17 00:00:00 2001 From: moraroy <88516395+moraroy@users.noreply.github.com> Date: Sat, 6 May 2023 14:50:52 -0700 Subject: [PATCH] Update NonSteamLaunchers.sh added code for a silent update notification that way nobody misses an update no matter what --- NonSteamLaunchers.sh | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/NonSteamLaunchers.sh b/NonSteamLaunchers.sh index 2100bd6..92a8459 100644 --- a/NonSteamLaunchers.sh +++ b/NonSteamLaunchers.sh @@ -18,7 +18,19 @@ check_for_updates() { # 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 - echo "You are already running the latest version: $version" + # 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 } @@ -50,6 +62,7 @@ check_for_updates + # Set the paths to the launcher executables