raspiblitz/home.admin/XXsyncScripts.sh

69 lines
2.1 KiB
Bash
Raw Normal View History

2018-08-08 19:58:15 +02:00
#!/bin/bash
2018-12-07 23:51:30 +01:00
2019-01-14 16:13:37 +01:00
# This is for developing on your RaspiBlitz.
# THIS IS NOT THE REGULAR UPDATE MECHANISM
# and can lead to dirty state of your scripts.
# IF YOU WANT TO UPDATE YOUR RASPIBLITZ:
# https://github.com/rootzoll/raspiblitz/blob/master/FAQ.md#how-to-update-my-raspiblitz-after-version-098
2018-12-07 23:58:20 +01:00
cd /home/admin/raspiblitz
2018-12-07 23:51:30 +01:00
# change branch if set as parameter
2019-01-14 23:55:25 +01:00
clean=0
2018-12-08 00:09:26 +01:00
wantedBranch="$1"
2019-01-14 23:55:25 +01:00
if [ "${wantedBranch}" = "-clean" ]; then
clean=1
wantedBranch="$2"
fi
if [ "$2" = "-clean" ]; then
clean=1
fi
2018-12-07 23:51:30 +01:00
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
2018-12-08 00:09:26 +01:00
else
2018-12-08 00:09:54 +01:00
echo ""
2019-01-14 16:13:37 +01:00
echo "USAGE-INFO: ./XXsyncScripts.sh '[BRANCHNAME]'"
2018-12-07 23:51:30 +01:00
fi
2018-12-23 04:01:20 +01:00
origin=$(git remote -v | grep 'origin' | tail -n1)
2018-08-08 19:58:15 +02:00
echo ""
2019-01-14 16:13:37 +01:00
echo "*** SYCING 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."
2018-12-23 04:01:20 +01:00
echo "REPO ----> ${origin}"
echo "BRANCH --> ${activeBranch}"
2018-08-08 19:58:15 +02:00
echo "******************************************"
git pull
cd ..
2019-01-14 23:55:25 +01:00
if [ ${clean} -eq 1 ]; then
echo "Cleaning scripts & assets/config.scripts"
rm *.sh
rm -r assets
rm -r config.scripts
else
2019-01-14 23:57:39 +01:00
echo "******************************************"
2019-01-14 23:55:25 +01:00
echo "NOT cleaning/deleting old files"
echo "use parameter '-clean' if you want that next time"
2019-01-14 23:57:39 +01:00
echo "******************************************"
2019-01-14 23:55:25 +01:00
fi
sudo -u admin cp -f /home/admin/raspiblitz/home.admin/*.* /home/admin
2018-08-08 19:58:15 +02:00
sudo -u admin chmod +x *.sh
2019-01-14 23:55:25 +01:00
sudo -u admin cp -rf /home/admin/raspiblitz/home.admin/assets /home/admin/
sudo -u admin cp -rf /home/admin/raspiblitz/home.admin/config.scripts /home/admin/
2018-12-02 20:55:45 +01:00
sudo -u admin chmod +x /home/admin/config.scripts/*.sh
2018-08-08 20:00:32 +02:00
echo "******************************************"
2019-01-14 16:13:37 +01:00
echo "OK - shell scripts and assests are synced"
2018-08-08 19:59:42 +02:00
echo "Reboot recommended"
2019-01-14 16:13:37 +01:00
echo ""