diff --git a/linux-game-manager.sh b/linux-game-manager.sh index 0739d66..0113bd8 100755 --- a/linux-game-manager.sh +++ b/linux-game-manager.sh @@ -45,6 +45,20 @@ EOF export DIALOGOPTS='--no-lines --visit-items' +# Check for updates +check_update() { + local branch="$(git rev-parse --abbrev-ref HEAD)" + local localSha="$(git rev-parse origin/${branch})" + local remoteSha="$(git rev-parse refs/remotes/origin/${branch})" + if [[ "${localSha}" == "${remoteSha}" ]]; then + return + fi + dialog --backtitle "Linux Game manager" \ + --yesno "Updates are available. Would you like to update now?" -1 -1 || return + git pull + exit $? +} + # Function to open urls open_url() { xdg-open "${*}" 2> /dev/null @@ -285,6 +299,7 @@ for i in "${requiredPackages}" ; do exit 1 fi done +check_update # With no arguments, open the game launcher. if [[ $# -eq 0 ]]; then game_launcher