mirror of
https://github.com/YunoHost-Apps/mailman3_ynh.git
synced 2024-09-03 19:36:17 +02:00
60 lines
2.1 KiB
Bash
Executable file
60 lines
2.1 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
source _common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#=================================================
|
|
# REMOVE SYSTEM CONFIGURATIONS
|
|
#=================================================
|
|
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
|
|
|
|
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
|
if ynh_exec_warn_less yunohost service status "$app" >/dev/null; then
|
|
yunohost service remove "$app"
|
|
fi
|
|
if ynh_exec_warn_less yunohost service status "$app-web" >/dev/null; then
|
|
yunohost service remove "$app-web"
|
|
fi
|
|
|
|
# Remove the dedicated systemd config
|
|
ynh_systemd_action --service_name="$app" --action="stop"
|
|
ynh_systemd_action --service_name="$app-web" --action="stop"
|
|
systemctl disable "$app.service" --quiet
|
|
systemctl disable "$app-web.service" --quiet
|
|
|
|
# Remove the dedicated NGINX config
|
|
ynh_remove_nginx_config
|
|
|
|
#=================================================
|
|
# REMOVE VARIOUS FILES
|
|
#=================================================
|
|
ynh_script_progression --message="Removing various files..."
|
|
|
|
ynh_secure_remove --file="/usr/share/mailman3-web"
|
|
|
|
# Remove a directory securely
|
|
ynh_secure_remove --file="/etc/$app"
|
|
|
|
# Remove hook for postfix conf
|
|
ynh_secure_remove --file="/usr/share/yunohost/hooks/conf_regen/98-postfix_mailman3"
|
|
yunohost tools regen-conf postfix
|
|
ynh_systemd_action --service_name="postfix" --action="restart"
|
|
|
|
#=================================================
|
|
# REMOVE THE POSTGRESQL DATABASE
|
|
#=================================================
|
|
ynh_script_progression --message="Removing the PostgreSQL database..."
|
|
|
|
# Remove a database if it exists, along with the associated user
|
|
ynh_psql_remove_db --db_user="$db_user_app" --db_name="$db_name_app"
|
|
ynh_psql_remove_db --db_user="$db_user_web" --db_name="$db_name_web"
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Removal of $app completed"
|