Skip to content

Commit 52cf8bd

Browse files
authored
Script Improvements
1 parent e32bf0b commit 52cf8bd

10 files changed

Lines changed: 107 additions & 33 deletions

File tree

scripts/install/nginx/nginx-brotli.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,12 @@ cd /usr/src
2727

2828
# Brotli
2929

30+
# Remove existing ngx_brotli directory if it exists
31+
if [ -d "/usr/src/ngx_brotli" ]; then
32+
rm -rf /usr/src/ngx_brotli
33+
fi
34+
3035
# Git Clone
31-
rm -rf /usr/src/ngx_brotli
3236
git clone --recurse-submodules --remote-submodules https://github.com/google/ngx_brotli.git /usr/src/ngx_brotli
3337
cd /usr/src/ngx_brotli
3438
git submodule update --init

scripts/install/nginx/nginx-create-directories.sh

Lines changed: 43 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,46 @@ fi
2222
#----------------------------------------------------------------------------------
2323
# Start Main Script
2424

25-
# Create Nginx Directories
26-
mkdir -p /etc/nginx/custom-global-directives
27-
mkdir -p /etc/nginx/custom-single-domain-directives
28-
mkdir -p /etc/nginx/globals
29-
mkdir -p /etc/nginx/restricted-access
30-
mkdir -p /etc/nginx/sites-available
31-
mkdir -p /etc/nginx/sites-enabled
32-
mkdir -p /etc/nginx/ssl/cloudflare
33-
mkdir -p /etc/nginx/ssl/dhe
34-
mkdir -p /etc/nginx/ssl/localhost
35-
mkdir -p /usr/lib/nginx/modules
36-
mkdir -p /tmp/nginx_proxy
37-
mkdir -p /var/cache/nginx
38-
mkdir -p /var/lib/nginx/body
39-
mkdir -p /var/lib/nginx/fastcgi
40-
mkdir -p /var/lib/nginx/proxy
41-
mkdir -p /var/log/domains
42-
mkdir -p /var/www/admin/enginescript
43-
mkdir -p /var/www/sites
25+
# Create Nginx Directories with error handling
26+
DIRS=(
27+
"/etc/nginx/custom-global-directives"
28+
"/etc/nginx/custom-single-domain-directives"
29+
"/etc/nginx/globals"
30+
"/etc/nginx/restricted-access"
31+
"/etc/nginx/sites-available"
32+
"/etc/nginx/sites-enabled"
33+
"/etc/nginx/ssl/cloudflare"
34+
"/etc/nginx/ssl/dhe"
35+
"/etc/nginx/ssl/localhost"
36+
"/usr/lib/nginx/modules"
37+
"/tmp/nginx_proxy"
38+
"/var/cache/nginx"
39+
"/var/lib/nginx/body"
40+
"/var/lib/nginx/fastcgi"
41+
"/var/lib/nginx/proxy"
42+
"/var/log/domains"
43+
"/var/www/admin/enginescript"
44+
"/var/www/sites"
45+
)
46+
47+
for DIR in "${DIRS[@]}"; do
48+
mkdir -p "${DIR}" || { echo "Error: Failed to create directory ${DIR}"; exit 1; }
49+
done
50+
51+
for DIR in "${DIRS[@]}"; do
52+
if [ -d "${DIR}" ]; then
53+
echo "Directory ${DIR} already exists. Skipping."
54+
else
55+
mkdir -p "${DIR}" || { echo "Error: Failed to create directory ${DIR}"; exit 1; }
56+
echo "Created directory: ${DIR}"
57+
fi
58+
done
59+
60+
# Summary
61+
echo "----------------------------------------------------------"
62+
echo "Nginx directory creation completed successfully."
63+
echo "Directories created or verified:"
64+
for DIR in "${DIRS[@]}"; do
65+
echo " - ${DIR}"
66+
done
67+
echo "----------------------------------------------------------"

scripts/install/nginx/nginx-download.sh

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,24 @@ fi
2323
# Start Main Script
2424

