2017-11-14 16:05:26 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-01-31 16:08:58 +01:00
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
|
2017-11-14 16:05:26 +01:00
|
|
|
# Import common cmd
|
2018-01-31 16:08:58 +01:00
|
|
|
source ./experimental_helper.sh
|
2017-11-14 16:05:26 +01:00
|
|
|
source ./_common.sh
|
|
|
|
|
2020-11-17 23:51:51 +01:00
|
|
|
# Source YunoHost helpers
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
2017-11-14 16:05:26 +01:00
|
|
|
# LOAD SETTINGS
|
2019-06-06 22:39:49 +02:00
|
|
|
ynh_script_progression --message="Loading installation settings..."
|
|
|
|
domain=$(ynh_app_setting_get --app $app --key domain)
|
|
|
|
db_name=$(ynh_app_setting_get --app $app --key db_name)
|
|
|
|
db_user="$app"
|
2017-11-14 16:05:26 +01:00
|
|
|
|
2018-01-31 16:08:58 +01:00
|
|
|
#=================================================
|
|
|
|
# STANDARD REMOVE
|
|
|
|
#=================================================
|
|
|
|
|
2019-06-06 22:39:49 +02:00
|
|
|
# Stop service
|
|
|
|
ynh_systemd_action --service_name "uwsgi-app@$app.service" --action stop
|
|
|
|
|
2017-11-14 16:05:26 +01:00
|
|
|
# Remove db user
|
2019-06-11 22:27:54 +02:00
|
|
|
ynh_script_progression --message="Cleaning the PostgreSQL database..."
|
2017-11-14 16:05:26 +01:00
|
|
|
ynh_psql_drop_user $db_user
|
|
|
|
|
|
|
|
# Remove depandance
|
2019-06-11 22:27:54 +02:00
|
|
|
ynh_script_progression --message="Removing dependencies..." --weight=10
|
2017-11-14 16:05:26 +01:00
|
|
|
ynh_remove_app_dependencies || true
|
|
|
|
|
|
|
|
# Remove the app directory securely
|
2019-06-11 22:27:54 +02:00
|
|
|
ynh_script_progression --message="Removing app main directory..." --weight=4
|
2019-06-06 22:39:49 +02:00
|
|
|
ynh_secure_remove --file="$final_path"
|
2017-11-14 16:05:26 +01:00
|
|
|
|
2017-11-16 21:10:21 +01:00
|
|
|
# Remove app data
|
2019-06-06 22:39:49 +02:00
|
|
|
ynh_secure_remove --file=/var/lib/$app
|
2017-11-16 21:10:21 +01:00
|
|
|
|
|
|
|
# Remove logrotate
|
2019-06-11 22:27:54 +02:00
|
|
|
ynh_script_progression --message="Removing logrotate configuration..."
|
2017-11-16 21:10:21 +01:00
|
|
|
ynh_remove_logrotate
|
|
|
|
|
|
|
|
# Remove logs
|
2019-06-11 22:27:54 +02:00
|
|
|
ynh_script_progression --message="Removing logs..."
|
2019-06-06 22:39:49 +02:00
|
|
|
ynh_secure_remove --file=/var/log/$app
|
2017-11-16 21:10:21 +01:00
|
|
|
|
2017-11-14 16:05:26 +01:00
|
|
|
# Remove the dedicated nginx config
|
2019-06-11 22:27:54 +02:00
|
|
|
ynh_script_progression --message="Removing configuration..."
|
2017-11-14 16:05:26 +01:00
|
|
|
ynh_remove_nginx_config
|
|
|
|
|
2017-11-16 21:10:21 +01:00
|
|
|
# Remove uwsgi config
|
2019-06-06 22:39:49 +02:00
|
|
|
ynh_remove_uwsgi_service
|
2017-11-14 16:05:26 +01:00
|
|
|
|
|
|
|
# Delete a system user
|
2019-06-11 22:27:54 +02:00
|
|
|
ynh_script_progression --message="Removing the dedicated system user..."
|
2017-11-14 16:05:26 +01:00
|
|
|
ynh_system_user_delete $app
|
2018-03-15 23:33:57 +01:00
|
|
|
|
2019-06-06 22:39:49 +02:00
|
|
|
ynh_script_progression --message="Removal of $app completed" --last
|