1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/bozon_ynh.git synced 2024-09-03 18:16:09 +02:00
bozon_ynh/scripts/remove

83 lines
2.6 KiB
Text
Raw Normal View History

#!/bin/bash
2016-03-23 19:30:43 +01:00
2020-01-05 19:49:24 +01:00
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
2022-07-28 03:39:57 +02:00
source _common.sh
2016-10-13 06:51:38 +02:00
source /usr/share/yunohost/helpers
2016-05-23 21:40:55 +02:00
2020-01-05 19:49:24 +01:00
#=================================================
# LOAD SETTINGS
#=================================================
2020-11-27 07:20:16 +01:00
ynh_script_progression --message="Loading installation settings..." --weight=1
2022-07-28 03:39:57 +02:00
2016-10-13 06:51:38 +02:00
app=$YNH_APP_INSTANCE_NAME
2022-07-28 03:39:57 +02:00
domain=$(ynh_app_setting_get --app=$app --key=domain)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
2016-03-23 19:30:43 +01:00
2020-01-05 19:49:24 +01:00
#=================================================
# STANDARD REMOVE
#=================================================
# REMOVE APP MAIN DIR
#=================================================
2020-11-27 07:20:16 +01:00
ynh_script_progression --message="Removing app main directory..." --weight=1
2022-07-28 03:39:57 +02:00
# Remove the app directory securely
2020-01-05 19:49:24 +01:00
ynh_secure_remove --file="$final_path"
2022-07-28 03:39:57 +02:00
#=================================================
# REMOVE DATA DIR
#=================================================
# Remove the data directory if --purge option is used
if [ "${YNH_APP_PURGE:-0}" -eq 1 ]
then
ynh_script_progression --message="Removing app data directory..."
ynh_secure_remove --file="$datadir"
fi
2020-01-05 19:49:24 +01:00
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
2022-07-28 03:39:57 +02:00
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
# Remove the dedicated NGINX config
2017-09-22 19:33:28 +02:00
ynh_remove_nginx_config
2020-01-05 19:49:24 +01:00
#=================================================
# REMOVE PHP-FPM CONFIGURATION
#=================================================
2022-07-28 03:39:57 +02:00
ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=1
# Remove the dedicated PHP-FPM config
2017-09-22 19:33:28 +02:00
ynh_remove_fpm_config
2020-01-05 19:49:24 +01:00
#=================================================
2022-07-28 03:39:57 +02:00
# REMOVE DEPENDENCIES
2020-01-05 19:49:24 +01:00
#=================================================
2022-07-28 03:39:57 +02:00
ynh_script_progression --message="Removing dependencies..." --weight=1
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
2020-01-05 19:49:24 +01:00
#=================================================
# GENERIC FINALIZATION
#=================================================
# REMOVE DEDICATED USER
#=================================================
2020-11-27 07:20:16 +01:00
ynh_script_progression --message="Removing the dedicated system user..." --weight=1
2022-07-28 03:39:57 +02:00
# Delete a system user
ynh_system_user_delete --username=$app
2020-01-05 19:49:24 +01:00
#=================================================
# END OF SCRIPT
#=================================================
2022-07-28 03:39:57 +02:00
2020-11-27 07:20:16 +01:00
ynh_script_progression --message="Removal of $app completed" --last