command improvements

- Arguments are now case insensitive
- server-update now check if source files exist before update.
- some minor improvements to prevent errors.
This commit is contained in:
Cristhian Martínez Ochoa 2018-10-27 18:54:13 -06:00
parent e63a9dc1d9
commit bc7f02fb75
7 changed files with 27 additions and 23 deletions

View file

@ -480,7 +480,7 @@ php_tool() {
mysql_tool() { mysql_tool() {
api-events_update im5 api-events_update im5
sudo mkdir /var/www/$(conf_read tools-port)/htdocs/pma sudo mkdir -p /var/www/$(conf_read tools-port)/htdocs/pma
sudo wget --timeout=15 -t 1 -qrO /var/www/$(conf_read tools-port)/htdocs/pma.tar.xz https://www.phpmyadmin.net/downloads/phpMyAdmin-latest-all-languages.tar.xz sudo wget --timeout=15 -t 1 -qrO /var/www/$(conf_read tools-port)/htdocs/pma.tar.xz https://www.phpmyadmin.net/downloads/phpMyAdmin-latest-all-languages.tar.xz
sudo tar -xf /var/www/$(conf_read tools-port)/htdocs/pma.tar.xz -C /var/www/$(conf_read tools-port)/htdocs/pma sudo tar -xf /var/www/$(conf_read tools-port)/htdocs/pma.tar.xz -C /var/www/$(conf_read tools-port)/htdocs/pma
sudo mv /var/www/$(conf_read tools-port)/htdocs/pma/phpMyAdmin-*-all-languages/* /var/www/$(conf_read tools-port)/htdocs/pma/ sudo mv /var/www/$(conf_read tools-port)/htdocs/pma/phpMyAdmin-*-all-languages/* /var/www/$(conf_read tools-port)/htdocs/pma/

View file

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
source /opt/webinoly/lib/general source /opt/webinoly/lib/general
opt="$1" opt=${1,,}
# Http-Authentication Plugin # Http-Authentication Plugin
# Syntax: httpauth <option> # Syntax: httpauth <option>

View file

@ -6,8 +6,8 @@
# Notes: If no domain or option is entered, access logs are displayed. # Notes: If no domain or option is entered, access logs are displayed.
source /opt/webinoly/lib/general source /opt/webinoly/lib/general
domain="$1" domain=${1,,}
opt="$2" opt=${2,,}
error() { error() {
echo "" echo ""
@ -18,8 +18,8 @@ error() {
# Validations # Validations
if [[ $domain =~ ^(-error|-wp)$ || $domain == "-only-error="* ]]; then if [[ $domain =~ ^(-error|-wp)$ || $domain == "-only-error="* ]]; then
domain="$2" domain=${2,,}
opt="$1" opt=${1,,}
fi fi
# Extract value if exist # Extract value if exist

View file

@ -8,9 +8,9 @@
# shopt is necessary for this kind !(html|22222) of patterns # shopt is necessary for this kind !(html|22222) of patterns
shopt -s extglob shopt -s extglob
domain="$1" domain=${1,,}
type="$2" type=${2,,}
cache="$3" cache=${3,,}
source /opt/webinoly/lib/general source /opt/webinoly/lib/general
source /opt/webinoly/lib/sites source /opt/webinoly/lib/sites
@ -25,8 +25,8 @@ fi
# Check if user entered arg before option and correct it. # Check if user entered arg before option and correct it.
if [[ -n $cache && ($type == "-cache" || $type == "-root" || $type == "-root-path" || $type == "-subdomain" || $type == "-ignore-ssl" || $type == "-wildcard") ]]; then if [[ -n $cache && ($type == "-cache" || $type == "-root" || $type == "-root-path" || $type == "-subdomain" || $type == "-ignore-ssl" || $type == "-wildcard") ]]; then
type="$3" type=${3,,}
cache="$2" cache=${2,,}
fi fi

View file

@ -7,14 +7,14 @@
source /opt/webinoly/lib/install source /opt/webinoly/lib/install
source /opt/webinoly/lib/webin source /opt/webinoly/lib/webin
opt="$1" opt=${1,,}
arg="$2" arg=${2,,}
# Check if user entered arg before option and correct it. # Check if user entered arg before option and correct it.
if [[ $opt == "-purge" || $opt == "-notools" || $opt == "-noptim" ]]; then if [[ $opt == "-purge" || $opt == "-notools" || $opt == "-noptim" ]]; then
opt="$2" opt=${2,,}
arg="$1" arg=${1,,}
fi fi
# FORCE - Unattended Purge # FORCE - Unattended Purge

View file

@ -4,7 +4,7 @@
# Syntax: webinoly <option> # Syntax: webinoly <option>
# Options: -update, -server-update or -server-reset, -verify, -dbpass, -tools-port, -login-www-data, -nologin-www-data, -config-cache, -uninstall, -info, -external-sources-update, -clear-cache, -version, -blockip, -unblockip, -conf-value_, -yoast-sitemap # Options: -update, -server-update or -server-reset, -verify, -dbpass, -tools-port, -login-www-data, -nologin-www-data, -config-cache, -uninstall, -info, -external-sources-update, -clear-cache, -version, -blockip, -unblockip, -conf-value_, -yoast-sitemap
opt="$1" opt=${1,,}
source /opt/webinoly/lib/webin source /opt/webinoly/lib/webin
# Extract value if exist # Extract value if exist
@ -12,7 +12,7 @@ if [[ $opt == "-tools-port="* || $opt == "-config-cache="* || $opt == "-clear-ca
value=$(echo "${opt}" | cut -d'=' -f 2 -s) value=$(echo "${opt}" | cut -d'=' -f 2 -s)
opt=$(echo "${opt}" | cut -d'=' -f 1 -s) opt=$(echo "${opt}" | cut -d'=' -f 1 -s)
# Prevent cases like -conf-value where is valid enter a value without = causing empty opt. # Prevent cases like -conf-value where is valid enter a value without = causing empty opt.
[[ -z $opt ]] && opt=$1 [[ -z $opt ]] && opt=${1,,}
fi fi
@ -46,11 +46,15 @@ elif [[ $opt == "-server-update" || $opt == "-server-reset" ]]; then
# Regenerate PHP conf files # Regenerate PHP conf files
if [[ $(conf_read php-optim) == "true" && ( $value == "php" || $value = "all" ) ]]; then if [[ $(conf_read php-optim) == "true" && ( $value == "php" || $value = "all" ) ]]; then
sudo cat /opt/webinoly/templates/source/php.ini > /etc/php/$(conf_read php-ver)/fpm/php.ini if [[ -a /opt/webinoly/templates/source/php.ini && -a /opt/webinoly/templates/source/www.conf ]]; then
sudo cat /opt/webinoly/templates/source/www.conf > /etc/php/$(conf_read php-ver)/fpm/pool.d/www.conf sudo cat /opt/webinoly/templates/source/php.ini > /etc/php/$(conf_read php-ver)/fpm/php.ini
sudo rm /etc/php/$(conf_read php-ver)/fpm/pool.d/debug.conf sudo cat /opt/webinoly/templates/source/www.conf > /etc/php/$(conf_read php-ver)/fpm/pool.d/www.conf
php_optim sudo rm -rf /etc/php/$(conf_read php-ver)/fpm/pool.d/debug.conf
echo "${gre}PHP settings has been updated successfully!${end}" php_optim
echo "${gre}PHP settings has been updated successfully!${end}"
else
echo "${red}[ERROR] PHP could not been updated, source files not found!${end}"
fi
elif [[ $(conf_read php-optim) != "true" && ( $value == "php" || $value = "all" ) ]]; then elif [[ $(conf_read php-optim) != "true" && ( $value == "php" || $value = "all" ) ]]; then
echo "${red}PHP settings couldn't been updated, seems like is not installed in your server!${end}" echo "${red}PHP settings couldn't been updated, seems like is not installed in your server!${end}"
fi fi

2
weby
View file

@ -74,7 +74,7 @@ fi
sudo tar -xf $HOME/webinoly.tar -C /opt/webinoly sudo tar -xf $HOME/webinoly.tar -C /opt/webinoly
sudo find /opt/webinoly -type d -exec chmod 755 {} \; sudo find /opt/webinoly -type d -exec chmod 755 {} \;
sudo find /opt/webinoly -type f -exec chmod 644 {} \; sudo find /opt/webinoly -type f -exec chmod 644 {} \;
sudo chmod 744 /opt/webinoly/lib/ex-* sudo chmod -f 744 /opt/webinoly/lib/ex-*
# Install plugins # Install plugins
sudo chmod 755 /opt/webinoly/plugins/* sudo chmod 755 /opt/webinoly/plugins/*