1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/sogo_ynh.git synced 2024-09-03 20:26:07 +02:00
sogo_ynh/scripts/upgrade
2024-08-31 11:05:29 +02:00

54 lines
1.8 KiB
Bash
Executable file

#!/bin/bash
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# UPGRADE SETTINGS FROM OLD INSTALL
#=================================================
ynh_script_progression "Ensuring downward compatibility..."
# Manage migrations
ynh_script_progression "Migrating database if needed..."
if ynh_app_upgrading_from_version_before_or_equal_to 4.0.0~ynh0; then
ynh_replace --match=__APP__ --replace="$app" --file=migrations/3.2-4.0.sh
ynh_replace --match=__DBUSER__ --replace="$db_user" --file=migrations/3.2-4.0.sh
ynh_replace --match=__DBPASS__ --replace="$db_pwd" --file=migrations/3.2-4.0.sh
bash migrations/3.2-4.0.sh
fi
#=================================================
# UPDATE A CONFIG FILE
#=================================================
ynh_script_progression "Configuring application..."
# Configure SOGO
ynh_config_add --template="sogo.conf" --destination="/etc/$app/sogo.conf"
#=================================================
# REAPPLY SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression "Upgrading system configurations related to $app..."
config_nginx
yunohost service add "sogo" --description="Groupware for E-Mail, Contacts and Calender" --log="/var/log/$app/$app.log"
# Use logrotate to manage app-specific logfile(s)
ynh_config_add_logrotate "/var/log/$app/sogo.log"
set_permissions
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression "Starting $app's systemd service..."
ynh_systemctl --service="$app" --action="restart" --log_path="systemd"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression "Upgrade of $app completed"