2019-09-20 12:55:12 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
2024-05-16 13:23:03 +02:00
|
|
|
# REMOVE SYSTEM CONFIGURATIONS
|
2019-09-20 12:55:12 +02:00
|
|
|
#=================================================
|
2024-05-16 13:23:03 +02:00
|
|
|
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
|
2019-09-20 12:55:12 +02:00
|
|
|
|
2021-08-21 17:30:03 +02:00
|
|
|
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
2024-05-16 13:23:03 +02:00
|
|
|
if ynh_exec_warn_less yunohost service status "$app" >/dev/null; then
|
|
|
|
yunohost service remove "$app"
|
2021-08-21 17:30:03 +02:00
|
|
|
fi
|
2024-05-16 13:23:03 +02:00
|
|
|
if ynh_exec_warn_less yunohost service status "$app-web" >/dev/null; then
|
|
|
|
yunohost service remove "$app-web"
|
2021-08-21 17:30:03 +02:00
|
|
|
fi
|
2019-09-20 12:55:12 +02:00
|
|
|
|
2021-08-25 03:39:10 +02:00
|
|
|
# Remove the dedicated systemd config
|
2024-05-16 13:23:03 +02:00
|
|
|
ynh_systemd_action --service_name="$app" --action="stop"
|
2021-08-25 03:39:10 +02:00
|
|
|
ynh_systemd_action --service_name="$app-web" --action="stop"
|
2024-05-16 13:23:03 +02:00
|
|
|
systemctl disable "$app.service" --quiet
|
|
|
|
systemctl disable "$app-web.service" --quiet
|
2019-09-20 12:55:12 +02:00
|
|
|
|
2021-08-21 17:30:03 +02:00
|
|
|
# Remove the dedicated NGINX config
|
2019-09-20 12:55:12 +02:00
|
|
|
ynh_remove_nginx_config
|
|
|
|
|
|
|
|
#=================================================
|
2021-08-21 17:30:03 +02:00
|
|
|
# REMOVE VARIOUS FILES
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Removing various files..."
|
2019-09-20 12:55:12 +02:00
|
|
|
|
2021-08-21 17:30:03 +02:00
|
|
|
ynh_secure_remove --file="/usr/share/mailman3-web"
|
2019-09-20 12:55:12 +02:00
|
|
|
|
2021-08-21 17:30:03 +02:00
|
|
|
# Remove a directory securely
|
|
|
|
ynh_secure_remove --file="/etc/$app"
|
2019-09-20 12:55:12 +02:00
|
|
|
|
2021-08-25 03:39:10 +02:00
|
|
|
# Remove hook for postfix conf
|
|
|
|
ynh_secure_remove --file="/usr/share/yunohost/hooks/conf_regen/98-postfix_mailman3"
|
|
|
|
yunohost tools regen-conf postfix
|
2024-05-16 13:23:03 +02:00
|
|
|
ynh_systemd_action --service_name="postfix" --action="restart"
|
2021-08-25 03:39:10 +02:00
|
|
|
|
2019-09-20 12:55:12 +02:00
|
|
|
#=================================================
|
2024-05-16 13:23:03 +02:00
|
|
|
# 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"
|
|
|
|
|
2019-09-20 12:55:12 +02:00
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
2021-08-21 17:30:03 +02:00
|
|
|
ynh_script_progression --message="Removal of $app completed"
|