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

56 lines
1.7 KiB
Bash
Executable file

#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source ynh_mongo_db__2
source /usr/share/yunohost/helpers
#=================================================
# REMOVE SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
for service_name in "${SERVICES_LIST[@]}"; do
if ynh_exec_warn_less yunohost service status "${app}-${service_name}" >/dev/null; then
yunohost service remove "${app}-${service_name}"
fi
done
# Remove the dedicated systemd config
for service_name in "${SERVICES_LIST[@]}"; do
ynh_remove_systemd_config --service="${app}-${service_name}"
done
# Remove the dedicated NGINX config
ynh_remove_nginx_config
# Remove the app-specific logrotate config
ynh_remove_logrotate
# Remove a database if it exists, along with the associated user
for db_name in "${MONGO_DB_LIST[@]}"; do
ynh_mongo_remove_db --db_user=$db_user --db_name=$db_name
done
# Remove mongo itself if not used anymore
ynh_remove_mongo
if [ -f "/etc/sudoers.d/$app-sudoers" ]; then
ynh_secure_remove --file="/etc/sudoers.d/$app-sudoers"
fi
# Remove the log files
ynh_secure_remove --file="/var/log/$app"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Removal of $app completed" --last