diff --git a/AmRRON-Setup-Script.sh b/AmRRON-Setup-Script.sh index 732d953..86dbb1a 100755 --- a/AmRRON-Setup-Script.sh +++ b/AmRRON-Setup-Script.sh @@ -72,7 +72,38 @@ sudo -v while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null & fi +function check_for_updates() { + ACTION='\033[1;90m' + FINISHED='\033[1;96m' + READY='\033[1;92m' + NOCOLOR='\033[0m' # No Color + ERROR='\033[0;31m' + echo + echo -e ${ACTION}Checking Git repo + echo -e =======================${NOCOLOR} + BRANCH=$(git rev-parse --abbrev-ref HEAD) + if [ "$BRANCH" != "master" ] + then + echo -e ${ERROR}Not on master. Aborting. ${NOCOLOR} + echo + exit 0 + fi + + + git fetch + HEADHASH=$(git rev-parse HEAD) + UPSTREAMHASH=$(git rev-parse master@{upstream}) + + if [ "$HEADHASH" != "$UPSTREAMHASH" ] + then + echo -e ${ERROR}You are not running the most current version of these scripts. Aborting.${NOCOLOR} + echo -e ${ERROR}Please run "git pull" from the setup-scripts directory to receive updates.${NOCOLOR} + exit 0 + else + echo -e ${FINISHED}Current branch is up to date with origin/master.${NOCOLOR} + fi +} # Find out if we have yad and install if not echo "Yad is used to create the interactive menus this program uses." @@ -127,24 +158,6 @@ echo "${ERRCODE}" >> /tmp/failures ### Check if scripts are up to date -function check_repo_version_testing() { - -cd $DIR && git remote set-url origin https://gitlab.com/amrron/setup-scripts.git/ -GITSTATUS=$(git fetch --dry-run | grep -o testing) - -if [[ $GITSTATUS == "testing" ]]; then - echo - echo - echo "Your repo is out of date. Run the command 'git pull' in the setup-scripts \n - directory in order to pull the most recent updates and fixes for the script and then \n - re-run the script." - else - echo "Repository is up to date. Continuing with script" - sleep 3 -fi - - -} function check_repo_version() { @@ -4819,6 +4832,7 @@ exit 1 ######################## Actually run this thing ############################# ################################################################################ +check_for_updates set_screen_size check_repo_version check_installed_programs