You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

43 lines
1.3 KiB

#!/bin/bash
cd /home/admin/raspiblitz
# change branch if set as parameter
wantedBranch="$1"
activeBranch=$(git branch | grep \* | cut -d ' ' -f2)
if [ ${#wantedBranch} -gt 0 ]; then
echo "your wanted branch is: ${wantedBranch}"
echo "your active branch is: ${activeBranch}"
if [ "${wantedBranch}" = "${activeBranch}" ]; then
echo "OK"
else
echo "try changing branch .."
git checkout ${wantedBranch}
activeBranch=$(git branch | grep \* | cut -d ' ' -f2)
fi
else
echo ""
echo "USAGE-INFO: ./XXupdateScripts.sh '[BRANCHNAME]'"
fi
origin=$(git remote -v | grep 'origin' | tail -n1)
echo ""
echo "*** UPDATING SHELL SCRIPTS FROM GITHUB ***"
echo "just in case, not the final update mechanism"
echo "REPO ----> ${origin}"
echo "BRANCH --> ${activeBranch}"
echo "******************************************"
git pull
cd ..
rm *.sh
rm -r assets
sudo -u admin cp /home/admin/raspiblitz/home.admin/*.* /home/admin
sudo -u admin chmod +x *.sh
sudo -u admin cp -r /home/admin/raspiblitz/home.admin/assets /home/admin/
sudo -u admin cp -r /home/admin/raspiblitz/home.admin/config.scripts /home/admin/
sudo -u admin chmod +x /home/admin/config.scripts/*.sh
echo "******************************************"
echo "OK - shell scripts and assests are up to date"
echo "Reboot recommended"
echo ""