2525
cd /usr/src
26-
rm -rf /usr/src/nginx-${NGINX_VER}
27-
wget https://nginx.org/download/nginx-${NGINX_VER}.tar.gz -O /usr/src/nginx-${NGINX_VER}.tar.gz --no-check-certificate && tar -xzvf /usr/src/nginx-${NGINX_VER}.tar.gz
28-
wget https://github.com/openresty/headers-more-nginx-module/archive/v${NGINX_HEADER_VER}.tar.gz -O /usr/src/v${NGINX_HEADER_VER}.tar.gz --no-check-certificate && tar -xzf /usr/src/v${NGINX_HEADER_VER}.tar.gz
29-
wget https://github.com/nginx-modules/ngx_cache_purge/archive/${NGINX_PURGE_VER}.tar.gz -O /usr/src/${NGINX_PURGE_VER}.tar.gz --no-check-certificate && tar -xzf /usr/src/${NGINX_PURGE_VER}.tar.gz
30-
wget https://github.com/openssl/openssl/releases/download/openssl-${OPENSSL_VER}/openssl-${OPENSSL_VER}.tar.gz -O /usr/src/openssl-${OPENSSL_VER}.tar.gz --no-check-certificate && tar -xzf /usr/src/openssl-${OPENSSL_VER}.tar.gz
26+
27+
# Remove existing Nginx source directory if it exists
28+
if [ -d "/usr/src/nginx-${NGINX_VER}" ]; then
29+
rm -rf /usr/src/nginx-${NGINX_VER}
30+
fi
31+
32+
# Download and extract Nginx
33+
wget https://nginx.org/download/nginx-${NGINX_VER}.tar.gz -O /usr/src/nginx-${NGINX_VER}.tar.gz --no-check-certificate || { echo "Error: Failed to download Nginx."; exit 1; }
34+
tar -xzvf /usr/src/nginx-${NGINX_VER}.tar.gz || { echo "Error: Failed to extract Nginx."; exit 1; }
35+
36+
# Download and extract Headers More module
37+
wget https://github.com/openresty/headers-more-nginx-module/archive/v${NGINX_HEADER_VER}.tar.gz -O /usr/src/v${NGINX_HEADER_VER}.tar.gz --no-check-certificate || { echo "Error: Failed to download Headers More module."; exit 1; }
38+
tar -xzf /usr/src/v${NGINX_HEADER_VER}.tar.gz || { echo "Error: Failed to extract Headers More module."; exit 1; }
39+
40+
# Download and extract Cache Purge module
41+
wget https://github.com/nginx-modules/ngx_cache_purge/archive/${NGINX_PURGE_VER}.tar.gz -O /usr/src/${NGINX_PURGE_VER}.tar.gz --no-check-certificate || { echo "Error: Failed to download Cache Purge module."; exit 1; }
42+
tar -xzf /usr/src/${NGINX_PURGE_VER}.tar.gz || { echo "Error: Failed to extract Cache Purge module."; exit 1; }
43+
44+
# Download and extract OpenSSL
45+
wget https://github.com/openssl/openssl/releases/download/openssl-${OPENSSL_VER}/openssl-${OPENSSL_VER}.tar.gz -O /usr/src/openssl-${OPENSSL_VER}.tar.gz --no-check-certificate || { echo "Error: Failed to download OpenSSL."; exit 1; }
46+
tar -xzf /usr/src/openssl-${OPENSSL_VER}.tar.gz || { echo "Error: Failed to extract OpenSSL."; exit 1; }

scripts/install/tools/media/zimageoptimizer.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,12 @@ fi
2525
# Return to /usr/src
2626
cd /usr/src
2727

28+
# Remove existing zImageOptimizer directory if it exists
29+
if [ -d "/usr/local/bin/zimageoptimizer" ]; then
30+
rm -rf /usr/local/bin/zimageoptimizer
31+
fi
32+
2833
# Install zImageOptimizer
29-
rm -rf /usr/local/bin/zimageoptimizer
3034
git clone --depth 1 https://github.com/zevilz/zImageOptimizer.git -b master /usr/local/bin/zimageoptimizer
3135
find /usr/local/bin/zimageoptimizer -type d,f -exec chmod 755 {} \;
3236

