added git version checking to all scripts

This commit is contained in:
tb14
2025-01-27 16:00:22 -06:00
parent a3150b19fe
commit 8aa29e0616
8 changed files with 121 additions and 16 deletions
+37 -4
View File
@@ -1,9 +1,9 @@
#!/bin/bash
################################################################################
################################################################################
####################### AmRRON Vara Setup v.0.9.4.1 ######################
####################### AmRRON Vara Setup v.1.0 ######################
####################### Created by TB-14 ######################
####################### 18 JAN 2025 ######################
####################### 27 JAN 2025 ######################
################################################################################
################################################################################
@@ -34,6 +34,39 @@ 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
}
#### Program setup functions
# Find out if we have yad and install if not
echo "Yad is used to create the interactive menus this program uses."
@@ -618,9 +651,9 @@ exit 1
check_for_updates
set_screen_size
check_repo_version
#check_repo_version
confirm_os
primer_menu
if [[ $PLAT = Linuxmint ]]; then