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

55 lines
1.6 KiB
Text
Raw Normal View History

2022-12-27 17:59:56 +01:00
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source ynh_mongo_db__2
source /usr/share/yunohost/helpers
#=================================================
2024-01-03 23:19:38 +01:00
# REMOVE SYSTEM CONFIGURATIONS
2022-12-27 17:59:56 +01:00
#=================================================
2024-01-03 23:19:38 +01:00
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
2022-12-27 17:59:56 +01:00
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
2024-01-03 23:19:38 +01:00
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
2022-12-29 10:06:04 +01:00
done
2022-12-27 17:59:56 +01:00
# Remove the dedicated systemd config
2024-01-03 23:19:38 +01:00
for service_name in "${SERVICES_LIST[@]}"; do
ynh_remove_systemd_config --service="${app}-${service_name}"
2022-12-29 10:06:04 +01:00
done
2022-12-27 17:59:56 +01:00
2024-01-03 23:19:38 +01:00
# Remove the dedicated NGINX config
ynh_remove_nginx_config
2022-12-27 17:59:56 +01:00
# Remove the app-specific logrotate config
ynh_remove_logrotate
# Remove a database if it exists, along with the associated user
2024-01-03 23:19:38 +01:00
for db_name in "${MONGO_DB_LIST[@]}"; do
ynh_mongo_remove_db --db_user=$db_user --db_name="dontCode$tenant$db_name"
2022-12-30 10:21:10 +01:00
done
2024-01-03 23:19:38 +01:00
2022-12-27 17:59:56 +01:00
# Remove mongo itself if not used anymore
ynh_remove_mongo
2024-01-05 16:27:40 +01:00
_remove_restart_script_and_sudoers
2023-01-07 10:31:21 +01:00
2022-12-27 17:59:56 +01:00
# Remove the log files
ynh_secure_remove --file="/var/log/$app"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Removal of $app completed" --last