blank
Now we are sure every file is removed when empty.
This commit is contained in:
parent
438bf832bb
commit
0bd87a4969
8 changed files with 37 additions and 37 deletions
6
lib/bkp
6
lib/bkp
|
@ -223,7 +223,7 @@ check_duply_profile() {
|
|||
|
||||
|
||||
bkp_s3_profile() {
|
||||
if [[ ! -s $HOME/.aws/credentials && $(conf_read awsiamrole) != true ]]; then
|
||||
if [[ ! -f $HOME/.aws/credentials || ( -f $HOME/.aws/credentials && ( ! -s $HOME/.aws/credentials || -z $(grep '[^[:space:]]' $HOME/.aws/credentials ))) && $(conf_read awsiamrole) != true ]]; then
|
||||
echo "${red}[ERROR] AWS S3 Credentials not found!${end}"
|
||||
exit 1
|
||||
fi
|
||||
|
@ -403,7 +403,7 @@ bkp_s3_list() {
|
|||
|
||||
|
||||
s3_send() {
|
||||
if [[ ! -s $HOME/.aws/credentials && $(conf_read awsiamrole) != true ]]; then
|
||||
if [[ ! -f $HOME/.aws/credentials || ( -f $HOME/.aws/credentials && ( ! -s $HOME/.aws/credentials || -z $(grep '[^[:space:]]' $HOME/.aws/credentials ))) && $(conf_read awsiamrole) != true ]]; then
|
||||
echo "${red}[ERROR] AWS S3 Credentials not found!${end}"
|
||||
exit 1
|
||||
fi
|
||||
|
@ -960,7 +960,7 @@ _EOF_
|
|||
|
||||
import_server() {
|
||||
[[ -z $file || $file == "true" ]] && read -p "${blu}Path file to import: ${end}" file
|
||||
if [[ ! -s $file ]]; then
|
||||
if [[ ! -f $file || ( -f $file && ( ! -s $file || -z $(grep '[^[:space:]]' $file ))) ]]; then
|
||||
echo "${red}[ERROR] File not found or empty!${end}"
|
||||
exit 1
|
||||
elif ! [[ $import =~ ^(true|sites|stack|full)$ ]]; then
|
||||
|
|
|
@ -1801,7 +1801,7 @@ custom_cache_global() {
|
|||
[[ -n $skip_cache ]] && local value=$skip_cache
|
||||
|
||||
sudo sed -Ei "/^# Value: $(escaped_string $value)( .*)?$/,/^# CacheRuleEnd/{/.*/d}" $confile
|
||||
[[ ! -s $confile || -z $(grep '[^[:space:]]' $confile ) ]] && sudo rm $confile # Better because also check for files containing only empty-spaces!
|
||||
[[ -f $confile && ( ! -s $confile || -z $(grep '[^[:space:]]' $confile )) ]] && sudo rm $confile # Better because also check for files containing only empty-spaces!
|
||||
fi
|
||||
echo "${gre}Cache rule successfully removed!${end}"
|
||||
else
|
||||
|
|
12
lib/install
12
lib/install
|
@ -101,7 +101,7 @@ linux_optim() {
|
|||
# File directors for Nginx
|
||||
[[ ! -d /etc/systemd/system/nginx.service.d ]] && sudo mkdir /etc/systemd/system/nginx.service.d
|
||||
[[ ! -f /etc/systemd/system/nginx.service.d/nofile_limit.conf ]] && sudo touch /etc/systemd/system/nginx.service.d/nofile_limit.conf
|
||||
[[ ! -s /etc/systemd/system/nginx.service.d/nofile_limit.conf ]] && sudo echo "[Service]
|
||||
[[ ! -s /etc/systemd/system/nginx.service.d/nofile_limit.conf || -z $(grep '[^[:space:]]' /etc/systemd/system/nginx.service.d/nofile_limit.conf ) ]] && sudo echo "[Service]
|
||||
LimitNOFILE=$fd_per_process" >> /etc/systemd/system/nginx.service.d/nofile_limit.conf
|
||||
|
||||
# Disable Transparent Huge Pages
|
||||
|
@ -984,7 +984,7 @@ stack_builder() {
|
|||
echo | sudo add-apt-repository "deb https://nginx.org/packages/ubuntu/ $(check_osname) nginx"
|
||||
fi
|
||||
else
|
||||
[[ ! -s /usr/share/keyrings/nginx-archive-keyring.gpg ]] && sudo rm -rf /usr/share/keyrings/nginx-archive-keyring.gpg # Prevent issues!
|
||||
[[ -f /usr/share/keyrings/nginx-archive-keyring.gpg && ( ! -s /usr/share/keyrings/nginx-archive-keyring.gpg || -z $(grep '[^[:space:]]' /usr/share/keyrings/nginx-archive-keyring.gpg )) ]] && sudo rm -rf /usr/share/keyrings/nginx-archive-keyring.gpg # Prevent issues!
|
||||
[[ ! -f /usr/share/keyrings/nginx-archive-keyring.gpg ]] && wget -nv -O- https://nginx.org/keys/nginx_signing.key | sudo gpg --dearmor -o /usr/share/keyrings/nginx-archive-keyring.gpg
|
||||
if [[ $(conf_read nginx-ppa) == "mainline" ]]; then
|
||||
echo "deb [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] https://nginx.org/packages/mainline/ubuntu/ $(lsb_release -cs) nginx" | sudo tee /etc/apt/sources.list.d/nginx.list
|
||||
|
@ -1006,7 +1006,7 @@ stack_builder() {
|
|||
#sudo apt install -y language-pack-en-base
|
||||
sudo LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php
|
||||
else
|
||||
[[ ! -s /usr/share/keyrings/php-archive-keyring.gpg ]] && sudo rm -rf /usr/share/keyrings/php-archive-keyring.gpg # Prevent issues!
|
||||
[[ -f /usr/share/keyrings/php-archive-keyring.gpg && ( ! -s /usr/share/keyrings/php-archive-keyring.gpg || -z $(grep '[^[:space:]]' /usr/share/keyrings/php-archive-keyring.gpg )) ]] && sudo rm -rf /usr/share/keyrings/php-archive-keyring.gpg # Prevent issues!
|
||||
[[ ! -f /usr/share/keyrings/php-archive-keyring.gpg ]] && wget -nv -O- 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x14aa40ec0831756756d7f66c4f4ea0aae5267a6c' | sudo gpg --dearmor -o /usr/share/keyrings/php-archive-keyring.gpg
|
||||
echo "deb [signed-by=/usr/share/keyrings/php-archive-keyring.gpg] https://ppa.launchpadcontent.net/ondrej/php/ubuntu $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/php.list
|
||||
fi
|
||||
|
@ -1023,7 +1023,7 @@ stack_builder() {
|
|||
# Snap is available but it has no support for ARM architecture: https://snapcraft.io/redis
|
||||
echo | sudo add-apt-repository ppa:redislabs/redis
|
||||
else
|
||||
[[ ! -s /usr/share/keyrings/redis-archive-keyring.gpg ]] && sudo rm -rf /usr/share/keyrings/redis-archive-keyring.gpg # Prevent issues!
|
||||
[[ -f /usr/share/keyrings/redis-archive-keyring.gpg && ( ! -s /usr/share/keyrings/redis-archive-keyring.gpg || -z $(grep '[^[:space:]]' /usr/share/keyrings/redis-archive-keyring.gpg )) ]] && sudo rm -rf /usr/share/keyrings/redis-archive-keyring.gpg # Prevent issues!
|
||||
[[ ! -f /usr/share/keyrings/redis-archive-keyring.gpg ]] && wget -nv -O- https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg
|
||||
echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/redis.list
|
||||
fi
|
||||
|
@ -1041,7 +1041,7 @@ stack_builder() {
|
|||
fi
|
||||
|
||||
if [[ $(conf_read db-engine) == "mysql" ]]; then
|
||||
[[ ! -s /usr/share/keyrings/mysql-archive-keyring.gpg ]] && sudo rm -rf /usr/share/keyrings/mysql-archive-keyring.gpg # Prevent issues!
|
||||
[[ -f /usr/share/keyrings/mysql-archive-keyring.gpg && ( ! -s /usr/share/keyrings/mysql-archive-keyring.gpg || -z $(grep '[^[:space:]]' /usr/share/keyrings/mysql-archive-keyring.gpg )) ]] && sudo rm -rf /usr/share/keyrings/mysql-archive-keyring.gpg # Prevent issues!
|
||||
[[ ! -f /usr/share/keyrings/mysql-archive-keyring.gpg ]] && wget -nv -O- 'https://repo.mysql.com/RPM-GPG-KEY-mysql-2022' | sudo gpg --dearmor -o /usr/share/keyrings/mysql-archive-keyring.gpg
|
||||
echo "deb [signed-by=/usr/share/keyrings/mysql-archive-keyring.gpg] http://repo.mysql.com/apt/ubuntu $(lsb_release -cs) mysql-8.0" | sudo tee /etc/apt/sources.list.d/mysql.list
|
||||
|
||||
|
@ -1050,7 +1050,7 @@ stack_builder() {
|
|||
sudo apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc'
|
||||
echo | sudo add-apt-repository "deb [arch=amd64,arm64,ppc64el] http://mirrors.syringanetworks.net/mariadb/repo/$(conf_read mysql-ver)/ubuntu $(check_osname) main"
|
||||
else
|
||||
[[ ! -s /usr/share/keyrings/mariadb-archive-keyring.gpg ]] && sudo rm -rf /usr/share/keyrings/mariadb-archive-keyring.gpg # Prevent issues!
|
||||
[[ -f /usr/share/keyrings/mariadb-archive-keyring.gpg && ( ! -s /usr/share/keyrings/mariadb-archive-keyring.gpg || -z $(grep '[^[:space:]]' /usr/share/keyrings/mariadb-archive-keyring.gpg )) ]] && sudo rm -rf /usr/share/keyrings/mariadb-archive-keyring.gpg # Prevent issues!
|
||||
[[ ! -f /usr/share/keyrings/mariadb-archive-keyring.gpg ]] && wget -nv -O- 'https://mariadb.org/mariadb_release_signing_key.asc' | sudo gpg --dearmor -o /usr/share/keyrings/mariadb-archive-keyring.gpg
|
||||
echo "deb [signed-by=/usr/share/keyrings/mariadb-archive-keyring.gpg] http://mirrors.syringanetworks.net/mariadb/repo/$(conf_read mysql-ver)/ubuntu $(check_osname) main" | sudo tee /etc/apt/sources.list.d/mariadb.list
|
||||
fi
|
||||
|
|
14
lib/sites
14
lib/sites
|
@ -11,7 +11,7 @@ warning_messages() {
|
|||
if [[ $type == [123] && $dbhost != "localhost" && $(conf_read dbrole) =~ ^(all|grant)$ ]]; then
|
||||
echo "${dim}[WARNING] You have set '$(conf_read dbrole)' as default privileges, some external DB services may not support it!${end}"
|
||||
fi
|
||||
if [[ $type == [123] && $(conf_read wp-admin-auth) != "purged" && ! -s /etc/nginx/.htpasswd && ! -s /etc/nginx/apps.d/.htpasswd-$domain ]]; then
|
||||
if [[ $type == [123] && $(conf_read wp-admin-auth) != "purged" && ( ! -s /etc/nginx/.htpasswd || -z $(grep '[^[:space:]]' /etc/nginx/.htpasswd )) && ( ! -s /etc/nginx/apps.d/.htpasswd-$domain || -z $(grep '[^[:space:]]' /etc/nginx/apps.d/.htpasswd-$domain )) ]]; then
|
||||
echo "${dim}[WARNING] HTTP Authentication Credentials not found and you may need it to complete the WordPress installation process!!${end}"
|
||||
fi
|
||||
if [[ $(conf_read login-www-data) != "true" && (( -z $forward && -z $proxy && -z $parked && -z $mysql ) || ( -n $mysql && -n $domain )) ]]; then
|
||||
|
@ -602,14 +602,14 @@ deletesite() {
|
|||
# In case of custom cache
|
||||
if [[ -f /etc/nginx/conf.d/webinoly.conf ]]; then
|
||||
sudo sed -i "/^fastcgi_cache_path \/run\/nginx-cache\/$(echo $domain | sed 's/[^0-9A-Za-z]/_/g').*/d" /etc/nginx/conf.d/webinoly.conf
|
||||
[[ ! -s /etc/nginx/conf.d/webinoly.conf ]] && sudo rm /etc/nginx/conf.d/webinoly.conf
|
||||
[[ -f /etc/nginx/conf.d/webinoly.conf && ( ! -s /etc/nginx/conf.d/webinoly.conf || -z $(grep '[^[:space:]]' /etc/nginx/conf.d/webinoly.conf )) ]] && sudo rm /etc/nginx/conf.d/webinoly.conf
|
||||
fi
|
||||
|
||||
# Check for Reverse Proxy upstreams
|
||||
if [[ -f /etc/nginx/conf.d/upstream_proxy.conf ]]; then
|
||||
local domvar=$(echo "$domain" | sed "s/[^0-9A-Za-z]/_/g")
|
||||
sudo sed -i "/upstream ${domvar}/,/} #End/{/.*/d}" /etc/nginx/conf.d/upstream_proxy.conf
|
||||
[[ ! -s /etc/nginx/conf.d/upstream_proxy.conf ]] && sudo rm /etc/nginx/conf.d/upstream_proxy.conf
|
||||
[[ -f /etc/nginx/conf.d/upstream_proxy.conf && ( ! -s /etc/nginx/conf.d/upstream_proxy.conf || -z $(grep '[^[:space:]]' /etc/nginx/conf.d/upstream_proxy.conf )) ]] && sudo rm /etc/nginx/conf.d/upstream_proxy.conf
|
||||
fi
|
||||
|
||||
echo "${gre}Site${blu} $domain ${gre}has been successfully deleted!${end}"
|
||||
|
@ -654,7 +654,7 @@ deletesite_subfolder() {
|
|||
# In case of custom cache
|
||||
if [[ -f /etc/nginx/conf.d/webinoly.conf ]]; then
|
||||
sudo sed -i "/^fastcgi_cache_path \/run\/nginx-cache\/$(echo $domain | sed 's/[^0-9A-Za-z]/_/g')${subname} .*/d" /etc/nginx/conf.d/webinoly.conf
|
||||
[[ ! -s /etc/nginx/conf.d/webinoly.conf ]] && sudo rm /etc/nginx/conf.d/webinoly.conf
|
||||
[[ -f /etc/nginx/conf.d/webinoly.conf && ( ! -s /etc/nginx/conf.d/webinoly.conf || -z $(grep '[^[:space:]]' /etc/nginx/conf.d/webinoly.conf )) ]] && sudo rm /etc/nginx/conf.d/webinoly.conf
|
||||
fi
|
||||
|
||||
echo "${gre}${dim}Subfolder${blu} $subfolder ${gre}from${blu} $domain ${gre}has been successfully deleted!${end}"
|
||||
|
@ -668,7 +668,7 @@ deletesite_subfolder() {
|
|||
if [[ -f /etc/nginx/conf.d/upstream_proxy.conf ]]; then
|
||||
local domvar=$(echo "$domain$subfolder" | sed "s/[^0-9A-Za-z]/_/g")
|
||||
sudo sed -i "/upstream ${domvar}/,/} #End/{/.*/d}" /etc/nginx/conf.d/upstream_proxy.conf
|
||||
[[ ! -s /etc/nginx/conf.d/upstream_proxy.conf ]] && sudo rm /etc/nginx/conf.d/upstream_proxy.conf
|
||||
[[ -f /etc/nginx/conf.d/upstream_proxy.conf && ( ! -s /etc/nginx/conf.d/upstream_proxy.conf || -z $(grep '[^[:space:]]' /etc/nginx/conf.d/upstream_proxy.conf )) ]] && sudo rm /etc/nginx/conf.d/upstream_proxy.conf
|
||||
fi
|
||||
|
||||
sudo rm -rf /var/www/$domain/htdocs$subfolder
|
||||
|
@ -935,7 +935,7 @@ redirection_manager() {
|
|||
if [[ -f /etc/nginx/apps.d/$domain-nginx.conf ]]; then
|
||||
sudo sed -Ei '/^# RedirectFrom: '$(escaped_string $from)'( .*)?$/,/^# RedirectEnd/{/.*/d}' /etc/nginx/apps.d/$domain-nginx.conf
|
||||
|
||||
if [[ ! -s /etc/nginx/apps.d/$domain-nginx.conf ]]; then
|
||||
if [[ -f /etc/nginx/apps.d/$domain-nginx.conf && ( ! -s /etc/nginx/apps.d/$domain-nginx.conf || -z $(grep '[^[:space:]]' /etc/nginx/apps.d/$domain-nginx.conf )) ]]; then
|
||||
sudo rm /etc/nginx/apps.d/$domain-nginx.conf
|
||||
sudo sed -i "/$domain-nginx.conf;/d" /etc/nginx/sites-available/$domain
|
||||
fi
|
||||
|
@ -1558,7 +1558,7 @@ wp_cache() {
|
|||
else
|
||||
echo "${gre}Custom Nginx Cache configuration not found! ${end}"
|
||||
fi
|
||||
[[ -f /etc/nginx/conf.d/webinoly.conf && ! -s /etc/nginx/conf.d/webinoly.conf ]] && sudo rm /etc/nginx/conf.d/webinoly.conf
|
||||
[[ -f /etc/nginx/conf.d/webinoly.conf && ( ! -s /etc/nginx/conf.d/webinoly.conf || -z $(grep '[^[:space:]]' /etc/nginx/conf.d/webinoly.conf )) ]] && sudo rm /etc/nginx/conf.d/webinoly.conf
|
||||
elif [[ -n $query_string_never_cache || $query_string_cache || $skip_cache || -n $skip_cookie_cache ]]; then
|
||||
custom_cache_global -site
|
||||
elif [[ -n $query_string_cache_default ]]; then
|
||||
|
|
|
@ -82,7 +82,7 @@ onethree_to_onefour() {
|
|||
sudo mkdir -p /etc/nginx/apps.d
|
||||
sudo cp /etc/nginx/common/acl.conf /opt/webinoly/templates/source/acl.conf.old
|
||||
grep "^allow [^127.0.0.1]" /opt/webinoly/templates/source/acl.conf.old > /etc/nginx/apps.d/whitelist-acl.conf
|
||||
[[ -f /etc/nginx/apps.d/whitelist-acl.conf && ! -s /etc/nginx/apps.d/whitelist-acl.conf ]] && sudo rm /etc/nginx/apps.d/whitelist-acl.conf
|
||||
[[ -f /etc/nginx/apps.d/whitelist-acl.conf && ( ! -s /etc/nginx/apps.d/whitelist-acl.conf || -z $(grep '[^[:space:]]' /etc/nginx/apps.d/whitelist-acl.conf )) ]] && sudo rm /etc/nginx/apps.d/whitelist-acl.conf
|
||||
[[ -f /etc/nginx/sites-available/$(conf_read tools-port) ]] && sudo sed -i "/acl.conf;/i \ include common\/auth.conf;" /etc/nginx/sites-available/$(conf_read tools-port)
|
||||
|
||||
for site in "/etc/nginx/sites-available"/*
|
||||
|
|
26
lib/verify
26
lib/verify
|
@ -346,11 +346,11 @@ if [[ $(conf_read nginx) == "true" ]]; then
|
|||
local ver_two_err="1"
|
||||
fi
|
||||
else
|
||||
if [[ ! -f /usr/share/keyrings/nginx-archive-keyring.gpg || ! -s /usr/share/keyrings/nginx-archive-keyring.gpg ]]; then
|
||||
if [[ ! -f /usr/share/keyrings/nginx-archive-keyring.gpg || ! -s /usr/share/keyrings/nginx-archive-keyring.gpg || -z $(cat -v /usr/share/keyrings/nginx-archive-keyring.gpg | grep '[^[:space:]]') ]]; then
|
||||
echo "- [ERROR] Nginx Apt Key not found!"
|
||||
local ver_two_err="1"
|
||||
fi
|
||||
if [[ ! -f /etc/apt/sources.list.d/nginx.list || ! -s /etc/apt/sources.list.d/nginx.list ]]; then
|
||||
if [[ ! -f /etc/apt/sources.list.d/nginx.list || ! -s /etc/apt/sources.list.d/nginx.list || -z $(grep '[^[:space:]]' /etc/apt/sources.list.d/nginx.list ) ]]; then
|
||||
echo "- [ERROR] Nginx PPA not found in sources list!"
|
||||
local ver_two_err="1"
|
||||
fi
|
||||
|
@ -573,20 +573,20 @@ if [[ $(conf_read php) == "true" ]]; then
|
|||
fi
|
||||
|
||||
if [[ $(lsb_release -c | cut -d':' -f 2 | xargs) =~ ^(bionic|focal)$ ]]; then
|
||||
if [[ ! -f /etc/apt/trusted.gpg.d/ondrej_ubuntu_php.gpg || ! -s /etc/apt/trusted.gpg.d/ondrej_ubuntu_php.gpg ]]; then
|
||||
if [[ ! -f /etc/apt/trusted.gpg.d/ondrej_ubuntu_php.gpg || ! -s /etc/apt/trusted.gpg.d/ondrej_ubuntu_php.gpg || -z $(grep '[^[:space:]]' /etc/apt/trusted.gpg.d/ondrej_ubuntu_php.gpg ) ]]; then
|
||||
echo "- [ERROR] PHP Apt Key not found!"
|
||||
local ver_three_err="1"
|
||||
fi
|
||||
if [[ ! -f /etc/apt/sources.list.d/ondrej-ubuntu-php-$(check_osname).list || ! -s /etc/apt/sources.list.d/ondrej-ubuntu-php-$(check_osname).list ]]; then
|
||||
if [[ ! -f /etc/apt/sources.list.d/ondrej-ubuntu-php-$(check_osname).list || ! -s /etc/apt/sources.list.d/ondrej-ubuntu-php-$(check_osname).list || -z $(grep '[^[:space:]]' /etc/apt/sources.list.d/ondrej-ubuntu-php-$(check_osname).list ) ]]; then
|
||||
echo "- [ERROR] PHP PPA not found in sources list!"
|
||||
local ver_three_err="1"
|
||||
fi
|
||||
else
|
||||
if [[ ! -f /usr/share/keyrings/php-archive-keyring.gpg || ! -s /usr/share/keyrings/php-archive-keyring.gpg ]]; then
|
||||
if [[ ! -f /usr/share/keyrings/php-archive-keyring.gpg || ! -s /usr/share/keyrings/php-archive-keyring.gpg || -z $(cat -v /usr/share/keyrings/php-archive-keyring.gpg | grep '[^[:space:]]') ]]; then
|
||||
echo "- [ERROR] PHP Apt Key not found!"
|
||||
local ver_three_err="1"
|
||||
fi
|
||||
if [[ ! -f /etc/apt/sources.list.d/php.list || ! -s /etc/apt/sources.list.d/php.list ]]; then
|
||||
if [[ ! -f /etc/apt/sources.list.d/php.list || ! -s /etc/apt/sources.list.d/php.list || -z $(grep '[^[:space:]]' /etc/apt/sources.list.d/php.list ) ]]; then
|
||||
echo "- [ERROR] PHP PPA not found in sources list!"
|
||||
local ver_three_err="1"
|
||||
fi
|
||||
|
@ -736,11 +736,11 @@ if [[ $(conf_read mysql) == "true" ]]; then
|
|||
|
||||
# PPA & Keys
|
||||
if [[ $(conf_read db-engine) == "mysql" ]]; then
|
||||
if [[ ! -f /usr/share/keyrings/mysql-archive-keyring.gpg || ! -s /usr/share/keyrings/mysql-archive-keyring.gpg ]]; then
|
||||
if [[ ! -f /usr/share/keyrings/mysql-archive-keyring.gpg || ! -s /usr/share/keyrings/mysql-archive-keyring.gpg || -z $(grep '[^[:space:]]' /usr/share/keyrings/mysql-archive-keyring.gpg ) ]]; then
|
||||
echo "- [ERROR] MySQL Apt Key not found!"
|
||||
local ver_four_err="1"
|
||||
fi
|
||||
if [[ ! -f /etc/apt/sources.list.d/mysql.list || ! -s /etc/apt/sources.list.d/mysql.list ]]; then
|
||||
if [[ ! -f /etc/apt/sources.list.d/mysql.list || ! -s /etc/apt/sources.list.d/mysql.list || -z $(grep '[^[:space:]]' /etc/apt/sources.list.d/mysql.list ) ]]; then
|
||||
echo "- [ERROR] MySQL PPA not found in sources list!"
|
||||
local ver_four_err="1"
|
||||
fi
|
||||
|
@ -754,11 +754,11 @@ if [[ $(conf_read mysql) == "true" ]]; then
|
|||
local ver_four_err="1"
|
||||
fi
|
||||
else
|
||||
if [[ ! -f /usr/share/keyrings/mariadb-archive-keyring.gpg || ! -s /usr/share/keyrings/mariadb-archive-keyring.gpg ]]; then
|
||||
if [[ ! -f /usr/share/keyrings/mariadb-archive-keyring.gpg || ! -s /usr/share/keyrings/mariadb-archive-keyring.gpg || -z $(cat -v /usr/share/keyrings/mariadb-archive-keyring.gpg | grep '[^[:space:]]') ]]; then
|
||||
echo "- [ERROR] MariaDB Apt Key not found!"
|
||||
local ver_four_err="1"
|
||||
fi
|
||||
if [[ ! -f /etc/apt/sources.list.d/mariadb.list || ! -s /etc/apt/sources.list.d/mariadb.list ]]; then
|
||||
if [[ ! -f /etc/apt/sources.list.d/mariadb.list || ! -s /etc/apt/sources.list.d/mariadb.list || -z $(grep '[^[:space:]]' /etc/apt/sources.list.d/mariadb.list ) ]]; then
|
||||
echo "- [ERROR] MariaDB PPA not found in sources list!"
|
||||
local ver_four_err="1"
|
||||
fi
|
||||
|
@ -1024,14 +1024,14 @@ if [[ $(conf_read php-tool-redis) == "true" ]]; then
|
|||
# 18.04 - /etc/apt/trusted.gpg.d/redislabs_ubuntu_redis.gpg
|
||||
# 20.04 - /etc/apt/trusted.gpg.d/redislabs-ubuntu-redis.gpg
|
||||
# 22.04 - /usr/share/keyrings/redis-archive-keyring.gpg
|
||||
if [[ ( ! -f /etc/apt/trusted.gpg.d/redislabs_ubuntu_redis.gpg || ! -s /etc/apt/trusted.gpg.d/redislabs_ubuntu_redis.gpg ) && ( ! -f /etc/apt/trusted.gpg.d/redislabs-ubuntu-redis.gpg || ! -s /etc/apt/trusted.gpg.d/redislabs-ubuntu-redis.gpg ) && ( ! -f /usr/share/keyrings/redis-archive-keyring.gpg || ! -s /usr/share/keyrings/redis-archive-keyring.gpg ) ]]; then
|
||||
if [[ ( ! -f /etc/apt/trusted.gpg.d/redislabs_ubuntu_redis.gpg || ! -s /etc/apt/trusted.gpg.d/redislabs_ubuntu_redis.gpg || -z $(grep '[^[:space:]]' /etc/apt/trusted.gpg.d/redislabs_ubuntu_redis.gpg ) ) && ( ! -f /etc/apt/trusted.gpg.d/redislabs-ubuntu-redis.gpg || ! -s /etc/apt/trusted.gpg.d/redislabs-ubuntu-redis.gpg || -z $(grep '[^[:space:]]' /etc/apt/trusted.gpg.d/redislabs-ubuntu-redis.gpg ) ) && ( ! -f /usr/share/keyrings/redis-archive-keyring.gpg || ! -s /usr/share/keyrings/redis-archive-keyring.gpg || -z $(grep '[^[:space:]]' /usr/share/keyrings/redis-archive-keyring.gpg ) ) ]]; then
|
||||
echo "- [ERROR] Redis Apt Key not found!"
|
||||
local ver_seven_err="1"
|
||||
fi
|
||||
# 18.04 - /etc/apt/sources.list.d/redislabs-ubuntu-redis-$(check_osname).list
|
||||
# 20.04 - /etc/apt/sources.list.d/redislabs-ubuntu-redis-$(check_osname).list
|
||||
# 22.04 - /etc/apt/sources.list.d/redis.list
|
||||
if [[ ( ! -f /etc/apt/sources.list.d/redislabs-ubuntu-redis-$(check_osname).list || ! -s /etc/apt/sources.list.d/redislabs-ubuntu-redis-$(check_osname).list ) && ( ! -f /etc/apt/sources.list.d/redis.list || ! -s /etc/apt/sources.list.d/redis.list ) ]]; then
|
||||
if [[ ( ! -f /etc/apt/sources.list.d/redislabs-ubuntu-redis-$(check_osname).list || ! -s /etc/apt/sources.list.d/redislabs-ubuntu-redis-$(check_osname).list || -z $(grep '[^[:space:]]' /etc/apt/sources.list.d/redislabs-ubuntu-redis-$(check_osname).list ) ) && ( ! -f /etc/apt/sources.list.d/redis.list || ! -s /etc/apt/sources.list.d/redis.list || -z $(grep '[^[:space:]]' /etc/apt/sources.list.d/redis.list )) ]]; then
|
||||
echo "- [ERROR] Redis PPA not found in sources list!"
|
||||
local ver_seven_err="1"
|
||||
fi
|
||||
|
@ -1222,7 +1222,7 @@ if [[ -z $critical_mode ]]; then
|
|||
if [[ $ver_domi != "html" && $ver_domi != $ADMIN_TOOLS_SITE ]]; then
|
||||
# If WordPress, then check connection!
|
||||
if [[ $(is_wp $ver_domi) == "true" ]]; then
|
||||
if [[ ! -s /etc/nginx/.htpasswd && ! -s /etc/nginx/apps.d/.htpasswd-$ver_domi && $(is_wp_auth $ver_domi) == "true" ]]; then
|
||||
if [[ ( ! -s /etc/nginx/.htpasswd || -z $(grep '[^[:space:]]' /etc/nginx/.htpasswd )) && ( ! -s /etc/nginx/apps.d/.htpasswd-$ver_domi || -z $(grep '[^[:space:]]' /etc/nginx/apps.d/.htpasswd-$ver_domi )) && $(is_wp_auth $ver_domi) == "true" ]]; then
|
||||
echo "${blu}${dim}- [INFO] HTTP Authentication Credentials not found for $ver_domi${end}${red}"
|
||||
fi
|
||||
|
||||
|
|
|
@ -695,7 +695,7 @@ set_tools_site() {
|
|||
fi
|
||||
|
||||
# Warning Message
|
||||
if [[ ( ! -s /etc/nginx/.htpasswd && $tools_site == "default" ) || ( ! -s /etc/nginx/.htpasswd && $tools_site != "default" && -f /etc/nginx/sites-available/$tools_site && ! -s /etc/nginx/apps.d/.htpasswd-$tools_site ) ]]; then
|
||||
if [[ (( ! -s /etc/nginx/.htpasswd || -z $(grep '[^[:space:]]' /etc/nginx/.htpasswd )) && $tools_site == "default" ) || (( ! -s /etc/nginx/.htpasswd || -z $(grep '[^[:space:]]' /etc/nginx/.htpasswd )) && $tools_site != "default" && -f /etc/nginx/sites-available/$tools_site && ( ! -s /etc/nginx/apps.d/.htpasswd-$tools_site || -z $(grep '[^[:space:]]' /etc/nginx/apps.d/.htpasswd-$tools_site ))) ]]; then
|
||||
echo "${dim}[WARNING] HTTP Authentication Credentials not found and you may need it to access these tools!${end}"
|
||||
fi
|
||||
}
|
||||
|
@ -953,7 +953,7 @@ nginx_blockip() {
|
|||
[[ -f /etc/nginx/conf.d/blockips.conf ]] && sed -i "\#^deny ${blockip};#d" /etc/nginx/conf.d/blockips.conf
|
||||
|
||||
# Remove site-auth-file if empty.
|
||||
[[ -f /etc/nginx/conf.d/blockips.conf && ! -s /etc/nginx/conf.d/blockips.conf ]] && sudo rm /etc/nginx/conf.d/blockips.conf
|
||||
[[ -f /etc/nginx/conf.d/blockips.conf && ( ! -s /etc/nginx/conf.d/blockips.conf || -z $(grep '[^[:space:]]' /etc/nginx/conf.d/blockips.conf )) ]] && sudo rm /etc/nginx/conf.d/blockips.conf
|
||||
|
||||
echo "${gre}The IP address ${blu}'$blockip'${gre} was successfully unblocked!${end}"
|
||||
else
|
||||
|
|
|
@ -96,7 +96,7 @@ elif [[ -n $delete ]]; then
|
|||
sudo sed -i "/^$userpurge:/d" /etc/nginx/$authfile
|
||||
|
||||
# Remove site-auth-file if empty.
|
||||
if [[ -n $domain && -f /etc/nginx/$authfile && ! -s /etc/nginx/$authfile ]]; then
|
||||
if [[ -n $domain && -f /etc/nginx/$authfile && ( ! -s /etc/nginx/$authfile || -z $(grep '[^[:space:]]' $authfile )) ]]; then
|
||||
sudo rm /etc/nginx/$authfile
|
||||
sudo rm -rf /etc/nginx/apps.d/.htpasswd-www.$domain
|
||||
fi
|
||||
|
@ -212,7 +212,7 @@ elif [[ -n $whitelist ]]; then
|
|||
[[ -f /etc/nginx/apps.d/whitelist-acl.conf ]] && sudo sed -i "\#^allow ${whitelist};#d" /etc/nginx/apps.d/whitelist-acl.conf
|
||||
|
||||
# Remove site-auth-file if empty.
|
||||
[[ -f /etc/nginx/apps.d/whitelist-acl.conf && ! -s /etc/nginx/apps.d/whitelist-acl.conf ]] && sudo rm /etc/nginx/apps.d/whitelist-acl.conf
|
||||
[[ -f /etc/nginx/apps.d/whitelist-acl.conf && ( ! -s /etc/nginx/apps.d/whitelist-acl.conf || -z $(grep '[^[:space:]]' /etc/nginx/apps.d/whitelist-acl.conf )) ]] && sudo rm /etc/nginx/apps.d/whitelist-acl.conf
|
||||
|
||||
echo "${gre}The IP address ${blu}'$whitelist'${gre} was successfully removed from whitelist!${end}"
|
||||
else
|
||||
|
@ -327,7 +327,7 @@ location $sign$path {
|
|||
elif [[ $path =~ ^\/([A-Za-z0-9_\/\.\-]+)?$ ]]; then
|
||||
if [[ -f /etc/nginx/apps.d/$domain-nginx.conf ]]; then
|
||||
sudo sed -i "/^# Path: $(echo $path | sed "s#/#\\\/#g")/,/^# PathEnd/{/.*/d}" /etc/nginx/apps.d/$domain-nginx.conf
|
||||
if [[ ! -s /etc/nginx/apps.d/$domain-nginx.conf ]]; then
|
||||
if [[ -f /etc/nginx/apps.d/$domain-nginx.conf && ( ! -s /etc/nginx/apps.d/$domain-nginx.conf || -z $(grep '[^[:space:]]' /etc/nginx/apps.d/$domain-nginx.conf )) ]]; then
|
||||
sudo rm /etc/nginx/apps.d/$domain-nginx.conf
|
||||
sudo sed -i "/$domain-nginx.conf;/d" /etc/nginx/sites-available/$domain
|
||||
fi
|
||||
|
@ -376,7 +376,7 @@ elif [[ -n $list ]]; then
|
|||
done
|
||||
}
|
||||
fi
|
||||
[[ ! -s /etc/nginx/$authfile && -z $raw && $list != "raw" ]] && echo "${blu}[Empty] No users were found!${end}"
|
||||
[[ ( ! -s /etc/nginx/$authfile || -z $(grep '[^[:space:]]' /etc/nginx/$authfile )) && -z $raw && $list != "raw" ]] && echo "${blu}[Empty] No users were found!${end}"
|
||||
echo ""
|
||||
nginx_not="true" # Nginx-Reload not-needed.
|
||||
|
||||
|
|
Loading…
Reference in a new issue