seafile_ynh/scripts/remove

84 lines
2.5 KiB
Text
Raw Normal View History

#!/bin/bash
#=================================================
# GENERIC START
#=================================================
2017-07-21 14:56:41 +02:00
# Source YunoHost helpers
source /usr/share/yunohost/helpers
# Stop script if errors
set -u
# Import common cmd
source ./experimental_helper.sh
source ./_common.sh
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
# remove sso config to unprotect domain.tld/seafhttp in /etc/ssowat/conf.json.persistent
2019-06-11 22:28:26 +02:00
ynh_script_progression --message="Cleaning SSO configuration..."
python3 ../conf/remove_sso_conf.py
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_script_progression --message="Backing up user data..." --weight=10
ynh_secure_remove --file=/home/yunohost.app/seafile-data
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
ynh_script_progression --message="Removing configuration..."
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
ynh_remove_fail2ban_config
yunohost service remove seafile
yunohost service remove seahub
2019-06-11 22:28:26 +02:00
ynh_script_progression --message="Removal of $app completed" --last