1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/mailman3_ynh.git synced 2024-09-03 19:36:17 +02:00
mailman3_ynh/scripts/upgrade

87 lines
3.2 KiB
Text
Raw Normal View History

2019-09-20 12:55:12 +02:00
#!/bin/bash
2021-08-21 17:30:03 +02:00
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Stopping a systemd service..."
2024-05-16 13:30:17 +02:00
ynh_systemd_action --service_name="$app" --action="stop"
ynh_systemd_action --service_name="$app-web" --action="stop"
2021-08-21 17:30:03 +02:00
2024-05-17 13:31:37 +02:00
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
if [ -z "$db_user_app" ]; then
db_user_app="$db_name_app"
ynh_app_setting_set --app="$app" --key="db_user_app" --value="$db_user_app"
fi
if [ -z "$db_user_web" ]; then
db_user_web="$db_name_web"
ynh_app_setting_set --app="$app" --key="db_user_web" --value="$db_user_web"
fi
2021-08-21 17:30:03 +02:00
#=================================================
2024-05-16 13:30:17 +02:00
# ADD A CONFIGURATION
2021-08-21 17:30:03 +02:00
#=================================================
2024-05-16 13:30:17 +02:00
ynh_script_progression --message="Updating $app's configuration files..."
2021-08-21 17:30:03 +02:00
2024-05-16 13:30:17 +02:00
ynh_add_config --template="mailman.cfg" --destination="/etc/mailman3/mailman.cfg"
chmod 400 "/etc/mailman3/mailman.cfg"
chown list:list "/etc/mailman3/mailman.cfg"
2021-08-21 17:30:03 +02:00
2024-05-16 13:30:17 +02:00
ynh_add_config --template="mailman-hyperkitty.cfg" --destination="/etc/mailman3/mailman-hyperkitty.cfg"
chmod 400 "/etc/mailman3/mailman-hyperkitty.cfg"
chown list:list "/etc/mailman3/mailman-hyperkitty.cfg"
2021-08-21 17:30:03 +02:00
2024-05-16 13:30:17 +02:00
ynh_add_config --template="mailman-web.py" --destination="/etc/mailman3/mailman-web.py"
chmod 440 "/etc/mailman3/mailman-web.py"
chown list:www-data "/etc/mailman3/mailman-web.py"
2021-08-21 17:30:03 +02:00
2021-08-25 03:39:10 +02:00
#=================================================
# POSTFIX CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring postfix mail server..."
# Add postfix configuration hook and regen postfix conf
cp -R ../sources/hooks/conf_regen/98-postfix_mailman3 /usr/share/yunohost/hooks/conf_regen/
yunohost tools regen-conf postfix
2024-05-16 13:30:17 +02:00
ynh_systemd_action --service_name="postfix" --action="reload"
2021-08-25 03:39:10 +02:00
2021-08-21 17:30:03 +02:00
#=================================================
2024-05-16 13:30:17 +02:00
# REAPPLY SYSTEM CONFIGURATIONS
2021-08-21 17:30:03 +02:00
#=================================================
2024-05-16 13:30:17 +02:00
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
2021-08-21 17:30:03 +02:00
2024-05-16 13:30:17 +02:00
# Create a dedicated NGINX config
ynh_add_nginx_config
systemctl enable "$app.service" --quiet
systemctl enable "$app-web.service" --quiet
yunohost service add "$app" --description="Mailman3 daemon" --log="/var/log/$app/mailman.log"
2021-08-25 03:39:10 +02:00
yunohost service add "$app-web" --description="Mailman3 web daemon" --log="/var/log/$app/web/mailman-web.log"
2021-08-21 17:30:03 +02:00
#=================================================
# START SYSTEMD SERVICE
#=================================================
2024-05-16 13:30:17 +02:00
ynh_script_progression --message="Starting $app's systemd service..." --weight=1
2021-08-21 17:30:03 +02:00
2024-05-16 13:30:17 +02:00
ynh_systemd_action --service_name="$app" --action=start
2021-08-21 17:30:03 +02:00
ynh_systemd_action --service_name="$app-web" --action=start
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Upgrade of $app completed"