2016-03-18 18:38:54 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-08-14 22:18:22 +02:00
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
2016-03-18 18:38:54 +01:00
|
|
|
|
2019-06-07 23:09:30 +02:00
|
|
|
# Stop script if errors
|
|
|
|
set -u
|
|
|
|
|
2018-08-14 22:18:22 +02:00
|
|
|
# Import common cmd
|
|
|
|
source ./experimental_helper.sh
|
|
|
|
source ./_common.sh
|
2016-03-18 18:38:54 +01:00
|
|
|
|
2020-11-17 23:55:57 +01:00
|
|
|
# Source YunoHost helpers
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
2019-06-07 23:09:30 +02:00
|
|
|
ynh_script_progression --message="Loading installation settings..."
|
|
|
|
|
2018-08-14 22:18:22 +02:00
|
|
|
# Retrieve app settings
|
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
2019-06-07 23:09:30 +02:00
|
|
|
domain=$(ynh_app_setting_get --app $app --key domain)
|
|
|
|
port=$(ynh_app_setting_get --app $app --key port)
|
|
|
|
db_name=$(ynh_app_setting_get --app $app --key db_name)
|
|
|
|
db_user=$(ynh_app_setting_get --app $app --key db_user)
|
|
|
|
final_path=$(ynh_app_setting_get --app $app --key final_path)
|
2016-03-18 21:00:30 +01:00
|
|
|
|
2018-08-14 22:18:22 +02:00
|
|
|
#=================================================
|
|
|
|
# STANDARD REMOVE
|
|
|
|
#=================================================
|
2016-03-18 21:00:30 +01:00
|
|
|
|
2018-08-14 22:18:22 +02:00
|
|
|
# Remove metapackage and its dependencies
|
2019-06-07 23:09:30 +02:00
|
|
|
ynh_script_progression --message="Removing dependencies" --weight=10
|
2018-08-14 22:18:22 +02:00
|
|
|
ynh_remove_app_dependencies
|
|
|
|
|
|
|
|
# Remove a database if it exists, along with the associated user
|
2019-06-07 23:09:30 +02:00
|
|
|
ynh_script_progression --message="Removing databases..."
|
|
|
|
ynh_mysql_remove_db --db_user $db_user --db_name $db_name
|
2018-08-14 22:18:22 +02:00
|
|
|
|
|
|
|
# Remove the app directory securely
|
2019-06-07 23:09:30 +02:00
|
|
|
ynh_script_progression --message="Removing user data..."
|
|
|
|
ynh_secure_remove --file="$final_path"
|
|
|
|
|
|
|
|
ynh_script_progression --message="Removing configuration..."
|
2018-08-14 22:18:22 +02:00
|
|
|
|
|
|
|
# Remove sogo config
|
2019-06-07 23:09:30 +02:00
|
|
|
ynh_secure_remove --file="/etc/$app"
|
2018-08-14 22:18:22 +02:00
|
|
|
|
|
|
|
# Remove stunnel config
|
2019-06-07 23:09:30 +02:00
|
|
|
ynh_secure_remove --file="/etc/stunnel/$app.conf"
|
2018-08-14 22:18:22 +02:00
|
|
|
|
2019-02-08 10:21:19 +01:00
|
|
|
# Remove custom SSO config
|
|
|
|
python3 remove_sso_conf.py
|
|
|
|
|
2020-05-24 00:32:03 +02:00
|
|
|
# Remove service
|
|
|
|
yunohost service remove $app
|
|
|
|
|
2018-08-14 22:18:22 +02:00
|
|
|
# Remove the app-specific logrotate config
|
|
|
|
ynh_remove_logrotate
|
2019-06-07 23:09:30 +02:00
|
|
|
|
|
|
|
ynh_script_progression --message="Removal of $app completed" --last
|