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
2024-05-20 20:53:11 +02:00

103 lines
3.7 KiB
Bash
Executable file

#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source ynh_add_swap
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`)
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
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
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
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"
fi
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"
fi
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"
fi
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"
fi
# Remove the dedicated systemd config
ynh_remove_systemd_config --service="$app-api-gateway"
ynh_remove_systemd_config --service="$app-auth"
ynh_remove_systemd_config --service="$app-auth-worker"
ynh_remove_systemd_config --service="$app-files"
ynh_remove_systemd_config --service="$app-syncing-server"
ynh_remove_systemd_config --service="$app-syncing-server-worker"
ynh_remove_systemd_config --service="$app-workspace"
ynh_reset_systemd
# Remove the app-specific logrotate config
ynh_remove_logrotate
ynh_redis_remove_db
# Remove the dedicated NGINX config
ynh_remove_nginx_config
# Remove the dedicated Fail2Ban config
ynh_remove_fail2ban_config
#=================================================
# REMOVE NODEJS
#=================================================
ynh_script_progression --message="Removing NodeJS..." --weight=10
ynh_remove_nodejs
#=================================================
# SPECIFIC REMOVE
#=================================================
# REMOVE VARIOUS FILES
#=================================================
ynh_script_progression --message="Removing various files..." --weight=1
# Remove a cron file
ynh_secure_remove --file="/etc/cron.d/$app"
# Remove the log files
ynh_secure_remove --file="/var/log/$app"
#=================================================
# REMOVE SWAP
#=================================================
ynh_script_progression --message="Removing swap..."
if [ ${PACKAGE_CHECK_EXEC:-0} -eq 0 ]; then
ynh_del_swap
fi
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Removal of $app completed" --last