-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDebianOCS-Plugin
53 lines (47 loc) · 1.32 KB
/
DebianOCS-Plugin
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
#!/bin/bash
# Simple OCS Panel plugin script
# by Bon-chan
#######
#######
## Config ##
############
# Panel Directory
myDir='/home/panel/html' # Avoid Backslashes
# OCS Panel source code link
# Must be a valid ocs panel zipfile
mySrc='https://dropbox.com/testfile.zip'
############
############
if [[ $EUID -ne 0 ]]; then
echo -e "[\e[31mError\e[0m] This script must be run as root, exiting..."
exit 1
fi
source /etc/os-release
if [[ "$ID" != 'debian' ]]; then
echo -e "[\e[31mError\e[0m] This script is for Debian instance only, exiting..."
exit 1
elif [[ "$VERSION_ID" != '9' ]]; then
echo -e "[\e[31mError\e[0m] This script is for Debian Stretch distribution only, exiting..."
exit 1
fi
if [[ ! -e "$myDir" ]]; then
echo -e "[\e[31mError\e[0m] Panel's Directory not found, exiting..."
exit 1
fi
srcStats="$(wget --spider -4qS "$mySrc" 2>&1 | grep "HTTP/" | awk '{print $2}')"
if [[ "$srcStats" != '200' ]]; then
echo -e "[\e[31mError\e[0m] Source code Download failed.\n Error code: \e[1;31m$srcStats\e[0m"
exit 1
fi
cd "$myDir"
wget -4O src.zip "$mySrc"
unzip -qq src.zip && rm -f src.zip
if [[ ! -e "$myDir/installation" ]]; then
echo -e "[\e[31mError\e[0m] Source code you provided is not a valid OCS Panel src, exiting..."
exit 1
cd -
fi
cd -
echo -e "\n\n Default Panel source code replaced successfully\n"
echo -e ""
exit 1