more improvements

- python-software-properties not installed in bionic
- error when site command arguments have values and are inverted.
- version command improved to not show empty values.
- clean-cache command now check if memcached and redis are installed.
- zip package is now removed when webinoly is uninstalled.
This commit is contained in:
Cristhian Martínez Ochoa 2018-10-30 20:21:07 -07:00
parent bc7f02fb75
commit 6762d7e738
4 changed files with 19 additions and 14 deletions

View file

@ -122,7 +122,7 @@ pre_install() {
api-events_update i1
sudo apt-get -y -qq install dialog
sudo apt-get -y -qq install software-properties-common
sudo apt-get -y -qq install python-software-properties
[[ $(check_osname) != "bionic" ]] && sudo apt-get -y -qq install python-software-properties
sudo apt-get -y -qq install pwgen
sudo apt-get -y -qq install unzip
sudo apt-get -y -qq install zip

View file

@ -80,6 +80,9 @@ site_ssl_on() {
# Single cert
elif [[ ! -a /etc/letsencrypt/live/$domain/fullchain.pem ]]; then
sudo certbot certonly --webroot -w /var/www/$root/htdocs/ $domset $param
elif [[ -a /etc/letsencrypt/live/$domain/fullchain.pem ]]; then
echo "${blu}Certificate for $domain already exist and found, wait while we configure your server to use it!${end}"
fi

View file

@ -23,12 +23,6 @@ if [[ ! $(conf_read nginx) == "true" ]]; then
exit 1
fi
# 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
type=${3,,}
cache=${2,,}
fi
# Extract value if exist
if [[ $domain == "-mysql="* ]]; then
@ -44,6 +38,12 @@ if [[ $cache == "-root="* || $cache == "-subdomain="* || $cache == "-root-path=
cache=$(echo "${cache}" | cut -d'=' -f 1 -s)
fi
# 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
type=${3,,}
cache=${2,,}
fi
# Check if site is sub-domain
if [[ -n $domain && $type =~ ^(-html|-php|-mysql|-wp|-wpsubdir|-wpsubdom|-parked|-proxy|-ssl-on|-force-redirect)$ ]]; then

View file

@ -232,7 +232,7 @@ elif [[ $opt == "-uninstall" ]]; then
swap_delete
fi
if [[ $(conf_read pre-packs) == true ]]; then
sudo apt-get -y -qq purge pwgen unzip > /dev/null
sudo apt-get -y -qq purge pwgen unzip zip > /dev/null
sudo apt-get -y -qq autoremove > /dev/null
conf_write pre-packs purged
fi
@ -298,21 +298,21 @@ elif [[ $opt == "-clear-cache" ]]; then
exit 1
fi
if [[ $value == "redis" || $value == "all" ]]; then
if [[ $(conf_read php-tool) == "true" ]]; then
if [[ $(conf_read php-tool) == "true" && -a /etc/redis/redis.conf ]]; then
sudo redis-cli flushall
echo "${gre}- Redis Cache has been successfully cleared!${end}"
else
echo "${red}[ERROR] We can not clear Redis Cache because PHP is not installed!${end}"
echo "${red}[ERROR] We can not clear Redis Cache because is not installed!${end}"
fi
fi
if [[ $value == "memcache" || $value == "memcached" || $value == "all" ]]; then
if [[ $(conf_read php-tool) == "true" ]]; then
if [[ $(conf_read php-tool) == "true" && -a /etc/memcached.conf ]]; then
memhost=$(grep ^-l /etc/memcached.conf | cut -f 2 -d ' ')
memport=$(grep ^-p /etc/memcached.conf | cut -f 2 -d ' ')
echo flush_all > /dev/tcp/$memhost/$memport
echo "${gre}- Memcached has been successfully cleared!${end}"
else
echo "${red}[ERROR] We can not clear Memcache because PHP is not installed!${end}"
echo "${red}[ERROR] We can not clear Memcache because is not installed!${end}"
fi
fi
if [[ $value == "opcache" || $value == "all" ]]; then
@ -355,10 +355,12 @@ elif [[ $opt == "-timezone" ]]; then
elif [[ $opt == "-version" || $opt == "-v" || $opt == "-V" ]]; then
[[ -z $(conf_read server-version) ]] && sver="Not installed!" || sver=$(conf_read server-version)
echo "${blu}"
echo "Webinoly version: $(app_version)"
echo "Current stack version: $(conf_read server-version)"
echo "Available stack version: $(svr_version)"
echo "Current stack version: $sver"
[[ $sver != $(svr_version) ]] && echo "Available stack version: $(svr_version)"
echo "${end}"