-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
42 lines (36 loc) · 1.7 KB
/
install.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
#!/bin/bash
# Copyright (C) 2021 Hasan CALISIR <[email protected]>
# Distributed under the GNU General Public License, version 2.0.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Wrapper script for Nginx FastCGI Cache Purge & Preload Plugin for Wordpress
# URL to download the script
URL="https://psaux-it.github.io/fastcgi_ops_root.sh"
MAIN_SCRIPT="fastcgi_ops_root.sh"
# Function to check for curl and wget, and download the main script using the available tool
download_and_execute_fastcgi_ops_root() {
if [[ -f "${MAIN_SCRIPT}" ]]; then
rm -f "${MAIN_SCRIPT}"
fi
if command -v curl > /dev/null 2>&1; then
curl -Ss "${URL}" -o "${MAIN_SCRIPT}" && chmod +x "${MAIN_SCRIPT}" && bash "${MAIN_SCRIPT}"
elif command -v wget > /dev/null 2>&1; then
wget -q "${URL}" -O "${MAIN_SCRIPT}" && chmod +x "${MAIN_SCRIPT}" && bash "${MAIN_SCRIPT}"
else
echo -e "\e[91mError:\e[0m \e[93mcurl\e[0m \e[96mor \e[93mwget\e[0m \e[96mis not installed or not found in PATH.\e[0m"
exit 1
fi
}
# Call the function to download and execute the main script
download_and_execute_fastcgi_ops_root