-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGIT-Remote-Set.sh
65 lines (57 loc) · 2.27 KB
/
GIT-Remote-Set.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/bash
#
fs=$(grep "/dev/root" /proc/mounts | sed -n 's/.*\(r[ow]\).*/\1/p')
#rpi-rw
if [ "$fs" == "ro" ]; then
sudo mount -o remount,rw / # sudo mount -o remount,rw /boot
fi
#
pgit=${1:-andy}
pgit=${pgit,,[A-Z]}
pgit=${pgit/andy/AndyTaylorTweet}
pgit=${pgit/mw0mwz/AndyTaylorTweet}
pgit=${pgit/mark/kn2tod}
echo ${pgit}
# set to make repos updatable
if ! grep -q 'safe' /root/.gitconfig > /dev/null 2<&1 ; then
git config --global --add safe.directory /usr/local/sbin > /dev/null 2<&1
git config --global --add safe.directory /usr/local/bin > /dev/null 2<&1
git config --global --add safe.directory /var/www/dashboard > /dev/null 2<&1
fi
# check if 4.1.6 or greater?
# show-only option? diff display option?
# recycle tasks after switch?
echo === /usr/local/sbin: =================================================================
cd /usr/local/sbin
#sudo git remote show origin https://github.com/${pgit}/Pi-Star_Binaries_sbin.git
sudo git remote set-url origin https://github.com/${pgit}/Pi-Star_Binaries_sbin.git
#sudo git pull origin master
sudo git fetch origin
sudo git checkout master
sudo git reset --hard origin/master
echo === /usr/local/bin: ==================================================================
cd /usr/local/bin
#sudo git remote show origin https://github.com/${pgit}/Pi-Star_v4_Binaries_Bin.git
sudo git remote set-url origin https://github.com/${pgit}/Pi-Star_v4_Binaries_Bin.git
#sudo git pull origin master
sudo git fetch origin
sudo git checkout master
sudo git reset --hard origin/master
echo === /var/www/dashboard: ==============================================================
cd /var/www/dashboard
#sudo git remote show origin https://github.com/${pgit}/Pi-Star_DV_Dash.git
sudo git remote set-url origin https://github.com/${pgit}/Pi-Star_DV_Dash.git
sudo git stash push -m "save Pi-Star user config files" -- config/config.php config/ircddblocal.php config/language.php
#sudo git pull origin master
sudo git fetch origin
sudo git checkout master
sudo git reset --hard origin/master
sudo git stash pop
echo ======================================================================================
#if [ "${pgit}" == "kn2tod" ]; then
# sudo pistar-upgrade
#fi
#rpi-ro
if [ "$fs" == "ro" ]; then
sudo mount -o remount,ro / # sudo mount -o remount,ro /boot
fi