From 22bd82213ac67678d979a4086ba2e8429209ccc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristhian=20Mart=C3=ADnez=20Ochoa?= Date: Fri, 6 Oct 2023 16:35:14 -0700 Subject: [PATCH] hotfix AWS IAM Roles failing with backups. Installer fixed for wrng errors displayed. --- lib/bkp | 4 ++-- lib/general | 2 +- weby | 28 ++++++++++++++++++++++------ 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/lib/bkp b/lib/bkp index 437c674..c85c153 100644 --- a/lib/bkp +++ b/lib/bkp @@ -223,7 +223,7 @@ check_duply_profile() { bkp_s3_profile() { - if [[ ! -f $HOME/.aws/credentials || ( -f $HOME/.aws/credentials && ( ! -s $HOME/.aws/credentials || -z $(grep '[^[:space:]]' $HOME/.aws/credentials ))) && $(conf_read awsiamrole) != true ]]; then + if [[ ( ! -f $HOME/.aws/credentials || ( -f $HOME/.aws/credentials && ( ! -s $HOME/.aws/credentials || -z $(grep '[^[:space:]]' $HOME/.aws/credentials )))) && $(conf_read awsiamrole) != true ]]; then echo "${red}[ERROR] AWS S3 Credentials not found!${end}" exit 1 fi @@ -403,7 +403,7 @@ bkp_s3_list() { s3_send() { - if [[ ! -f $HOME/.aws/credentials || ( -f $HOME/.aws/credentials && ( ! -s $HOME/.aws/credentials || -z $(grep '[^[:space:]]' $HOME/.aws/credentials ))) && $(conf_read awsiamrole) != true ]]; then + if [[ ( ! -f $HOME/.aws/credentials || ( -f $HOME/.aws/credentials && ( ! -s $HOME/.aws/credentials || -z $(grep '[^[:space:]]' $HOME/.aws/credentials )))) && $(conf_read awsiamrole) != true ]]; then echo "${red}[ERROR] AWS S3 Credentials not found!${end}" exit 1 fi diff --git a/lib/general b/lib/general index 9190c7c..db787e1 100644 --- a/lib/general +++ b/lib/general @@ -4,7 +4,7 @@ # Prevent 'tput' errors when running from Cron [[ -z $TERM || $TERM == "unknown" || $TERM == "dumb" ]] && export TERM=dumb -readonly app_version="1.17.5" +readonly app_version="1.17.6" readonly svr_version="1.8" readonly os_ubuntu_supported=(bionic focal jammy) # https://ubuntu.com/about/release-cycle readonly php_supported=(7.4 8.0 8.1 8.2) # https://www.php.net/supported-versions.php diff --git a/weby b/weby index 9f70337..883dc7f 100644 --- a/weby +++ b/weby @@ -113,6 +113,7 @@ if [[ -n $ver ]]; then if [[ $code == 200 ]]; then sudo wget --timeout=15 -t 1 -qrO $HOME/webinoly.tar https://qrok.es/webinoly?version=$ver [[ $ver == "beta" ]] && echo "$(tput setaf 1)[WARNING] You are installing a BETA version of Webinoly and it's not recommended for production enviroments.$(tput sgr0)" + type="Custom" else echo "$(tput setaf 1)[ERROR] Version not found or not available! ($code) $(tput sgr0)" sudo rm weby @@ -157,6 +158,19 @@ if [[ -f /opt/webinoly/webinoly.conf ]]; then oldver=$(conf_read server-version) newver=$svr_version echo "${gre}${dim}Webinoly Configuration file was found, so we will use it!${end}" + + # Reinstall after uninstalled! (Can be considered new) + if [[ -z $update ]] && ! [[ $ver =~ ^(alpha|beta)$ ]]; then + new_install="true" + echo "${blu}${dim}It seems like you're reinstalling Webinoly! (Upgrading from: ${oldapp})${end} ${blu}${bol}Welcome back!!!${end}" + + # Downgrade! + elif [[ -n $update && $type == "Custom" ]]; then + echo "${blu}Updating to the latest version is always recommended! ${dim}(Downgrade to: ${ver})${end}" + fi + +elif [[ $type == "Custom" ]]; then + echo "${blu}Custom version installed: ${ver}${end}" else new_install="true" fi @@ -165,7 +179,10 @@ fi # Write app version webyversion=$app_version conf_write app-version $webyversion -[[ $ver =~ ^(alpha|beta)$ ]] && conf_write branch $ver +if [[ $ver =~ ^(alpha|beta)$ ]]; then + conf_write branch $ver + echo "${blu}${bol}This is a testing version, please don't use it in production!${end}" +fi # Ping to Webinoly Stats @@ -177,17 +194,16 @@ if [[ $statskip != "true" ]]; then type="New" elif [[ $ver == "beta" ]]; then type="Beta" - elif [[ -n $update && $ver =~ ^[0-9]{1}\.[0-9]{1,2}\.[0-9]{1,2}$ ]]; then + elif [[ -n $update && $type == "Custom" ]]; then type="Downgrade" webyversion=$(wget --timeout=10 -t 1 -qO- https://api.webinoly.com/check?text=true) opt=$ver - elif [[ -n $setup && $ver =~ ^[0-9]{1}\.[0-9]{1,2}\.[0-9]{1,2}$ ]]; then - type="Custom" - webyversion=$(wget --timeout=10 -t 1 -qO- https://api.webinoly.com/check?text=true) - opt=$ver elif [[ -n $update && -n $oldapp ]]; then type="Updates" opt=$oldapp + elif [[ $type == "Custom" ]]; then + webyversion=$(wget --timeout=10 -t 1 -qO- https://api.webinoly.com/check?text=true) + opt=$ver else type="Error" conf_write init-error-flag true