forked from HawksRepos/Install
-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathrelocate.sh
100 lines (93 loc) · 4.85 KB
/
relocate.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/bin/bash
###############################################################################
# Title: PTS Relocate Repositories
# Coder: iDoMnCi
# GNU: General Public License v3.0E
#
################################################################################
### FUNCTIONS START #####################################################
###################################
old=https://github.com/PTS-Team/
new=https://github.com/MHA-Team/
sudocheck() {
if [[ $EUID -ne 0 ]]; then
tee <<-EOF
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⛔️ You Must Execute as a SUDO USER (with sudo) or as ROOT!
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
EOF
exit 0
fi
}
agreebase() {
tee <<-EOF
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⛔️ READ THIS NOTE
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
This script is for use of moving from /PTS-Team/ to /MHA-Team/ Github
repository. This should only be executed if you are currently on the old
/PTS-Team/ repo. If you are unsure running this script should do not harm
if you're already on the right repo.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
EOF
timer
}
timer() {
seconds=5; date1=$((`date +%s` + $seconds));
while [ "$date1" -ge `date +%s` ]; do
echo -ne "$(date -u --date @$(($date1 - `date +%s` )) +%H:%M:%S)\r";
done
}
existpg() {
file="/opt/plexguide/menu/pg.yml"
if [[ -f $file ]]; then
confirmEdits
else nopg ; fi
}
confirmEdits() {
echo
read -p '⛔️ BEGIN Migraton? | Press [ENTER] to Start ' typed </dev/tty
updaterepos
}
updaterepos() {
updatefiles
tee <<-EOF
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✅ Migration Complete!
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
You have successfully migrated to the /MHA-Team/ project repository.
Running ptsupdate should now work along with any redeployment of
traefik, shield, clone and so forth.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
EOF
}
updatefiles() {
tee <<-EOF
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⛔️ Starting Search & Replace
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
EOF
cd /bin
find . -type f -print0 | xargs -0 grep -l -r "$old" |tee /dev/tty | xargs sed -i "s+${old}+${new}+g"
echo
read -p '✅ | /bin Files Updated | Press [ENTER] to Continue ' typed </dev/tty
sleep 0.5
cd /var/plexguide
find . -type f -print0 | xargs -0 grep -l -r "$old" |tee /dev/tty | xargs sed -i "s+${old}+${new}+g"
echo
read -p '✅ | /var/plexguide Files Updated | Press [ENTER] to Continue ' typed </dev/tty
sleep 0.5
cd /opt
find . -type f -print0 | xargs -0 grep -l -r "$old" |tee /dev/tty | xargs sed -i "s+${old}+${new}+g"
echo
read -p '✅ | /opt Files Updated | Press [ENTER] to Continue ' typed </dev/tty
}
doneokay() {
echo
read -p 'Confirm Info | PRESS [ENTER] ' typed </dev/tty
}
### FUNCTIONS END #####################################################
#### function layout for order one by one
sudocheck
agreebase
existpg