diff --git a/lib/site-ssl b/lib/site-ssl index edd44ad..feded6b 100644 --- a/lib/site-ssl +++ b/lib/site-ssl @@ -8,10 +8,8 @@ source /opt/webinoly/lib/general site_ssl_on() { local cermail=$(conf_read mail) local root="$domain" - if [[ "$cache" == "-root" ]]; then - root="$domroot" - fi - + [[ $cache == "-root" && -n $value ]] && root="$value" + echo "${gre}" echo "*************************************************************************************************" echo "** Please, be careful with the number of intents or certificates you try to get. **" diff --git a/plugins/site b/plugins/site index f4c4555..ba08675 100644 --- a/plugins/site +++ b/plugins/site @@ -11,7 +11,6 @@ shopt -s extglob domain="$1" type="$2" cache="$3" -domroot="$4" source /opt/webinoly/lib/general source /opt/webinoly/lib/sites @@ -38,36 +37,46 @@ else subdomflag="1" fi -wp="0" # Evaluate if site to create is WP ( 0 = noWP, 1 = WP, 2 = WP with default values, 3 = WP with custom values ) -if [[ "$type" == "-wp" || "$type" == "-wpsubdir" || "$type" == "-wpsubdom" ]]; then - wp="1" +# Extract value if exist +if [[ $type == "-parked="* || $type == "-proxy="* || $type == "-wp="* || $type == "-wpsubdir="* || $type == "-wpsubdom="* ]]; then + value=$(echo "${type}" | cut -d'=' -f 2 -s) + type=$(echo "${type}" | cut -d'=' -f 1 -s) fi -if [[ "$type" == "-wp="* || "$type" == "-wpsubdir="* || "$type" == "-wpsubdom="* ]]; then - wpunat=$(echo "${type}" | cut -d'=' -f 2 -s) - if [[ $wpunat == "default" ]]; then - wp="2" - type=$(echo "${type}" | cut -d'=' -f 1 -s) - else - # -wp=[setupmysql,setupwp,dbhost,dbname,dbuser,dbpass,dbpref,extdbuser,extdbpass] - custombegin=$(echo "${wpunat}" | cut -c-1) - customlast=$(echo "${wpunat}" | rev | cut -c-1) - wpdata=${wpunat:1:-1} - - # Double coma is for lower case convertion - setmsqcustom=$(echo "${wpdata,,}" | cut -d',' -f 1 -s) - setpwpcustom=$(echo "${wpdata,,}" | cut -d',' -f 2 -s) - - dbhostcustom=$(echo "${wpdata}" | cut -d',' -f 3 -s) - dbnamecustom=$(echo "${wpdata}" | cut -d',' -f 4 -s) - dbusercustom=$(echo "${wpdata}" | cut -d',' -f 5 -s) - dbpasscustom=$(echo "${wpdata}" | cut -d',' -f 6 -s) - dbprefcustom=$(echo "${wpdata}" | cut -d',' -f 7 -s) - exusercustom=$(echo "${wpdata}" | cut -d',' -f 8 -s) - expasscustom=$(echo "${wpdata}" | cut -d',' -f 9 -s) - - if [[ $custombegin == "[" && $customlast == "]" && ((($setmsqcustom == "true" || $setpwpcustom == "true") && -n $dbhostcustom && -n $dbnamecustom && -n $dbusercustom && -n $dbpasscustom && -n $dbprefcustom) || ($setmsqcustom == "false" && $setpwpcustom == "false")) ]]; then - wp="3" - type=$(echo "${type}" | cut -d'=' -f 1 -s) +if [[ $cache == "-root="* ]]; then + value=$(echo "${cache}" | cut -d'=' -f 2 -s) + cache=$(echo "${cache}" | cut -d'=' -f 1 -s) +fi + + +# Evaluate if site to create is WP ( 0 = noWP, 1 = WP, 2 = WP with default values, 3 = WP with custom values ) +wp="0" +if [[ $type == "-wp" || $type == "-wpsubdir" || $type == "-wpsubdom" ]]; then + wp="1" + + if [[ -n $value ]]; then + if [[ $value == "default" ]]; then + wp="2" + else + # -wp=[setupmysql,setupwp,dbhost,dbname,dbuser,dbpass,dbpref,extdbuser,extdbpass] + custombegin=$(echo "${value}" | cut -c-1) + customlast=$(echo "${value}" | rev | cut -c-1) + wpdata=${value:1:-1} + + # Double coma is for lower case convertion + setmsqcustom=$(echo "${wpdata,,}" | cut -d',' -f 1 -s) + setpwpcustom=$(echo "${wpdata,,}" | cut -d',' -f 2 -s) + + dbhostcustom=$(echo "${wpdata}" | cut -d',' -f 3 -s) + dbnamecustom=$(echo "${wpdata}" | cut -d',' -f 4 -s) + dbusercustom=$(echo "${wpdata}" | cut -d',' -f 5 -s) + dbpasscustom=$(echo "${wpdata}" | cut -d',' -f 6 -s) + dbprefcustom=$(echo "${wpdata}" | cut -d',' -f 7 -s) + exusercustom=$(echo "${wpdata}" | cut -d',' -f 8 -s) + expasscustom=$(echo "${wpdata}" | cut -d',' -f 9 -s) + + if [[ $custombegin == "[" && $customlast == "]" && ((($setmsqcustom == "true" || $setpwpcustom == "true") && -n $dbhostcustom && -n $dbnamecustom && -n $dbusercustom && -n $dbpasscustom && -n $dbprefcustom) || ($setmsqcustom == "false" && $setpwpcustom == "false")) ]]; then + wp="3" + fi fi fi fi @@ -168,9 +177,7 @@ elif [ "$type" == "-wpsubdom" ]; then # Parked Domain elif [ "$type" == "-parked" ]; then mapto="NeverMatchAtFirstDotCom" - if [[ -n $cache ]]; then - mapto="$cache" - fi + [[ -n $value ]] && mapto="$value" while [[ ! -a /etc/nginx/sites-available/$mapto ]] do @@ -198,16 +205,17 @@ elif [ "$type" == "-parked" ]; then echo "${end}" # Reverse proxy -elif [[ "$type" == "-proxy" || "$type" == "-proxy="* ]]; then +elif [[ "$type" == "-proxy" ]]; then createsite sudo sed -i '/include /d' /etc/nginx/sites-available/$domain sudo sed -i '/root /d' /etc/nginx/sites-available/$domain sudo sed -i '/index /d' /etc/nginx/sites-available/$domain sudo sed -i '/error_log /r /opt/webinoly/templates/template-site-proxy' /etc/nginx/sites-available/$domain - rparg=$(echo "${type}" | cut -d'=' -f 2 -s) - rphost=$(echo "${rparg}" | cut -d':' -f 1 -s) - rpport=$(echo "${rparg}" | cut -d':' -f 2 -s) + if [[ -n $value ]]; then + rphost=$(echo "${value}" | cut -d':' -f 1 -s) + rpport=$(echo "${value}" | cut -d':' -f 2 -s) + fi echo "${gre}" if [[ -n $rphost ]]; then diff --git a/plugins/webinoly b/plugins/webinoly index 84cf407..3a64cd4 100644 --- a/plugins/webinoly +++ b/plugins/webinoly @@ -9,6 +9,14 @@ arg="$2" source /opt/webinoly/lib/install +# Extract value if exist +if [[ $opt == "-tools-port="* || $opt == "-config-cache="* ]]; then + value=$(echo "${opt}" | cut -d'=' -f 2 -s) + opt=$(echo "${opt}" | cut -d'=' -f 1 -s) +fi + + + if [ "$opt" == "-update" ]; then if [[ $arg == '-vbeta' ]]; then sudo wget --timeout=15 -qrO weby https://qrok.es/wyupdb && sudo bash weby -vbeta @@ -53,7 +61,7 @@ elif [ "$opt" == "-dbpass" ]; then elif [ "$opt" == "-tools-port" ]; then if [[ $(conf_read nginx-tool) == "true" && $(conf_read nginx) == "true" ]]; then oldport="$(conf_read tools-port)" - tools_port $arg + [[ -n $value ]] && tools_port $value || tools_port newport="$(conf_read tools-port)" if [[ $oldport != $newport ]]; then sudo mv /var/www/$oldport /var/www/$newport @@ -149,7 +157,7 @@ elif [ "$opt" == "-config-cache" ]; then othline=$( grep -F "fastcgi_cache_valid 301 302 307 404" /etc/nginx/conf.d/fastcgi.conf ) othval=$(echo "${othline//;}" | rev | cut -d' ' -f 1 | rev) - if [[ -z $arg ]]; then + if [[ -z $value ]]; then echo "${gre}" echo "**********************************************************************" echo "************* Set FastCGI Cache new time values **************" @@ -168,9 +176,13 @@ elif [ "$opt" == "-config-cache" ]; then read -p " Set new value: " oth oth=${oth:-$othval} else - hit=$(echo "${arg}" | cut -d',' -f 1 ) - ina=$(echo "${arg}" | cut -d',' -f 2 ) - oth=$(echo "${arg}" | cut -d',' -f 3 ) + custombegin=$(echo "${value}" | cut -c-1) + customlast=$(echo "${value}" | rev | cut -c-1) + cachedata=${value:1:-1} + + hit=$(echo "${cachedata}" | cut -d',' -f 1 ) + ina=$(echo "${cachedata}" | cut -d',' -f 2 ) + oth=$(echo "${cachedata}" | cut -d',' -f 3 ) fi if [[ "$hit" =~ ^[0-9]+[smhdwMy]$ && "$ina" =~ ^[0-9]+[smhdwMy]$ && "$oth" =~ ^[0-9]+[smhdwMy]$ ]]; then diff --git a/weby b/weby index 3475e52..1223a0a 100644 --- a/weby +++ b/weby @@ -2,7 +2,7 @@ # Webinoly script. # This script is designed to install latest Webinoly. -webyversion="1.3.0-beta" +webyversion="1.3.0" # Check OS support @@ -49,7 +49,7 @@ if [[ $setup == '-vbeta' ]]; then echo "" sudo wget --timeout=15 -qrO $HOME/webinoly.tar https://qrok.es/wytarb echo "$(tput setaf 1)" - echo " [WARNING] You are installing a BETA version of Webinoly and it's not recommended for production enviroments. $(tput sgr0)" + echo "[WARNING] You are installing a BETA version of Webinoly and it's not recommended for production enviroments. $(tput sgr0)" else sudo wget --timeout=15 -qrO $HOME/webinoly.tar https://qrok.es/wytar fi