Update process.
Bionic support removed for new intallattions, only update are allowed now.
This commit is contained in:
Cristhian Martínez Ochoa 2022-11-04 17:35:18 -07:00
parent a12e7279d4
commit dbf755d98b
7 changed files with 34 additions and 12 deletions

View file

@ -353,7 +353,7 @@ bkp_s3_profile() {
sudo sed -i -E "/^[#]?MAX_AGE=/c MAX_AGE=$max_age" $HOME/.duply/$profile/conf sudo sed -i -E "/^[#]?MAX_AGE=/c MAX_AGE=$max_age" $HOME/.duply/$profile/conf
sudo sed -i '/^#MAX_FULLBKP_AGE=/s/#//' $HOME/.duply/$profile/conf sudo sed -i '/^#MAX_FULLBKP_AGE=/s/#//' $HOME/.duply/$profile/conf
sudo sed -i '/^#DUPL_PARAMS="\$DUPL_PARAMS --full-if-older-than \$MAX_FULLBKP_AGE "/s/#//' $HOME/.duply/$profile/conf sudo sed -i '/^#DUPL_PARAMS="\$DUPL_PARAMS --full-if-older-than \$MAX_FULLBKP_AGE "/s/#//' $HOME/.duply/$profile/conf
sudo sed -i -E "/^[#]?TARGET=/c TARGET='boto3+s3://${bucket}'" $HOME/.duply/$profile/conf sudo sed -i -E "/^[#]?TARGET=/c TARGET='s3://${bucket}'" $HOME/.duply/$profile/conf
if [[ -n $s3_compatible_endpoint ]]; then if [[ -n $s3_compatible_endpoint ]]; then
sudo echo "DUPL_PARAMS=\"\$DUPL_PARAMS --s3-endpoint-url $s3_compatible_endpoint \"" >> $HOME/.duply/$profile/conf sudo echo "DUPL_PARAMS=\"\$DUPL_PARAMS --s3-endpoint-url $s3_compatible_endpoint \"" >> $HOME/.duply/$profile/conf

View file

@ -454,10 +454,12 @@ mysql_optim() {
# MySQL login data # MySQL login data
mysql_login_cnf mysql_login_cnf
sudo sed -i '/\[client\]/,/# ClientEnd/{/.*/d}' $MYSQL_CONF_PATH/${MYSQL_CONF_PREF}-webinoly-login.cnf
echo "[client] echo "[client]
user = admin user = admin
password = $( echo $(conf_read mysql-admin) | openssl enc -d -a -salt ) password = $( echo $(conf_read mysql-admin) | openssl enc -d -a -salt )
host = localhost" >> $MYSQL_CONF_PATH/${MYSQL_CONF_PREF}-webinoly-login.cnf host = localhost
# ClientEnd" >> $MYSQL_CONF_PATH/${MYSQL_CONF_PREF}-webinoly-login.cnf
# Disabled by default! # Disabled by default!
[[ $(conf_read mysql-log-binary) != "true" ]] && sudo log -mysql=binary -disable || sudo log -mysql=binary -enable [[ $(conf_read mysql-log-binary) != "true" ]] && sudo log -mysql=binary -disable || sudo log -mysql=binary -enable
@ -564,11 +566,7 @@ nginx_tool_bkp() {
# Duplicity installation directly from source # Duplicity installation directly from source
# Temporal fix to remove warning - wait for: https://github.com/pypa/pip/issues/10556 - remove from stack purge too! # Temporal fix to remove warning - wait for: https://github.com/pypa/pip/issues/10556 - remove from stack purge too!
sudo pip3 install duplicity 2>&1 | grep -v "pip as the 'root' user" sudo pip3 install duplicity 2>&1 | grep -v "pip as the 'root' user"
# Temporal dynvar - in the next stack update we will update all the old snap installations
# Be sure to remove it from "stack" command too.
conf_write bkp-source-tmp true
# https://sourceforge.net/projects/ftplicity/files/duply%20%28simple%20duplicity%29/ # https://sourceforge.net/projects/ftplicity/files/duply%20%28simple%20duplicity%29/
sudo cp /opt/webinoly/templates/general/duply /usr/bin/ sudo cp /opt/webinoly/templates/general/duply /usr/bin/
sudo chmod 755 /usr/bin/duply sudo chmod 755 /usr/bin/duply

View file

@ -274,8 +274,30 @@ oneseven_to_oneight() {
sudo apt update sudo apt update
sudo apt -y install php$(conf_read php-ver)-intl sudo apt -y install php$(conf_read php-ver)-intl
fi fi
# Regenerate conf file
if [[ -f /opt/webinoly/webinoly.conf ]]; then
mv /opt/webinoly/webinoly.conf /opt/webinoly/webinoly.conf.old
IFS=$'\n' # FOR loop takes whitespace as a delimiter, so IFS overwrite this.
for i in $(grep -E "^([a-z\-]+)\:.*$" /opt/webinoly/webinoly.conf.old)
do
conf_write $(echo $i | cut -d':' -f 1 -s) $(echo $i | cut -d':' -f 2- -s)
done
fi
# Duplicity: remove snap, instal from pip
if [[ $(conf_read nginx-tool-bkp) == "true" && -z $(conf_read bkp-source-tmp) ]]; then
sudo snap remove duplicity
conf_write nginx-tool-bkp purged
stack -backups
else
conf_delete bkp-source-tmp
fi
} }
# New MySQL login: here to prevent errors during update process!
[[ ${oldver//.} -lt 18 ]] && sudo webinoly -server-reset=mysql
# Version numbers without point # Version numbers without point
[[ ${oldver//.} -lt 11 ]] && onezero_to_oneone [[ ${oldver//.} -lt 11 ]] && onezero_to_oneone

View file

@ -561,7 +561,7 @@ if [[ -z $critical_mode ]]; then
local ver_three_war="1" local ver_three_war="1"
fi fi
if ! [[ $ver_php_ver =~ ^(5.6|7.0|7.1|7.2|7.3|7.4|8.0|8.1)$ ]]; then if ! [[ $ver_php_ver =~ ^(5.6|7.0|7.1|7.2|7.3|7.4|8.0|8.1|8.2)$ ]]; then
echo "${dim}- [WARNING] Unknown PHP version!${end}${red}" echo "${dim}- [WARNING] Unknown PHP version!${end}${red}"
local ver_three_war="1" local ver_three_war="1"
elif [[ $ver_php_ver =~ ^(5.6|7.0|7.1|7.2|7.3)$ ]]; then elif [[ $ver_php_ver =~ ^(5.6|7.0|7.1|7.2|7.3)$ ]]; then

View file

@ -448,10 +448,11 @@ server_reset() {
fi fi
# Check MySQL Conf # Check MySQL Conf
if [[ $(conf_read mysql-optim) == "true" && $server_reset =~ ^(mysql|all)$ ]]; then # Here we don't check for optim variable because in very old installations don't exist and it breaks the update process!
if [[ $(conf_read mysql) == "true" && $server_reset =~ ^(mysql|all)$ ]]; then
mysql_optim mysql_optim
echo "${gre}MySQL settings has been updated successfully!${end}" echo "${gre}MySQL settings has been updated successfully!${end}"
elif [[ $(conf_read mysql-optim) != "true" && $server_reset == "mysql" ]]; then elif [[ $(conf_read mysql) != "true" && $server_reset == "mysql" ]]; then
echo "${red}[ERROR] MySQL settings couldn't been updated, seems like is not installed in your server!${end}" echo "${red}[ERROR] MySQL settings couldn't been updated, seems like is not installed in your server!${end}"
err_cont=true err_cont=true
fi fi

View file

@ -342,7 +342,7 @@ elif [[ -n $purge && -n $backups ]]; then
echo "${gre}${dim}Backup (duply) profiles deleted!${end}" echo "${gre}${dim}Backup (duply) profiles deleted!${end}"
fi fi
[[ -z $(conf_read bkp-source-tmp) ]] && sudo snap remove duplicity || sudo pip3 uninstall -y duplicity 2>&1 | grep -v "pip as the 'root' user" sudo pip3 uninstall -y duplicity 2>&1 | grep -v "pip as the 'root' user"
sudo apt -y purge python3-boto3 sudo apt -y purge python3-boto3
sudo rm -rf /usr/bin/duply sudo rm -rf /usr/bin/duply

3
weby
View file

@ -4,7 +4,8 @@
# Check OS support # Check OS support
distr=`echo $(lsb_release -i | cut -d':' -f 2)` distr=`echo $(lsb_release -i | cut -d':' -f 2)`
osver=`echo $(lsb_release -c | cut -d':' -f 2)` osver=`echo $(lsb_release -c | cut -d':' -f 2)`
if ! [[ $distr == "Ubuntu" && $osver =~ ^(bionic|focal|jammy)$ ]]; then # Supported: 22.04 and 20.04 (18.04 just for updates, no new installations)
if [[ $distr != "Ubuntu" ]] || ! [[ $osver =~ ^(bionic|focal|jammy)$ ]] || [[ $osver == "bionic" && $1 != "upd" ]]; then
echo "$(tput setaf 1)" echo "$(tput setaf 1)"
echo "[ERROR] This OS is not supported by Webinoly and could not work properly. $(tput dim)(${distr} '${osver}')" echo "[ERROR] This OS is not supported by Webinoly and could not work properly. $(tput dim)(${distr} '${osver}')"
echo "$(tput sgr0)" echo "$(tput sgr0)"