1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/pgadmin_ynh.git synced 2024-09-03 19:56:38 +02:00
pgadmin_ynh/scripts/remove
2019-06-07 22:08:36 +02:00

64 lines
1.7 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
# LOAD SETTINGS
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"
#=================================================
# STANDARD REMOVE
#=================================================
# Stop service
ynh_systemd_action --service_name "uwsgi-app@$app.service" --action stop
# Remove db user
ynh_script_progression --message="Cleaning the PostgreSQL database"
ynh_psql_drop_user $db_user
# Remove depandance
ynh_script_progression --message="Removing dependencies" --weight=10
ynh_remove_app_dependencies || true
# Remove the app directory securely
ynh_script_progression --message="Removing app main directory" --weight=4
ynh_secure_remove --file="$final_path"
# Remove app data
ynh_secure_remove --file=/var/lib/$app
# Remove logrotate
ynh_script_progression --message="Removing logrotate configuration"
ynh_remove_logrotate
# Remove logs
ynh_script_progression --message="Removing logs"
ynh_secure_remove --file=/var/log/$app
# Remove the dedicated nginx config
ynh_script_progression --message="Removing configuration"
ynh_remove_nginx_config
# Remove uwsgi config
ynh_remove_uwsgi_service
# Delete a system user
ynh_script_progression --message="Removing the dedicated system user"
ynh_system_user_delete $app
ynh_script_progression --message="Removal of $app completed" --last