-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathupdate.sh
147 lines (119 loc) · 5.49 KB
/
update.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#!/bin/bash
#
# Title: PTS major file
# org.Author(s): Admin9705 - Deiteq
# Mod from MrDoob for PTS
# GNU: General Public License v3.0
################################################################################
sudocheck() {
if [[ $EUID -ne 0 ]]; then
tee <<-EOF
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⛔️ You Must Execute as a SUDO USER (with sudo) or as ROOT!
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
EOF
exit 0
fi
}
base() {
rm -rf /opt/pgstage && mkdir -p /opt/pgstage 1>/dev/null 2>&1
ansible-playbook /opt/ptsupdate/stage/pgstage.yml 1>/dev/null 2>&1
}
mainstart() {
file="/opt/pgstage/place.holder"
waitvar=0
while [ "$waitvar" == "0" ]; do
sleep .5
if [ -e "$file" ]; then waitvar=1; fi
done
pgnumber=$(cat /var/plexguide/pg.number)
versions=$(cat /opt/pgstage/versions.sh)
release="$(curl -s https://api.github.com/repos/PTS-Team/PTS-Team/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")')"
tee <<-EOF
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📂 Update Interface
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
$versions
Installed : $pgnumber
[Z] Exit
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
EOF
break=no
read -p '🌍 TYPE Version | PRESS ENTER: ' typed
storage=$(grep $typed /opt/pgstage/versions.sh)
parttwo
}
parttwo() {
if [[ "$typed" == "exit" || "$typed" == "Exit" || "$typed" == "EXIT" || "$typed" == "z" || "$typed" == "Z" ]]; then
echo ""
touch /var/plexguide/exited.upgrade
exit
fi
if [ "$storage" != "" ]; then
break=yes
echo -e $storage >/var/plexguide/pg.number
ansible-playbook /opt/ptsupdate/version/choice.yml
tee <<-EOF
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✅️ SYSTEM MESSAGE: Installing Version - $typed - Standby!
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
EOF
sleep 2
file="/var/plexguide/community.app"
if [ -e "$file" ]; then rm -rf /var/plexguide/community.app; fi
else
tee <<-EOF
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⛔️ SYSTEM MESSAGE: Version $typed does not exist! - Standby!
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
EOF
sleep 2
mainstart
fi
}
ende() {
alias 1>/dev/null 2>&1
remove 1>/dev/null 2>&1
redit 1>/dev/null 2>&1
owned 1>/dev/null 2>&1
cleartabs
check
}
########end funtions // execute commands
badinput() {
echo
read -p '⛔️ ERROR - Bad Input! | Press [ENTER] ' typed </dev/tty
}
alias() {
ansible-playbook /opt/plexguide/menu/alias/alias.yml
}
remove() {
ansible-playbook /opt/plexguide/menu/pg.yml --tag remove
}
cleartabs() {
truncate -s 0 /var/plexguide/logs/*
}
redit() {
canonical-livepatch disable
disable-livepatch -r
}
owned() {
chown -cR 1000:1000 /opt/plexguide
chmod -R 775 /opt/plexguide
}
check() {
bash /opt/plexguide/menu/interface/ending.sh
file="/opt/plexguide/menu/pg.yml"
if [[ -f $file ]]; then
printf '
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✅ All files Valid and > PTS is up to date <
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
'
printf '
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✅ All files Valid and > PTS is up to date <
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
' >>/var/plexguide/logs/pg.log
else ansible-playbook /opt/plexguide/menu/version/missing_pull.yml; fi
}