Skip to content

Commit

Permalink
case insentive removed
Browse files Browse the repository at this point in the history
Case insensitive for arguments was removed.
Now we use apt instead of apt-get.
  • Loading branch information
QROkes committed Nov 2, 2018
1 parent f2b224f commit 2f3bde8
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 53 deletions.
16 changes: 8 additions & 8 deletions lib/general
Original file line number Diff line number Diff line change
Expand Up @@ -116,16 +116,16 @@ check_osname() {


pre_install() {
sudo apt-get -qq update
sudo apt -qq update
if [[ $(conf_read pre-packs) != true ]]; then
# Check for missing essential packages
api-events_update i1
sudo apt-get -y -qq install dialog
sudo apt-get -y -qq install software-properties-common
[[ $(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
sudo apt -y -qq install dialog
sudo apt -y -qq install software-properties-common
[[ $(check_osname) != "bionic" ]] && sudo apt -y -qq install python-software-properties
sudo apt -y -qq install pwgen
sudo apt -y -qq install unzip
sudo apt -y -qq install zip
conf_write pre-packs true
api-events_update i2
fi
Expand All @@ -147,7 +147,7 @@ mysql_client_install() {
;;
esac
pre_install
sudo apt-get -y install mariadb-client
sudo apt -y install mariadb-client
conf_write mysql-client true
echo "${gre}MySQL Client has been successfully installed!${end}"
api-events_update im3
Expand Down
26 changes: 13 additions & 13 deletions lib/install
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ source /opt/webinoly/lib/general


app_version() {
local app_ver="1.6.1"
local app_ver="1.6.2"
echo $app_ver
}
svr_version() {
Expand Down Expand Up @@ -189,7 +189,7 @@ nginx_install() {
conf_write nginx-ppa stable
fi
pre_install
sudo apt-get -y install nginx
sudo apt -y install nginx

if [[ $(conf_read login-www-data) == "true" ]]; then
sudo chown -R www-data:www-data /var/www
Expand Down Expand Up @@ -228,19 +228,19 @@ php_install() {
pre_install
if [[ $(conf_read php) != "true" ]]; then
# Fix ondrej issue - https://github.com/oerdnj/deb.sury.org/issues/56
sudo apt-get install -y language-pack-en-base
sudo apt install -y language-pack-en-base
sudo LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php
fi
pre_install
sudo apt-get -y install php${ver}-common php${ver}-cli php${ver}-fpm php${ver}-curl php${ver}-gd php${ver}-imap php${ver}-readline php${ver}-recode php${ver}-mysql php${ver}-mbstring php${ver}-bcmath php${ver}-mysql php${ver}-opcache php${ver}-zip php${ver}-xml php${ver}-soap php-imagick graphviz php-pear php-msgpack
sudo apt -y install php${ver}-common php${ver}-cli php${ver}-fpm php${ver}-curl php${ver}-gd php${ver}-imap php${ver}-readline php${ver}-recode php${ver}-mysql php${ver}-mbstring php${ver}-bcmath php${ver}-mysql php${ver}-opcache php${ver}-zip php${ver}-xml php${ver}-soap php-imagick graphviz php-pear php-msgpack

if [[ -n $ver && ($ver == "7.1" || $ver == "7.0" || $ver == "5.6") ]]; then
# mcrypt deprecated in 7.2
sudo apt-get -y install php${ver}-mcrypt
sudo apt -y install php${ver}-mcrypt
fi
if [[ -n $ver && ($ver == "7.3" || $ver == "7.2" || $ver == "7.1" || $ver == "7.0") ]]; then
# xdebug deprecated in 5.6
sudo apt-get -y install php-xdebug
sudo apt -y install php-xdebug
fi

def=$(conf_read php-ver)
Expand All @@ -263,7 +263,7 @@ mysql_install() {

# debconf-utils for unattended scripts
# debconf-get-selections | grep phpmyadmin <<-- list conf variables
sudo apt-get -y install debconf-utils
sudo apt -y install debconf-utils

# Generate mysql user passwords
local AUTOGENPASS_ROOT=`pwgen -s -1`
Expand All @@ -276,7 +276,7 @@ mysql_install() {
# MariaDB Installation
echo "mariadb-server-10.2 mysql-server/root_password password $AUTOGENPASS_ROOT" | debconf-set-selections
echo "mariadb-server-10.2 mysql-server/root_password_again password $AUTOGENPASS_ROOT" | debconf-set-selections
sudo apt-get -y install mariadb-server
sudo apt -y install mariadb-server

#Instead of mysql_secure_installation we do this: (same but manually, because not acept unattended)
#ALTER USER 'root'@'localhost' IDENTIFIED BY '${AUTOGENPASS_ROOT}'; <<<--- For MySQL 5.7.6 and newer as well as MariaDB 10.1.20 and newer instead of UPDATE
Expand Down Expand Up @@ -424,10 +424,10 @@ nginx_tool() {
# Install LetsEncrypt
echo | sudo add-apt-repository ppa:certbot/certbot
pre_install
sudo apt-get -y install certbot
sudo apt -y install certbot

# Instalar Duply & Duplicity
sudo apt-get -y install python-boto duplicity duply
sudo apt -y install python-boto duplicity duply

conf_write nginx-tool true
api-events_update in10
Expand Down Expand Up @@ -462,15 +462,15 @@ php_tool() {
# Redis (Object Cache)
echo | sudo add-apt-repository ppa:chris-lea/redis-server
pre_install
sudo apt-get -y install redis-server php-redis
sudo apt -y install redis-server php-redis

# Memcached (Object Cache)
sudo apt-get -y install php-memcached php-memcache memcached
sudo apt -y install php-memcached php-memcache memcached

# Postfix mail
echo "postfix postfix/main_mailer_type select Internet Site" | debconf-set-selections
echo "postfix postfix/mailname string $hostname" | debconf-set-selections
sudo apt-get -y install postfix
sudo apt -y install postfix

sudo service php*-fpm reload
conf_write php-tool true
Expand Down
2 changes: 1 addition & 1 deletion plugins/httpauth
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
source /opt/webinoly/lib/general
opt=${1,,}
opt=$1

# Http-Authentication Plugin
# Syntax: httpauth <option>
Expand Down
8 changes: 4 additions & 4 deletions plugins/log
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
# Notes: If no domain or option is entered, access logs are displayed.

source /opt/webinoly/lib/general
domain=${1,,}
opt=${2,,}
domain=$1
opt=$2

error() {
echo ""
Expand All @@ -18,8 +18,8 @@ error() {

# Validations
if [[ $domain =~ ^(-error|-wp)$ || $domain == "-only-error="* ]]; then
domain=${2,,}
opt=${1,,}
domain=$2
opt=$1
fi

# Extract value if exist
Expand Down
17 changes: 8 additions & 9 deletions plugins/site
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
# shopt is necessary for this kind !(html|22222) of patterns
shopt -s extglob

domain=${1,,}
type=${2,,}
cache=${3,,}
domain=$1
type=$2
cache=$3

source /opt/webinoly/lib/general
source /opt/webinoly/lib/sites
Expand All @@ -23,6 +23,11 @@ if [[ ! $(conf_read nginx) == "true" ]]; then
exit 1
fi

# Check if user entered arg before option and correct it.
if [[ -n $cache && $type =~ ^(-cache|-root|-root-path|-subdomain|-ignore-ssl|-wildcard)$ ]]; then
type=$3
cache=$2
fi

# Extract value if exist
if [[ $domain == "-mysql="* ]]; then
Expand All @@ -38,12 +43,6 @@ 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
Expand Down
32 changes: 16 additions & 16 deletions plugins/stack
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@

source /opt/webinoly/lib/install
source /opt/webinoly/lib/webin
opt=${1,,}
arg=${2,,}
opt=$1
arg=$2


# Check if user entered arg before option and correct it.
if [[ $opt == "-purge" || $opt == "-notools" || $opt == "-noptim" ]]; then
opt=${2,,}
arg=${1,,}
if [[ $opt =~ ^(-purge|-notools|-noptim)$ ]]; then
opt=$2
arg=$1
fi

# FORCE - Unattended Purge
Expand Down Expand Up @@ -94,18 +94,18 @@ elif [[ $arg == "-purge" && ( $opt == "-html" || $opt == "-nginx" ) ]]; then
fi

sudo service nginx stop
sudo apt-get -y purge nginx nginx-common
sudo apt -y purge nginx nginx-common
[[ $(conf_read nginx-ppa) == "mainline" ]] && echo | sudo add-apt-repository --remove 'ppa:nginx/development' || echo | sudo add-apt-repository --remove 'ppa:nginx/stable'
api-events_update pn4
api-events_update pn5
sudo apt-get -y purge certbot python-boto duplicity duply
sudo apt -y purge certbot python-boto duplicity duply
echo | sudo add-apt-repository --remove 'ppa:certbot/certbot'
# Remove SSL Cron
if [[ -a /var/spool/cron/crontabs/root ]]; then
sudo sed -i '/MAILTO=/d' /var/spool/cron/crontabs/root
sudo sed -i '/certbot renew/d' /var/spool/cron/crontabs/root
fi
sudo apt-get -y autoremove
sudo apt -y autoremove
sudo rm $HOME/www
sudo rm $HOME/sites-available
api-events_update pn6
Expand Down Expand Up @@ -149,12 +149,12 @@ elif [[ $arg == "-purge" && $opt == "-php" ]]; then
if [[ $answer == [Yy] || $(conf_read force-flag) == "true" ]]; then
[[ $(conf_read mysql-tool) == "true" ]] && stack -pma -purge
sudo service php*-fpm stop
sudo apt-get -y purge php*-fpm php*-curl php*-gd php*-imap php*-mcrypt php*-readline php*-common php*-recode php*-mysql php*-cli php*-mbstring php*-bcmath php*-mysql php*-opcache php*-zip php*-xml php*-soap php-imagick graphviz php-pear php-xdebug php-msgpack
sudo apt-get -y purge php-memcached php-memcache memcached
sudo apt-get -y purge redis-server php-redis postfix
sudo apt -y purge php*-fpm php*-curl php*-gd php*-imap php*-mcrypt php*-readline php*-common php*-recode php*-mysql php*-cli php*-mbstring php*-bcmath php*-mysql php*-opcache php*-zip php*-xml php*-soap php-imagick graphviz php-pear php-xdebug php-msgpack
sudo apt -y purge php-memcached php-memcache memcached
sudo apt -y purge redis-server php-redis postfix
echo | sudo add-apt-repository --remove 'ppa:ondrej/php'
echo | sudo add-apt-repository --remove 'ppa:chris-lea/redis-server'
sudo apt-get -y autoremove
sudo apt -y autoremove
sudo rm -rf /etc/php
sudo rm /opt/webinoly/templates/source/*

Expand Down Expand Up @@ -212,10 +212,10 @@ elif [[ $arg == "-purge" && $opt == "-mysql" ]]; then
fi
sudo service mysql stop
echo "mariadb-server-10.2 mariadb-server-10.2/postrm_remove_databases boolean true" | debconf-set-selections
sudo apt-get -y purge mariadb-server mariadb-common mysql-common
sudo apt-get -y purge mariadb-client
sudo apt-get -y purge debconf-utils
sudo apt-get -y autoremove
sudo apt -y purge mariadb-server mariadb-common mysql-common
sudo apt -y purge mariadb-client
sudo apt -y purge debconf-utils
sudo apt -y autoremove

os_name=$(check_osname)
sudo add-apt-repository --remove "deb [arch=amd64,i386,ppc64el] http://mirrors.syringanetworks.net/mariadb/repo/10.2/ubuntu ${os_name} main"
Expand Down
4 changes: 2 additions & 2 deletions plugins/webinoly
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
# 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

opt=${1,,}
opt=$1
source /opt/webinoly/lib/webin

# Extract value if exist
if [[ $opt == "-tools-port="* || $opt == "-config-cache="* || $opt == "-clear-cache="* || $opt == "-server-update="* || $opt == "-server-reset="* || $opt == "-timezone="* || $opt == "-update="* || $opt == "-blockip="* || $opt == "-unblockip="* || $opt == "-conf-value_"* || $opt == "-yoast-sitemap="* ]]; then
value=$(echo "${opt}" | cut -d'=' -f 2 -s)
opt=$(echo "${opt}" | cut -d'=' -f 1 -s)
# Prevent cases like -conf-value where is valid enter a value without = causing empty opt.
[[ -z $opt ]] && opt=${1,,}
[[ -z $opt ]] && opt=$1
fi


Expand Down

0 comments on commit 2f3bde8

Please sign in to comment.