mirror of
https://github.com/YunoHost-Apps/seafile_ynh.git
synced 2024-09-03 20:26:01 +02:00
83 lines
2.5 KiB
Bash
83 lines
2.5 KiB
Bash
#!/bin/bash
|
|
|
|
#=================================================
|
|
# GENERIC START
|
|
#=================================================
|
|
|
|
# Source YunoHost helpers
|
|
source /usr/share/yunohost/helpers
|
|
|
|
# Stop script if errors
|
|
set -u
|
|
|
|
# Import common cmd
|
|
source ./experimental_helper.sh
|
|
source ./_common.sh
|
|
|
|
ynh_script_progression --message="Loading installation settings..."
|
|
|
|
# Retrieve arguments
|
|
domain=$(ynh_app_setting_get --app $app --key domain)
|
|
|
|
#=================================================
|
|
# STANDARD REMOVE
|
|
#=================================================
|
|
|
|
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
|
|
|
|
# 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
|
|
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
|
|
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
|
|
|
|
# Remove user
|
|
ynh_script_progression --message="Removing the dedicated system user..."
|
|
ynh_system_user_delete --username seafile
|
|
|
|
# Remove depandance
|
|
ynh_script_progression --message="Removing dependencies" --weight=10
|
|
ynh_remove_app_dependencies
|
|
|
|
# Remove nginx config
|
|
ynh_script_progression --message="Removing configuration..."
|
|
ynh_remove_nginx_config
|
|
|
|
# Remove logrotate
|
|
ynh_remove_logrotate
|
|
|
|
# Remove the dedicated fail2ban config
|
|
ynh_remove_fail2ban_config
|
|
|
|
yunohost service remove seafile
|
|
yunohost service remove seahub
|
|
|
|
ynh_script_progression --message="Removal of $app completed" --last
|