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

84 lines
2.6 KiB
Text
Raw Normal View History

2015-05-24 23:01:16 +02:00
#!/bin/bash
2021-11-25 19:38:26 +01:00
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
2017-02-21 14:51:22 +01:00
2021-11-25 19:38:26 +01:00
source _common.sh
source /usr/share/yunohost/helpers
2021-11-25 19:38:26 +01:00
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings…"
app=$YNH_APP_INSTANCE_NAME
2021-11-25 19:38:26 +01:00
domain=$(ynh_app_setting_get --app=$app --key=domain)
2022-03-12 16:55:59 +01:00
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
2022-03-12 16:55:59 +01:00
#=================================================
# STANDARD REMOVE
2021-11-25 19:38:26 +01:00
#=================================================
# REMOVE SERVICE INTEGRATION IN YUNOHOST
#=================================================
2021-11-25 19:38:26 +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…"
2021-11-25 19:38:26 +01:00
yunohost service remove $app
fi
#=================================================
# STOP AND REMOVE SERVICE
#=================================================
ynh_script_progression --message="Stopping and removing the systemd service…"
2021-11-25 19:38:26 +01:00
# Remove the dedicated systemd config
ynh_remove_systemd_config
2016-06-28 13:55:13 +02:00
2021-11-25 19:38:26 +01:00
#=================================================
2022-03-12 16:55:59 +01:00
# REMOVE DATA DIR
2021-11-25 19:38:26 +01:00
#=================================================
2022-03-12 16:55:59 +01:00
# 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…"
2022-03-12 16:55:59 +01:00
ynh_secure_remove --file="$datadir"
fi
2021-11-25 19:38:26 +01:00
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Removing NGINX web server configuration…"
2021-11-25 19:38:26 +01:00
# Remove the dedicated NGINX config
ynh_remove_nginx_config
2022-03-12 16:55:59 +01:00
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies…"
2022-03-12 16:55:59 +01:00
dpkg -r duniter
#=================================================
# GENERIC FINALIZATION
#=================================================
# REMOVE DEDICATED USER
#=================================================
ynh_script_progression --message="Removing the dedicated system user…"
2022-03-12 16:55:59 +01:00
# Delete a system user
ynh_system_user_delete --username=$app
2020-06-11 19:00:12 +02:00
#=================================================
# END OF SCRIPT
#=================================================
2022-03-12 16:55:59 +01:00
ynh_script_progression --message="Removal of $app completed"