autodeploygit_ynh/scripts/remove

64 lines
1.8 KiB
Text
Raw Normal View History

2014-10-20 19:55:53 +03:00
#!/bin/bash
2017-06-02 19:34:13 +03:00
#=================================================
2017-06-17 18:54:26 +03:00
# GENERIC START
2017-06-02 19:34:13 +03:00
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
2014-10-20 19:55:53 +03:00
2017-06-05 14:11:07 +03:00
source _common.sh
source /usr/share/yunohost/helpers
# Settings are automatically loaded as bash variables
# in every app script context, therefore typically these will exist:
# - $domain
# - $path
# - $language
# - $install_dir
# - $port
# ...
2017-06-02 19:34:13 +03:00
# For remove operations :
# - the core will deprovision every resource defined in the manifest **after** this script is ran
# this includes removing the install directory, and data directory (if --purge was used)
2017-06-02 19:34:13 +03:00
#=================================================
# REMOVE SYSTEM CONFIGURATIONS
2017-06-02 19:34:13 +03:00
#=================================================
# REMOVE SYSTEMD SERVICE
2017-06-02 19:34:13 +03:00
#=================================================
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
# This should be a symetric version of what happens in the install script
2020-12-04 14:03:07 +03:00
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
2019-05-22 21:40:53 +03:00
if ynh_exec_warn_less yunohost service status $app >/dev/null
2017-06-02 19:34:13 +03:00
then
ynh_script_progression --message="Removing $app service integration..." --weight=1
yunohost service remove $app
2017-06-02 19:34:13 +03:00
fi
ynh_remove_systemd_config
2017-06-02 19:34:13 +03:00
ynh_remove_nginx_config
ynh_remove_fpm_config
ynh_remove_logrotate
2019-04-18 20:58:47 +03:00
ynh_remove_fail2ban_config
# Remove other various files specific to the app... such as :
2014-10-20 19:55:53 +03:00
2019-04-16 01:32:39 +03:00
ynh_secure_remove --file="/etc/cron.d/$app"
2014-10-20 19:55:53 +03:00
ynh_secure_remove --file="/etc/$app"
2014-10-20 19:55:53 +03:00
ynh_secure_remove --file="/var/log/$app"
2019-02-10 17:02:38 +03:00
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Removal of $app completed" --last