2015-09-14 17:12:17 +02:00
|
|
|
#!/bin/bash
|
2016-07-05 15:22:12 +02:00
|
|
|
|
2022-02-13 22:09:18 +01:00
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
2017-05-18 23:28:18 +02:00
|
|
|
source _common.sh
|
2022-02-13 22:09:18 +01:00
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# LOAD SETTINGS
|
|
|
|
#=================================================
|
2022-10-20 02:27:52 +02:00
|
|
|
ynh_script_progression --message="Loading settings..." --weight=1
|
2016-12-14 10:55:15 +01:00
|
|
|
|
2017-05-18 23:28:18 +02:00
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
2016-12-14 10:55:15 +01:00
|
|
|
|
2022-02-13 22:09:18 +01:00
|
|
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
|
|
|
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)
|
|
|
|
conf_file=$(ynh_app_setting_get --app=$app --key=conf_file)
|
2016-07-05 15:22:12 +02:00
|
|
|
|
2022-02-13 22:09:18 +01:00
|
|
|
#=================================================
|
|
|
|
# STANDARD REMOVE
|
|
|
|
#=================================================
|
|
|
|
# REMOVE SERVICE INTEGRATION IN YUNOHOST
|
|
|
|
#=================================================
|
2016-07-05 15:22:12 +02:00
|
|
|
|
2022-02-13 22:09:18 +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
|
2022-10-20 02:27:52 +02:00
|
|
|
ynh_script_progression --message="Removing $app service integration..." --weight=1
|
2022-02-13 22:09:18 +01:00
|
|
|
yunohost service remove $app
|
|
|
|
fi
|
2018-12-14 03:36:58 +01:00
|
|
|
|
2022-02-13 22:09:18 +01:00
|
|
|
#=================================================
|
2022-02-17 01:23:35 +01:00
|
|
|
# STOP AND REMOVE SERVICE
|
2022-02-13 22:09:18 +01:00
|
|
|
#=================================================
|
2022-10-20 02:27:52 +02:00
|
|
|
ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1
|
2022-02-17 01:23:35 +01:00
|
|
|
|
|
|
|
# Remove the dedicated systemd config
|
|
|
|
ynh_remove_systemd_config
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# REMOVE THE POSTGRESQL DATABASE
|
|
|
|
#=================================================
|
2022-10-20 02:27:52 +02:00
|
|
|
ynh_script_progression --message="Removing the PostgreSQL database..." --weight=1
|
2017-05-18 23:28:18 +02:00
|
|
|
|
2022-02-13 22:09:18 +01:00
|
|
|
# Remove a database if it exists, along with the associated user
|
|
|
|
ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# REMOVE APP MAIN DIR
|
|
|
|
#=================================================
|
2022-10-20 02:27:52 +02:00
|
|
|
ynh_script_progression --message="Removing app main directory..." --weight=1
|
2016-12-14 10:10:53 +01:00
|
|
|
|
2022-02-13 22:09:18 +01:00
|
|
|
# Remove the app directory securely
|
|
|
|
ynh_secure_remove --file="$final_path"
|
2015-09-14 17:12:17 +02:00
|
|
|
|
2022-02-13 22:09:18 +01:00
|
|
|
#=================================================
|
|
|
|
# REMOVE NGINX CONFIGURATION
|
|
|
|
#=================================================
|
2022-10-20 02:27:52 +02:00
|
|
|
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
|
2022-02-13 22:09:18 +01:00
|
|
|
|
|
|
|
# Remove the dedicated NGINX config
|
2018-12-14 03:36:58 +01:00
|
|
|
ynh_remove_nginx_config
|
2018-09-27 00:31:17 +02:00
|
|
|
|
2022-02-13 22:09:18 +01:00
|
|
|
#=================================================
|
|
|
|
# REMOVE DEPENDENCIES
|
|
|
|
#=================================================
|
2022-10-20 02:27:52 +02:00
|
|
|
ynh_script_progression --message="Removing dependencies..." --weight=1
|
2022-02-13 22:09:18 +01:00
|
|
|
|
|
|
|
# Remove metapackage and its dependencies
|
|
|
|
ynh_remove_app_dependencies
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# SPECIFIC REMOVE
|
|
|
|
#=================================================
|
|
|
|
# REMOVE VARIOUS FILES
|
|
|
|
#=================================================
|
2022-10-20 02:27:52 +02:00
|
|
|
ynh_script_progression --message="Removing various files..." --weight=1
|
2022-02-13 22:09:18 +01:00
|
|
|
|
2022-02-17 01:23:35 +01:00
|
|
|
# Remove a directory securely
|
|
|
|
ynh_secure_remove --file="/etc/$app"
|
|
|
|
|
|
|
|
# Remove the log files
|
|
|
|
ynh_secure_remove --file="/var/log/$app.log"
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# REMOVE SWAP
|
|
|
|
#=================================================
|
2022-02-13 22:09:18 +01:00
|
|
|
|
2022-05-29 16:07:32 +02:00
|
|
|
if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then
|
|
|
|
:
|
|
|
|
else
|
2022-10-20 02:27:52 +02:00
|
|
|
ynh_script_progression --message="Removing swap..." --weight=1
|
2022-05-29 16:07:32 +02:00
|
|
|
ynh_del_swap
|
|
|
|
fi
|
2022-02-13 22:09:18 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC FINALIZATION
|
|
|
|
#=================================================
|
|
|
|
# REMOVE DEDICATED USER
|
|
|
|
#=================================================
|
2022-10-20 02:27:52 +02:00
|
|
|
ynh_script_progression --message="Removing the dedicated system user..." --weight=1
|
2022-02-13 22:09:18 +01:00
|
|
|
|
|
|
|
# Delete a system user
|
|
|
|
ynh_system_user_delete --username=$app
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
2022-10-20 02:27:52 +02:00
|
|
|
ynh_script_progression --message="Removal of $app completed" --last
|