install improvements

- Better stats for updates.
- Option to skip stats for custom versions.
- Now we can update from an specific branch.
This commit is contained in:
Cristhian Martínez Ochoa 2018-07-28 20:28:50 -05:00
parent b8e7b6be10
commit aea7852733
3 changed files with 22 additions and 8 deletions

View file

@ -3,7 +3,7 @@ source /opt/webinoly/lib/general
app_version() {
local app_ver="1.5.1"
local app_ver="1.6.0-beta"
echo $app_ver
}
svr_version() {

View file

@ -8,7 +8,7 @@ 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="* ]]; then
if [[ $opt == "-tools-port="* || $opt == "-config-cache="* || $opt == "-clear-cache="* || $opt == "-server-update="* || $opt == "-server-reset="* || $opt == "-timezone="* || $opt == "-update="* ]]; then
value=$(echo "${opt}" | cut -d'=' -f 2 -s)
opt=$(echo "${opt}" | cut -d'=' -f 1 -s)
fi
@ -17,7 +17,8 @@ fi
if [[ $opt == "-update" ]]; then
echo ""
sudo wget --timeout=15 --referer="https://update.webinoly.com/?ver=$(app_version)" -qrO weby https://qrok.es/wyupd && sudo bash weby 0
[[ -n $value ]] && branch="-ver=${value}" || branch=""
sudo wget --timeout=15 --referer="https://update.webinoly.com/?ver=$(app_version)" -qrO weby https://qrok.es/wyupd && sudo bash weby upd $branch
echo "${gre}Webinoly App has been updated successfully!${end}"

23
weby
View file

@ -14,10 +14,16 @@ if ! [[ $distr == "Ubuntu" && $osver =~ ^(xenial|bionic)$ ]]; then
read -p "Press [Enter] key to continue..."
fi
# In case client is just Updating Webinoly and not fresh-installing we need accurate statistics.
[[ -n "$1" ]] && setup="$1" || setup=9
if [[ $setup == "upd" ]]; then
setup=0
update="&update=true"
else
update=""
fi
# Diplay menu to select type of server
[[ -n "$1" ]] && setup="$1" || setup=9
while ! [[ $setup -ge 0 && $setup -le 3 && $setup =~ ^[0-9]+$ ]] 2>/dev/null
do
echo ""
@ -35,7 +41,14 @@ done
# Download and install Webinoly
if [[ $2 == "-ver="* ]]; then
ver=$(echo "$2" | cut -d'=' -f 2 -s)
ver=$(echo "$2" | cut -d'=' -f 2 -s)
# Skip stadistics counters for dev and testing (custom version stats).
if [[ $(echo "${ver}" | rev | cut -c-1) == "*" || $ver == "alpha" ]]; then
ver=${ver//'*'}
statskip="true"
fi
# Be sure we have a valid server response for the requested version
code=$(wget --server-response --spider https://qrok.es/webinoly?version=$ver 2>&1 | awk '/^ HTTP/{print $2}')
# Get the last code (redirections)
@ -47,14 +60,14 @@ if [[ $2 == "-ver="* ]]; then
webyversion="$ver"
[[ $ver == "beta" ]] && echo "[WARNING] You are installing a BETA version of Webinoly and it's not recommended for production enviroments."
# Just for stadistics
[[ $ver != "alpha" ]] && sudo wget --timeout=15 --spider --referer="https://webinoly.com/?version=${ver}" -q https://qrok.es/wyver
[[ $statskip == "true" ]] || sudo wget --timeout=15 --spider --referer="https://webinoly.com/?version=${ver}${update}" -q https://qrok.es/wyver
else
echo "[ERROR] Version not found or not available! ($code) $(tput sgr0)"
exit 1
fi
echo $(tput sgr0)
else
sudo wget --timeout=15 --referer="https://webinoly.com/?option=${setup}" -qrO $HOME/webinoly.tar https://qrok.es/wytar
sudo wget --timeout=15 --referer="https://webinoly.com/?option=${setup}${update}" -qrO $HOME/webinoly.tar https://qrok.es/wytar
fi
[[ ! -d /opt/webinoly ]] && sudo mkdir /opt/webinoly