2014-08-07 02:57:24 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-02-11 01:20:58 +01:00
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
|
2017-07-21 14:56:41 +02:00
|
|
|
# Source YunoHost helpers
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
# Stop script if errors
|
|
|
|
set -u
|
|
|
|
|
2016-12-27 10:44:40 +01:00
|
|
|
# Import common cmd
|
2018-02-11 01:20:58 +01:00
|
|
|
source ./experimental_helper.sh
|
2016-12-27 10:44:40 +01:00
|
|
|
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)
|
2016-12-27 10:44:40 +01:00
|
|
|
|
2018-02-11 01:20:58 +01:00
|
|
|
#=================================================
|
|
|
|
# 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
|
2014-08-07 04:42:27 +02:00
|
|
|
|
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
|
|
|
|
|
2015-03-18 18:07:50 +01:00
|
|
|
# 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
|
2019-09-10 22:50:07 +02:00
|
|
|
ynh_script_progression --message="Removing user data..."
|
2019-06-11 22:28:26 +02:00
|
|
|
ynh_secure_remove --file=/home/yunohost.app/seafile-data
|
|
|
|
ynh_secure_remove --file=/tmp/seahub_cache
|
2015-02-10 14:42:32 +01:00
|
|
|
|
|
|
|
# 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
|
2014-08-13 03:21:47 +02:00
|
|
|
|
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
|
2015-03-17 01:15:44 +01:00
|
|
|
|
2019-06-11 22:28:26 +02:00
|
|
|
ynh_script_progression --message="Removal of $app completed" --last
|