From 72ba1299eb0a3eeb10f1746569abf7ea6f258102 Mon Sep 17 00:00:00 2001 From: rootzoll Date: Sun, 26 Apr 2020 15:18:33 +0200 Subject: [PATCH] #1138 get info about Repo from sync script --- home.admin/XXsyncScripts.sh | 74 +++++++++++++++++++++---------------- 1 file changed, 42 insertions(+), 32 deletions(-) diff --git a/home.admin/XXsyncScripts.sh b/home.admin/XXsyncScripts.sh index 1b1982245..33d2ec016 100755 --- a/home.admin/XXsyncScripts.sh +++ b/home.admin/XXsyncScripts.sh @@ -9,6 +9,17 @@ cd /home/admin/raspiblitz source /mnt/hdd/raspiblitz.conf 2>/dev/null +# gather info +activeGitHubUser=$(sudo -u admin cat /home/admin/raspiblitz/.git/config | grep "url = " | cut -d "=" -f2 | cut -d "/" -f4) +activeBranch=$(git branch | grep \* | cut -d ' ' -f2) + +# if parameter is "info" just give back basic info about sync +if [ "$1" == "info"]; then + echo "activeGitHubUser='${activeGitHubUser}'" + echo "activeBranch='${activeBranch}'" + exit 1 +fi + # change branch if set as parameter clean=0 wantedBranch="$1" @@ -20,14 +31,13 @@ if [ "$2" = "-clean" ]; then clean=1 fi -activeBranch=$(git branch | grep \* | cut -d ' ' -f2) if [ ${#wantedBranch} -gt 0 ]; then - echo "your wanted branch is: ${wantedBranch}" - echo "your active branch is: ${activeBranch}" + echo "# your wanted branch is: ${wantedBranch}" + echo "# your active branch is: ${activeBranch}" if [ "${wantedBranch}" = "${activeBranch}" ]; then - echo "OK" + echo "# OK" else - echo "try changing branch .." + echo "# try changing branch .." git checkout ${wantedBranch} activeBranch=$(git branch | grep \* | cut -d ' ' -f2) fi @@ -41,54 +51,54 @@ origin=$(git remote -v | grep 'origin' | tail -n1) checkSumBlitzTUIBefore=$(find /home/admin/raspiblitz/home.admin/BlitzTUI -type f -exec md5sum {} \; | md5sum) echo -echo "*** SYNCING SHELL SCRIPTS WITH GITHUB ***" -echo "This is for developing on your RaspiBlitz." -echo "THIS IS NOT THE REGULAR UPDATE MECHANISM" -echo "and can lead to dirty state of your scripts." -echo "REPO ----> ${origin}" -echo "BRANCH --> ${activeBranch}" -echo "******************************************" +echo "# *** SYNCING SHELL SCRIPTS WITH GITHUB ***" +echo "# This is for developing on your RaspiBlitz." +echo "# THIS IS NOT THE REGULAR UPDATE MECHANISM" +echo "# and can lead to dirty state of your scripts." +echo "# REPO ----> ${origin}" +echo "# BRANCH --> ${activeBranch}" +echo "# ******************************************" git pull cd .. if [ ${clean} -eq 1 ]; then - echo "Cleaning scripts & assets/config.scripts" + echo "# Cleaning scripts & assets/config.scripts" rm *.sh rm -r assets mkdir assets rm -r config.scripts mkdir config.scripts else - echo "******************************************" - echo "NOT cleaning/deleting old files" - echo "use parameter '-clean' if you want that next time" - echo "******************************************" + echo "# ******************************************" + echo "# NOT cleaning/deleting old files" + echo "# use parameter '-clean' if you want that next time" + echo "# ******************************************" fi -echo "COPYING from GIT-Directory to /home/admin/" +echo "# COPYING from GIT-Directory to /home/admin/" sudo -u admin cp -r -f /home/admin/raspiblitz/home.admin/*.* /home/admin -echo ".." +echo "# .." sudo -u admin cp -r -f /home/admin/raspiblitz/home.admin/assets/*.* /home/admin/assets -echo ".." +echo "# .." sudo -u admin chmod +x /home/admin/*.sh -echo ".." +echo "# .." sudo -u admin chmod +x /home/admin/*.py -echo ".." +echo "# .." sudo -u admin chmod +x /home/admin/config.scripts/*.sh -echo ".." +echo "# .." sudo -u admin chmod +x /home/admin/config.scripts/*.py -echo "******************************************" +echo "# ******************************************" if [ "${touchscreen}" = "1" ]; then - echo "Checking if the content of BlitzTUI changed .." + echo "# Checking if the content of BlitzTUI changed .." checkSumBlitzTUIAfter=$(find /home/admin/raspiblitz/home.admin/BlitzTUI -type f -exec md5sum {} \; | md5sum) - echo "checkSumBlitzTUIBefore = ${checkSumBlitzTUIBefore}" - echo "checkSumBlitzTUIAfter = ${checkSumBlitzTUIAfter}" + echo "# checkSumBlitzTUIBefore = ${checkSumBlitzTUIBefore}" + echo "# checkSumBlitzTUIAfter = ${checkSumBlitzTUIAfter}" if [ "${checkSumBlitzTUIBefore}" = "${checkSumBlitzTUIAfter}" ]; then - echo "BlitzTUI did not changed." + echo "# BlitzTUI did not changed." else - echo "BlitzTUI changed --> UPDATING TOUCHSCREEN INSTALL ..." + echo "# BlitzTUI changed --> UPDATING TOUCHSCREEN INSTALL ..." sudo ./config.scripts/blitz.touchscreen.sh update fi fi -echo "******************************************" -echo "OK - shell scripts and assests are synced" -echo "Reboot recommended" \ No newline at end of file +echo "# ******************************************" +echo "# OK - shell scripts and assests are synced" +echo "# Reboot recommended" \ No newline at end of file