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/remove

90 lines
3 KiB
Text
Raw Normal View History

2019-09-20 12:55:12 +02:00
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
2021-08-21 17:30:03 +02:00
ynh_script_progression --message="Loading installation settings..."
2019-09-20 12:55:12 +02:00
app=$YNH_APP_INSTANCE_NAME
2021-08-21 17:30:03 +02:00
domain=$(ynh_app_setting_get --app=$app --key=domain)
port=$(ynh_app_setting_get --app=$app --key=port)
db_name_app=$(ynh_app_setting_get --app=$app --key=db_name_app)
db_user_app=$db_name_app
db_name_web=$(ynh_app_setting_get --app=$app --key=db_name_web)
db_user_web=$db_name_web
2019-09-20 12:55:12 +02:00
#=================================================
# STANDARD REMOVE
#=================================================
2021-08-21 17:30:03 +02:00
# REMOVE SERVICE INTEGRATION IN YUNOHOST
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`)
if ynh_exec_warn_less yunohost service status $app >/dev/null
then
ynh_script_progression --message="Removing $app service integration..."
yunohost service remove $app
fi
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`)
if ynh_exec_warn_less yunohost service status $app >/dev/null
then
ynh_script_progression --message="Removing $app-web service integration..."
yunohost service remove "$app-web"
fi
2019-09-20 12:55:12 +02:00
#=================================================
# REMOVE THE POSTGRESQL DATABASE
#=================================================
2021-08-21 17:30:03 +02:00
ynh_script_progression --message="Removing the PostgreSQL database..."
2019-09-20 12:55:12 +02:00
2021-08-21 17:30:03 +02:00
# 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
#=================================================
# REMOVE DEPENDENCIES
#=================================================
2021-08-21 17:30:03 +02:00
ynh_script_progression --message="Removing dependencies..."
2019-09-20 12:55:12 +02:00
2021-08-21 17:30:03 +02:00
# Remove metapackage and its dependencies
2019-09-20 12:55:12 +02:00
ynh_remove_app_dependencies
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
2021-08-21 17:30:03 +02:00
ynh_script_progression --message="Removing NGINX web server configuration..."
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
# SPECIFIC REMOVE
2019-09-20 12:55:12 +02:00
#=================================================
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
#=================================================
# GENERIC FINALIZATION
#=================================================
# END OF SCRIPT
#=================================================
2021-08-21 17:30:03 +02:00
ynh_script_progression --message="Removal of $app completed"