mirror of
https://github.com/YunoHost-Apps/mailman3_ynh.git
synced 2024-09-03 19:36:17 +02:00
71 lines
2.7 KiB
Bash
Executable file
71 lines
2.7 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
source _common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#=================================================
|
|
# STOP SYSTEMD SERVICE
|
|
#=================================================
|
|
ynh_script_progression --message="Stopping a systemd service..."
|
|
|
|
ynh_systemd_action --service_name="$app" --action="stop"
|
|
ynh_systemd_action --service_name="$app-web" --action="stop"
|
|
|
|
#=================================================
|
|
# ADD A CONFIGURATION
|
|
#=================================================
|
|
ynh_script_progression --message="Updating $app's configuration files..."
|
|
|
|
ynh_add_config --template="mailman.cfg" --destination="/etc/mailman3/mailman.cfg"
|
|
chmod 400 "/etc/mailman3/mailman.cfg"
|
|
chown list:list "/etc/mailman3/mailman.cfg"
|
|
|
|
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"
|
|
|
|
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"
|
|
|
|
#=================================================
|
|
# 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
|
|
ynh_systemd_action --service_name="postfix" --action="reload"
|
|
|
|
#=================================================
|
|
# REAPPLY SYSTEM CONFIGURATIONS
|
|
#=================================================
|
|
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
|
|
|
|
# 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"
|
|
yunohost service add "$app-web" --description="Mailman3 web daemon" --log="/var/log/$app/web/mailman-web.log"
|
|
|
|
#=================================================
|
|
# START SYSTEMD SERVICE
|
|
#=================================================
|
|
ynh_script_progression --message="Starting $app's systemd service..." --weight=1
|
|
|
|
ynh_systemd_action --service_name="$app" --action=start
|
|
ynh_systemd_action --service_name="$app-web" --action=start
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Upgrade of $app completed"
|