diff --git a/plugins/webinoly b/plugins/webinoly index 8b53cc0..f6a2864 100644 --- a/plugins/webinoly +++ b/plugins/webinoly @@ -18,12 +18,8 @@ fi if [ "$opt" == "-update" ]; then - if [[ $arg == '-vbeta' ]]; then - sudo wget --timeout=15 -qrO weby https://qrok.es/wyupdb && sudo bash weby -vbeta - else - sudo wget --timeout=15 -qrO weby https://qrok.es/wyupd && sudo bash weby 0 - fi echo "" + sudo wget --timeout=15 -qrO weby https://qrok.es/wyupd && sudo bash weby 0 echo "${gre}Webinoly App has been updated successfully!${end}" elif [[ "$opt" == "-server-update" || "$opt" == "-server-reset" ]]; then diff --git a/weby b/weby index df5c5b6..4a8f6c2 100644 --- a/weby +++ b/weby @@ -1,8 +1,7 @@ #!/bin/bash -# Webinoly script. -# This script is designed to install latest Webinoly. -webyversion="1.3.1" +# Webinoly Installation Script. +webyversion="1.4.0-beta" # Check OS support @@ -21,7 +20,7 @@ fi # Diplay menu to select type of server [[ -n "$1" ]] && setup="$1" || setup=9 -while ! [[ ($setup -ge 0 && $setup -le 4 && $setup =~ ^[0-9]+$) || $setup == '-vbeta' ]] 2>/dev/null +while ! [[ $setup -ge 0 && $setup -le 4 && $setup =~ ^[0-9]+$ ]] 2>/dev/null do echo "" echo " 1 - HTML Server" @@ -38,17 +37,27 @@ done # Download and install Webinoly -[[ ! -d /opt/webinoly ]] && sudo mkdir /opt/webinoly +if [[ $2 == "-ver="* ]]; then + ver=$(echo "$2" | cut -d'=' -f 2 -s) + # Be sure we have a valid server response for the requested version + code=$(wget --server-response https://qrok.es/webinoly?version=$ver 2>&1 | awk '/^ HTTP/{print $2}') + # Get the last code (redirections) + code="${code##*$'\n'}" -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)" + if [[ $code == 200 ]]; then + sudo wget --timeout=15 -qrO $HOME/webinoly.tar https://qrok.es/webinoly?version=$ver + webyversion="$ver" + [[ $ver == "beta" ]] && echo "[WARNING] You are installing a BETA version of Webinoly and it's not recommended for production enviroments. $(tput sgr0)" + else + echo "[ERROR] Version not found or not available! ($code) $(tput sgr0)" + exit 1 + fi else sudo wget --timeout=15 -qrO $HOME/webinoly.tar https://qrok.es/wytar fi +[[ ! -d /opt/webinoly ]] && sudo mkdir /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 f -exec chmod 644 {} \; @@ -67,7 +76,8 @@ if [[ -a /opt/webinoly/webinoly.conf && -n $(conf_read tools-port) ]]; then echo "${gre}Webinoly Configuration file was found, so we will use it!${end}" else portools="22222" - [[ -n "$2" ]] && portools="$2" + [[ -n $2 && $2 != "-ver="* ]] && portools="$2" + echo $portools tools_port $portools fi @@ -76,10 +86,10 @@ conf_write app-version $webyversion # Stack installation -[[ $setup -gt 0 && $setup != 4 ]] && stack -nginx -[[ $setup -gt 1 && $setup != 4 ]] && stack -php -[[ $setup -gt 2 && $setup != 4 ]] && stack -mysql -[[ $setup == 4 ]] && config_load +[[ $setup -gt 0 && $setup -lt 4 ]] && stack -nginx +[[ $setup -gt 1 && $setup -lt 4 ]] && stack -php +[[ $setup == 3 ]] && stack -mysql +[[ $setup == 4 ]] && source /opt/webinoly/lib/webin; config_load # Remove Installation File