-
Notifications
You must be signed in to change notification settings - Fork 1
/
sourceguardian.sh
92 lines (70 loc) · 3.12 KB
/
sourceguardian.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
#!/bin/bash
# by Aria ;)
clear
version="$(curl https://aria.ws/sg.php)";
do_update_ini() {
INI_DIR="/usr/local/${1}/lib/php.conf.d";
INI_FILE="${INI_DIR}/99-custom.ini";
[ -f "${INI_FILE}" ] || INI_FILE="/usr/local/${1}/lib/php.conf.d/90-custom.ini";
ROW="zend_extension = /usr/local/sourceguardian/${2}";
if [[ -f "${INI_FILE}" ]]; then
grep -m1 -q "^${ROW}" "${INI_FILE}" >/dev/null 2>&1 || echo "${ROW}" >> ${INI_FILE};
echo "Sourceguardian was already installed in PHP ${3}"
else
# Create the file if the directory exists
if [[ -d "$INI_DIR" ]]; then
touch ${INI_FILE}
grep -m1 -q "^${ROW}" "${INI_FILE}" >/dev/null 2>&1 || echo "${ROW}" >> ${INI_FILE};
echo "Sourceguardian is installed for PHP ${3}"
fi
fi
}
if [[ -d "/usr/local/sourceguardian/" ]]; then
do_update_ini php56 ixed.5.6.lin 5.6
do_update_ini php72 ixed.7.2.lin 7.2
do_update_ini php73 ixed.7.3.lin 7.3
do_update_ini php74 ixed.7.4.lin 7.4
do_update_ini php80 ixed.8.0.lin 8.0
do_update_ini php81 ixed.8.1.lin 8.1
if grep -q $version "/usr/local/sourceguardian/version"; then
echo -e "\nSourceguardian is updated.\n";
else
echo $version > /usr/local/sourceguardian/version
echo -e "\nA new Sourceguardian version has been released : $version\n";
echo -e "Sourceguardian download started.\n";
mkdir -p /usr/local/sourceguardian/ > /dev/null 2>&1;
echo "Create directory sourceguardian";
curl --output /usr/local/sourceguardian/loaders.linux-x86_64.tar.gz https://www.sourceguardian.com/loaders/download/loaders.linux-x86_64.tar.gz > /dev/null 2>&1;
echo "Download loader from sourceguardian";
tar -xzf /usr/local/sourceguardian/loaders.linux-x86_64.tar.gz --directory /usr/local/sourceguardian/ > /dev/null 2>&1;
echo "Extract loader file sourceguardian";
chown -R root:root /usr/local/sourceguardian/
echo "Change owner directory and file sourceguardian";
chmod -R 0755 /usr/local/sourceguardian/
echo "Change permission directory and file sourceguardian";
sleep 2;
echo -e "\nSourceguardian were downloaded.\n";
fi
else
echo -e "Sourceguardian download started.\n";
mkdir -p /usr/local/sourceguardian/ > /dev/null 2>&1;
echo "Create directory sourceguardian";
curl --output /usr/local/sourceguardian/loaders.linux-x86_64.tar.gz https://www.sourceguardian.com/loaders/download/loaders.linux-x86_64.tar.gz > /dev/null 2>&1;
echo "Download loader from sourceguardian";
tar -xzf /usr/local/sourceguardian/loaders.linux-x86_64.tar.gz --directory /usr/local/sourceguardian/ > /dev/null 2>&1;
echo "Extract loader file sourceguardian";
chown -R root:root /usr/local/sourceguardian/
echo "Change owner directory and file sourceguardian";
chmod -R 0755 /usr/local/sourceguardian/
echo "Change permission directory and file sourceguardian";
sleep 2;
echo -e "\nSourceguardian were downloaded.\n";
echo -e "Sourceguardian install started.\n";
do_update_ini php56 ixed.5.6.lin 5.6
do_update_ini php72 ixed.7.2.lin 7.2
do_update_ini php73 ixed.7.3.lin 7.3
do_update_ini php74 ixed.7.4.lin 7.4
do_update_ini php80 ixed.8.0.lin 8.0
do_update_ini php81 ixed.8.1.lin 8.1
echo -e "\nSourceguardian were installed.\n";
fi