This repository has been archived on 2024-06-01. You can view files and clone it, but cannot push or open issues or pull requests.
cathook/scripts/developer
2019-10-19 19:53:05 +02:00

42 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
if [ $EUID == 0 ]; then
echo "This script must not be run as root"
exit
fi
while true; do
read -p "Do you want to switch your cathook repository into developer mode? y/n " yn
case $yn in
[Yy]* ) break;;
[Nn]* ) exit;;
* ) echo "Please answer yes or no.";;
esac
done
# git setup
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
git fetch --unshallow
git submodule foreach --recursive 'git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"'
git submodule foreach --recursive 'git fetch --unshallow'
# config setup
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
configfile="$DIR/updater-preferences"
. config.shlib
cfg_write $configfile update_channel developer
while true; do
read -p "Would you like to reset your repository to the origin/master branch? y/n " yn
case $yn in
[Yy]* ) break;;
[Nn]* ) exit;;
* ) echo "Please answer yes or no.";;
esac
done
# more git setup
git reset --hard origin/master
git submodule foreach --recursive 'git reset --hard'
git submodule sync
git submodule update --init --recursive