scripts/install/tools/php/opcache-gui.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,12 @@ fi
2525
# Return to /usr/src
2626
cd /usr/src
2727

28+
# Remove existing OpCache-GUI directory if it exists
29+
if [ -d "/var/www/admin/enginescript/opcache-gui" ]; then
30+
rm -rf /var/www/admin/enginescript/opcache-gui
31+
fi
32+
2833
# OpCache-GUI
29-
rm -rf /var/www/admin/enginescript/opcache-gui
3034
git clone --depth 1 https://github.com/amnuts/opcache-gui.git /var/www/admin/enginescript/opcache-gui
3135

3236
# Return to /usr/src

scripts/install/tools/security/php-malware-finder.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,12 @@ fi
2626
cd /usr/src
2727

2828
# PHP Malware Finder
29-
rm -rf /usr/local/bin/php-malware-finder
29+
# Remove existing ngx_brotli directory if it exists
30+
if [ -d "/usr/local/bin/php-malware-finder" ]; then
31+
rm -rf /usr/local/bin/php-malware-finder
32+
fi
33+
34+
# Clone the PHP Malware Finder repository
3035
git clone https://github.com/nbs-system/php-malware-finder.git /usr/local/bin/php-malware-finder
3136

3237
echo ""

scripts/install/tools/system/admin-control-panel.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,12 @@ fi
2626
cd /usr/src
2727

2828
# phpSysinfo
29-
rm -rf /var/www/admin/enginescript/phpsysinfo
29+
# Remove existing phpSysinfo directory if it exists
30+
if [ -d "/var/www/admin/enginescript/phpsysinfo" ]; then
31+
rm -rf /var/www/admin/enginescript/phpsysinfo
32+
fi
33+
34+
# Clone phpSysinfo
3035
git clone --depth 1 https://github.com/phpsysinfo/phpsysinfo.git /var/www/admin/enginescript/phpsysinfo
3136
cp -rf /usr/local/bin/enginescript/config/var/www/admin/phpsysinfo/phpsysinfo.ini /var/www/admin/enginescript/phpsysinfo/phpsysinfo.ini
3237
sed -i "s|SEDPHPVER|${PHP_VER}|g" /var/www/admin/enginescript/phpsysinfo/phpsysinfo.ini

scripts/install/tools/system/testssl-install.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@ fi
2525
# Return to /usr/src
2626
cd /usr/src
2727

28-
# Remove Old Version
29-
rm -rf /usr/local/bin/testssl.sh
28+
# Remove existing Testssl.sh directory if it exists
29+
if [ -d "/usr/local/bin/testssl.sh" ]; then
30+
rm -rf /usr/local/bin/testssl.sh
31+
fi
3032

3133
# Install Testssl.sh
3234
git clone https://github.com/testssl/testssl.sh.git /usr/local/bin/testssl.sh

scripts/install/zlib/zlib-install.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,12 @@ fi
2626
cd /usr/src
2727

2828
# Cloudflare zlib Download
29-
rm -rf /usr/src/zlib-cf
29+
# Remove existing Zlib-CF directory if it exists
30+
if [ -d "/usr/src/zlib-cf" ]; then
31+
rm -rf /usr/src/zlib-cf
32+
fi
33+
34+
# Clone Zlib-CF
3035
git clone --depth 1 https://github.com/cloudflare/zlib.git -b gcc.amd64 /usr/src/zlib-cf
3136
cd /usr/src/zlib-cf
3237
sudo ./configure --prefix=path \

setup.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,13 @@ apt upgrade -y
8080
# Return to /usr/src
8181
cd /usr/src
8282

83+
84+
# Remove existing EngineScript directory if it exists
85+
if [ -d "rm -rf /usr/local/bin/enginescript" ]; then
86+
rm -rf rm -rf /usr/local/bin/enginescript
87+
fi
88+
8389
# EngineScript Git Clone
84-
rm -rf /usr/local/bin/enginescript
8590
git clone --depth 1 https://github.com/EngineScript/EngineScript.git -b master /usr/local/bin/enginescript
8691

8792
# EngineScript Permissions

0 commit comments

Comments
 (0)