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

104 lines
3.7 KiB
Text
Raw Normal View History

2020-01-18 10:28:47 +01:00
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
2021-08-29 00:17:52 +02:00
source ynh_add_swap
2020-01-18 10:28:47 +01:00
source /usr/share/yunohost/helpers
#=================================================
2024-01-15 22:17:38 +01:00
# REMOVE SYSTEM CONFIGURATIONS
2020-01-18 10:28:47 +01:00
#=================================================
2024-01-15 22:17:38 +01:00
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
2020-01-18 10:28:47 +01:00
2022-08-31 02:25:01 +02:00
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
2024-01-15 22:17:38 +01:00
if ynh_exec_warn_less yunohost service status "$app-api-gateway" >/dev/null; then
ynh_script_progression --message="Removing $app-api-gateway service..." --weight=1
yunohost service remove "$app-api-gateway"
fi
2024-01-15 22:17:38 +01:00
if ynh_exec_warn_less yunohost service status "$app-auth" >/dev/null; then
ynh_script_progression --message="Removing $app-auth service..." --weight=1
yunohost service remove "$app-auth"
fi
2024-01-15 22:17:38 +01:00
if ynh_exec_warn_less yunohost service status "$app-auth-worker" >/dev/null; then
ynh_script_progression --message="Removing $app-auth-worker service..." --weight=1
yunohost service remove "$app-auth-worker"
fi
2024-01-15 22:17:38 +01:00
if ynh_exec_warn_less yunohost service status "$app-files" >/dev/null; then
ynh_script_progression --message="Removing $app-files service..." --weight=1
yunohost service remove "$app-files"
2022-08-04 17:28:39 +02:00
fi
2024-01-15 22:17:38 +01:00
if ynh_exec_warn_less yunohost service status "$app-syncing-server" >/dev/null; then
ynh_script_progression --message="Removing $app-syncing-server service..." --weight=1
yunohost service remove "$app-syncing-server"
2022-08-04 17:28:39 +02:00
fi
2024-01-15 22:17:38 +01:00
if ynh_exec_warn_less yunohost service status "$app-syncing-server-worker" >/dev/null; then
ynh_script_progression --message="Removing $app-syncing-server-worker service..." --weight=1
yunohost service remove "$app-syncing-server-worker"
2020-01-18 10:28:47 +01:00
fi
2024-01-15 22:17:38 +01:00
if ynh_exec_warn_less yunohost service status "$app-workspace" >/dev/null; then
ynh_script_progression --message="Removing $app-workspace service..." --weight=1
yunohost service remove "$app-workspace"
2022-10-25 18:42:07 +02:00
fi
2020-01-18 10:28:47 +01:00
# Remove the dedicated systemd config
2022-08-04 17:28:39 +02:00
ynh_remove_systemd_config --service="$app-api-gateway"
2021-07-04 21:45:43 +02:00
ynh_remove_systemd_config --service="$app-auth"
ynh_remove_systemd_config --service="$app-auth-worker"
2022-08-04 17:28:39 +02:00
ynh_remove_systemd_config --service="$app-files"
ynh_remove_systemd_config --service="$app-syncing-server"
ynh_remove_systemd_config --service="$app-syncing-server-worker"
2022-10-25 18:42:07 +02:00
ynh_remove_systemd_config --service="$app-workspace"
2020-01-18 10:28:47 +01:00
2022-08-12 16:53:32 +02:00
ynh_reset_systemd
2022-08-31 02:25:01 +02:00
# Remove the app-specific logrotate config
ynh_remove_logrotate
ynh_redis_remove_db
2020-01-18 10:28:47 +01:00
2022-08-31 02:25:01 +02:00
# Remove the dedicated NGINX config
2020-01-18 10:28:47 +01:00
ynh_remove_nginx_config
2024-01-15 22:17:38 +01:00
# Remove the dedicated Fail2Ban config
ynh_remove_fail2ban_config
2020-01-18 10:28:47 +01:00
#=================================================
2024-01-15 22:17:38 +01:00
# REMOVE NODEJS
2020-01-18 10:28:47 +01:00
#=================================================
2024-01-15 22:17:38 +01:00
ynh_script_progression --message="Removing NodeJS..." --weight=10
2020-01-18 10:28:47 +01:00
2024-01-15 22:17:38 +01:00
ynh_remove_nodejs
2020-01-18 10:28:47 +01:00
#=================================================
# SPECIFIC REMOVE
#=================================================
2022-08-31 02:25:01 +02:00
# REMOVE VARIOUS FILES
#=================================================
2022-08-31 02:25:01 +02:00
ynh_script_progression --message="Removing various files..." --weight=1
2022-08-31 02:25:01 +02:00
# Remove a cron file
ynh_secure_remove --file="/etc/cron.d/$app"
2022-08-31 02:25:01 +02:00
# Remove the log files
ynh_secure_remove --file="/var/log/$app"
2021-08-29 00:17:52 +02:00
#=================================================
# REMOVE SWAP
#=================================================
ynh_script_progression --message="Removing swap..."
2022-08-31 04:24:01 +02:00
if [ ${PACKAGE_CHECK_EXEC:-0} -eq 0 ]; then
2024-01-15 22:17:38 +01:00
ynh_del_swap
2022-08-31 04:24:01 +02:00
fi
2020-01-18 10:28:47 +01:00
#=================================================
# END OF SCRIPT
#=================================================
2022-08-31 02:25:01 +02:00
ynh_script_progression --message="Removal of $app completed" --last