1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/sogo_ynh.git synced 2024-09-03 20:26:07 +02:00
sogo_ynh/scripts/remove

95 lines
3.2 KiB
Text
Raw Normal View History

2016-03-18 18:38:54 +01:00
#!/bin/bash
2018-08-14 22:18:22 +02:00
#=================================================
# GENERIC START
#=================================================
2022-01-14 23:57:33 +01:00
# IMPORT GENERIC HELPERS
#=================================================
2016-03-18 18:38:54 +01:00
2022-01-14 23:57:33 +01:00
source _common.sh
2020-11-17 23:55:57 +01:00
source /usr/share/yunohost/helpers
2022-01-14 23:57:33 +01:00
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
2018-08-14 22:18:22 +02:00
app=$YNH_APP_INSTANCE_NAME
2022-01-14 23:57:33 +01:00
domain=$(ynh_app_setting_get --app=$app --key=domain)
port=$(ynh_app_setting_get --app=$app --key=port)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
2016-03-18 21:00:30 +01:00
2018-08-14 22:18:22 +02:00
#=================================================
# STANDARD REMOVE
#=================================================
2022-01-14 23:57:33 +01:00
# REMOVE SERVICE INTEGRATION IN YUNOHOST
#=================================================
2016-03-18 21:00:30 +01:00
2022-01-14 23:57:33 +01: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..." --weight=1
yunohost service remove $app
fi
#=================================================
# STOP AND REMOVE SERVICE
#=================================================
ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1
# Remove the dedicated systemd config
ynh_remove_systemd_config
#=================================================
# REMOVE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Removing logrotate configuration..." --weight=1
# Remove the app-specific logrotate config
ynh_remove_logrotate
#=================================================
# REMOVE THE MYSQL DATABASE
#=================================================
ynh_script_progression --message="Removing the MySQL database..." --weight=1
2018-08-14 22:18:22 +02:00
# Remove a database if it exists, along with the associated user
2022-01-14 23:57:33 +01:00
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
2018-08-14 22:18:22 +02:00
2022-01-14 23:57:33 +01:00
# Remove the dedicated NGINX config
ynh_remove_nginx_config
2018-08-14 22:18:22 +02:00
2022-01-14 23:57:33 +01:00
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..." --weight=3
2018-08-14 22:18:22 +02:00
2022-01-14 23:57:33 +01:00
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
2021-06-29 07:55:31 +02:00
2022-01-14 23:57:33 +01:00
#=================================================
# SPECIFIC REMOVE
#=================================================
# REMOVE VARIOUS FILES
#=================================================
ynh_script_progression --message="Removing various files..." --weight=1
2021-06-29 07:55:31 +02:00
2022-01-14 23:57:33 +01:00
ynh_secure_remove --file="/etc/$app"
2020-05-24 00:32:03 +02:00
2022-01-14 23:57:33 +01:00
# Remove stunnel config
ynh_secure_remove --file="/etc/stunnel/$app.conf"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Removal of $app completed" --last