seafile_ynh/scripts/remove

80 lines
2.5 KiB
Text
Raw Normal View History

#!/bin/bash
#=================================================
# GENERIC START
#=================================================
2020-11-17 23:49:06 +01:00
# Import common cmd
source ./experimental_helper.sh
source ./_common.sh
2017-07-21 14:56:41 +02:00
# Source YunoHost helpers
source /usr/share/yunohost/helpers
2019-06-11 22:28:26 +02:00
ynh_script_progression --message="Loading installation settings..."
2017-07-21 14:56:41 +02:00
# Retrieve arguments
2019-06-11 22:28:26 +02:00
domain=$(ynh_app_setting_get --app $app --key domain)
#=================================================
# STANDARD REMOVE
#=================================================
2019-06-11 22:28:26 +02:00
ynh_script_progression --message="Stoping services..."
# Stop all services
ynh_systemd_action --service_name seafile --action stop
ynh_systemd_action --service_name seahub --action stop
2018-05-08 10:12:58 +02:00
# Force to kill all process in case of a process is not stoped cleanly
pkill -f seafile-controller || true
pkill -f seaf-server || true
pkill -f ccnet-server || true
pkill -f seahub || true
2019-06-11 22:28:26 +02:00
ynh_script_progression --message="Removing logs..."
ynh_secure_remove --file=/var/log/seafile
ynh_script_progression --message="Removing code..."
ynh_secure_remove --file=/var/www/$app
ynh_secure_remove --file=/opt/yunohost/$app
ynh_secure_remove --file=/tmp/seahub_cache
# Remove databases
2019-06-11 22:28:26 +02:00
ynh_script_progression --message="Removing databases..."
ynh_mysql_remove_db --db_name ccnetdb --db_user seafile
ynh_mysql_remove_db --db_name seafiledb --db_user seafile
ynh_mysql_remove_db --db_name seahubdb --db_user seafile
# Remove systemd service
ynh_script_progression --message="Removing systemd units..."
ynh_remove_systemd_config --service seafile
ynh_remove_systemd_config --service seahub
2017-07-21 14:56:41 +02:00
2017-12-10 10:45:51 +01:00
# Remove user
2019-06-11 22:28:26 +02:00
ynh_script_progression --message="Removing the dedicated system user..."
ynh_system_user_delete --username seafile
2017-12-10 10:45:51 +01:00
2017-07-21 14:56:41 +02:00
# Remove depandance
2019-06-11 22:28:26 +02:00
ynh_script_progression --message="Removing dependencies" --weight=10
2017-07-21 14:56:41 +02:00
ynh_remove_app_dependencies
2017-01-05 23:24:32 +01:00
2019-06-11 22:28:26 +02:00
# Remove nginx config
2019-09-10 22:50:07 +02:00
ynh_script_progression --message="Removing nginx configuration..."
2019-06-11 22:28:26 +02:00
ynh_remove_nginx_config
2017-07-21 14:56:41 +02:00
# Remove logrotate
ynh_remove_logrotate
2019-06-11 22:28:26 +02:00
# Remove the dedicated fail2ban config
2019-09-10 22:50:07 +02:00
ynh_script_progression --message="Removing fail2ban configuration..."
2019-06-11 22:28:26 +02:00
ynh_remove_fail2ban_config
2019-09-10 22:50:07 +02:00
ynh_script_progression --message="Removing seafile service..."
2019-06-11 22:28:26 +02:00
yunohost service remove seafile
yunohost service remove seahub
2020-11-29 17:29:51 +01:00
ynh_print_info --message="Due of the backup core only feature the data directory in '/home/yunohost.app/seafile-data' was not removed. It need to be removed manually to purge app user data."
2019-06-11 22:28:26 +02:00
ynh_script_progression --message="Removal of $app completed" --last
2020-11-29 17:29:51 +01:00
sleep 1