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.

73 lines
2.2 KiB

#!/bin/bash
# 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
6 years ago
cd /home/admin/raspiblitz
# change branch if set as parameter
clean=0
6 years ago
wantedBranch="$1"
if [ "${wantedBranch}" = "-clean" ]; then
clean=1
wantedBranch="$2"
fi
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}"
if [ "${wantedBranch}" = "${activeBranch}" ]; then
echo "OK"
else
echo "try changing branch .."
git checkout ${wantedBranch}
activeBranch=$(git branch | grep \* | cut -d ' ' -f2)
fi
6 years ago
else
6 years ago
echo ""
echo "USAGE-INFO: ./XXsyncScripts.sh '[BRANCHNAME]'"
fi
6 years ago
origin=$(git remote -v | grep 'origin' | tail -n1)
echo ""
6 years ago
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."
6 years ago
echo "REPO ----> ${origin}"
echo "BRANCH --> ${activeBranch}"
echo "******************************************"
git pull
cd ..
if [ ${clean} -eq 1 ]; then
echo "Cleaning scripts & assets/config.scripts"
rm *.sh
rm -r assets
6 years ago
mkdir assets
rm -r config.scripts
6 years ago
mkdir config.scripts
else
6 years ago
echo "******************************************"
echo "NOT cleaning/deleting old files"
echo "use parameter '-clean' if you want that next time"
6 years ago
echo "******************************************"
fi
6 years ago
echo "COPYING from GIT-Directory to /home/admin/ .."
sudo -u admin cp -r -f /home/admin/raspiblitz/home.admin/*.* /home/admin
sudo -u admin cp -r -f /home/admin/raspiblitz/home.admin/assets/*.* /home/admin/assets
6 years ago
sudo -u admin chmod +x /home/admin/*.sh
sudo -u admin chmod +x /home/admin/*.py
sudo -u admin chmod +x /home/admin/config.scripts/*.sh
sudo -u admin chmod +x /home/admin/config.scripts/*.py
echo "******************************************"
echo "OK - shell scripts and assests are synced"
echo "Reboot recommended"
echo ""