forked from HawksRepos/Install
-
Notifications
You must be signed in to change notification settings - Fork 18
/
install.sh.old
247 lines (216 loc) · 14.1 KB
/
install.sh.old
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
#!/bin/bash
###############################################################################
# Title: PTS Base installer
# Coder : MrDoob PTS Main Developer
# GNU: General Public License v3.0E
#
################################################################################
#function
logfile=/var/log/log-install.txt
package_list="curl wget software-properties-common git zip unzip dialog sudo nano htop mc lshw ansible fortune intel-gpu-tools python-apt lolcat figlet"
tee <<-EOF
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🌎 INSTALLING: PTS Notice
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
By installing, you agreeing to the terms and conditions of the GNUv3 License!
Everyone is welcome and everyone can help make it better,
so we like to greet you as a new / old user
┌─────────────────────────────────────┐
│ │
│ Thanks to: │
│ │
│ Davaz, Deiteq, FlickerRate, │
│ ClownFused, MrDoob, Sub7Seven, │
│ TimeKills, The_Creator, Desimaniac, │
│ l3uddz, RXWatcher, Calmcacil, │
│ ΔLPHΔ , Maikash , Porkie │
│ CDN_RAGE , hawkinzzz , The_Deadpool │
│ BugHunter : Krallenkiller │
│ │
│ and all other guys │
│ │
│ @TheShadow you are welcome │
└─────────────────────────────────────┘
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
EOF
sleep 3
#check it is being run as root
if [ "$(id -u)" != "0" ]; then
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
echo " ⛔ Warning! "
echo " ⛔ Warning! insufficient permission "
echo " ⛔ Warning! "
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" && exit 1
fi
##check for open port ( apache and Nginx test )
apt-get install lsof -yqq >/dev/null 2>&1
export DEBIAN_FRONTEND=noninteractive
tee <<-EOF
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⌛ PTS is now checking for existing Webserver is running - Standby
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
EOF
if lsof -Pi :80 -sTCP:LISTEN -t >/dev/null 2>&1 ; then
service apache2 stop >/dev/null 2>&1
service nginx stop >/dev/null 2>&1
apt-get purge apache nginx -yqq >/dev/null 2>&1
apt-get autoremove -yqq >/dev/null 2>&1
apt-get autoclean -yqq >/dev/null 2>&1
elif lsof -Pi :443 -sTCP:LISTEN -t >/dev/null 2>&1 ; then
service apache2 stop >/dev/null 2>&1
service nginx stop >/dev/null 2>&1
apt-get purge apache nginx -yqq >/dev/null 2>&1
apt-get autoremove -yqq >/dev/null 2>&1
apt-get autoclean -yqq >/dev/null 2>&1
else echo "" ; fi
tee <<-EOF
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✅ PASSED ! PTS checked and there's no existing Webserver !
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
EOF
sleep 5
tee <<-EOF
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⌛ Base Install - Standby || This can take some minutes
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
EOF
apt-get install lsb-release -yqq >/dev/null 2>&1
export DEBIAN_FRONTEND=noninteractive
apt-get install software-properties-common -yqq >/dev/null 2>&1
export DEBIAN_FRONTEND=noninteractive
osname=$(lsb_release -si)
hostname=$(hostname -I | awk '{print $1}')
versioncheck=$(cat /etc/*-release | grep "Ubuntu" | grep -E '19')
if [ "$versioncheck" == "19" ]; then
tee <<-EOF
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⛔ Woah! ...... System Warning! Be Aware!
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Supported: UBUNTU 16.xx - 18.10 ~ LTS/SERVER and Debian 9.* / 10
This server may not be supported due to having the incorrect OS detected!
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
EOF
exit 0
else echo "" ; fi
# add repo
touch /var/log/osname.log
echo $osname >>/var/log/osname.log
oo=$(tail -n 1 /var/log/osname.log)
if [ $(lsb_release -si) == "Debian" ]; then
add-apt-repository main >/dev/null 2>&1
add-apt-repository non-free >/dev/null 2>&1
add-apt-repository contrib >/dev/null 2>&1
wget -qN https://raw.githubusercontent.com/PTS-Team/Install/master/source/ansible-debian-ansible.list /etc/apt/sources.list.d/
elif [ $(lsb_release -si) == "Ubuntu" ]; then
add-apt-repository main >/dev/null 2>&1
add-apt-repository universe >/dev/null 2>&1
add-apt-repository restricted >/dev/null 2>&1
add-apt-repository multiverse >/dev/null 2>&1
apt-add-repository --yes --update ppa:ansible/ansible >/dev/null 2>&1
elif [ $oo == "Rasbian" || $oo =="Fedora" || $oo == "CentOS" ]; then
tee <<-EOF
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⛔ Woah! ...... System Warning!
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Supported: UBUNTU 16.xx - 18.10 ~ LTS/SERVER and Debian 9.*
This server may not be supported due to having the incorrect OS detected!
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
EOF
exit 0
sleep 2
fi
apt-get update -yqq >/dev/null 2>&1
export DEBIAN_FRONTEND=noninteractive
apt-get upgrade -yqq >/dev/null 2>&1
export DEBIAN_FRONTEND=noninteractive
apt-get dist-upgrade -yqq >/dev/null 2>&1
export DEBIAN_FRONTEND=noninteractive
apt-get autoremove -yqq >/dev/null 2>&1
export DEBIAN_FRONTEND=noninteractive
apt-get install $package_list -yqq >/dev/null 2>&1
export DEBIAN_FRONTEND=noninteractive
tee <<-EOF
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✅ PASSED - PTS has updated your System !
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
EOF
sleep 5
# Delete If it Exist for Cloning
if [ -e "/opt/plexguide" ]; then rm -rf /opt/plexguide; fi
if [ -e "/opt/pgstage" ]; then rm -rf /opt/pgstage; fi
rm -rf /opt/pgstage/place.holder >/dev/null 2>&1
##fast change the editions
edition=master
##fast change the editions
git clone -b $edition --single-branch https://github.com/MHA-Team/Install.git /opt/pgstage 1>/dev/null 2>&1
git clone https://github.com/MHA-Team/PTS-Update.git /opt/ptsupdate 1>/dev/null 2>&1
mkdir -p /var/plexguide/logs
echo "" >/var/plexguide/server.ports
echo "51" >/var/plexguide/pg.pythonstart
touch /var/plexguide/pg.pythonstart.stored
start=$(cat /var/plexguide/pg.pythonstart)
stored=$(cat /var/plexguide/pg.pythonstart.stored)
if [ "$start" != "$stored" ]; then
bash /opt/pgstage/pyansible.sh 1>/dev/null 2>&1
fi
echo "51" >/var/plexguide/pg.pythonstart.stored
#pip upgrade
pip install --upgrade pip 1>/dev/null 2>&1
echo "PIP updated"
ansible-playbook /opt/pgstage/folders/folder.yml
ansible-playbook /opt/pgstage/clone.yml
ansible-playbook /opt/plexguide/menu/alias/alias.yml
ansible-playbook /opt/plexguide/menu/motd/motd.yml
ansible-playbook /opt/plexguide/menu/pg.yml --tags journal,system,rcloneinstall,mergerfsinstall
if [ -e "/bin/pts" ]; then
printf '
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⌛ Verifiying PTS Install @ /bin/pts - Standby!
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
'
else
printf '
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⛔ WARNING! Installed Failed! PTS Installer Failed !
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
We are happy to do this for you again automatically
We are doing this to ensure that your installation continues to work!
Please wait one moment, while PTS now checks and set everything up for you!
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
'
read -p 'Confirm Info | PRESS [ENTER] ' typed </dev/tty
sudo rm -rf /opt/plexguide
sudo git clone https://github.com/MHA-Team/PTS-Team.git /opt/plexguide
sudo chown -cR 1000:1000 /opt/plexguide
sudo chmod -cR 775 /opt/plexguide
sudo ptsupdate
fi
chk=$(figlet "<<< P T S >>>" | lolcat)
tee <<-EOF
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
$chk
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✅️ PASSED! The PTS is now Installed!
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✅ PASSED ! Operations System : $(lsb_release -sd)
✅ PASSED ! Processor : $(lshw -class processor | grep "product" | awk '{print $2,$3,$4,$5,$6,$7,$8,$9}')
✅ PASSED ! CPUs : $(lscpu | grep "CPU(s):" | tail +1 | head -1 | awk '{print $2}')
✅ PASSED ! IP from Server : $hostname
✅ PASSED ! HDD Space : $(df -h / --total --local -x tmpfs | grep 'total' | awk '{print $2}')
✅ PASSED ! RAM Space : $(free -m | grep Mem | awk 'NR=1 {print $2}') MB
✅ PASSED ! Logfile : $logfile
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
EOF
touch /var/plexguide/new.install
sleep 2
printf '
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
↘️ Start AnyTime By Typing >>> sudo pts
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
↘️ Want to add an USER with UID 1000 type
↘️ sudo ptsadd
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
'
echo ""