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

101 lines
3.1 KiB
Text
Raw Normal View History

2017-11-14 16:05:26 +01:00
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
2022-03-13 15:22:35 +01:00
# IMPORT GENERIC HELPERS
#=================================================
2022-03-13 15:22:35 +01:00
source experimental_helper.sh
source _common.sh
2020-11-17 23:51:51 +01:00
source /usr/share/yunohost/helpers
2022-03-13 15:22:35 +01:00
#=================================================
2017-11-14 16:05:26 +01:00
# LOAD SETTINGS
2022-03-13 15:22:35 +01:00
#=================================================
2019-06-06 22:39:49 +02:00
ynh_script_progression --message="Loading installation settings..."
2022-03-13 15:22:35 +01:00
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
db_user=$(ynh_app_setting_get --app=$app --key=db_user)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
2017-11-14 16:05:26 +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
2022-03-13 15:22:35 +01:00
# Remove uwsgi config
ynh_remove_uwsgi_service
#=================================================
# REMOVE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Removing logrotate configuration..."
# Remove the app-specific logrotate config
ynh_remove_logrotate
#=================================================
# REMOVE DB_USER
#=================================================
2019-06-11 22:27:54 +02:00
ynh_script_progression --message="Cleaning the PostgreSQL database..."
2022-03-13 15:22:35 +01:00
2017-11-14 16:05:26 +01:00
ynh_psql_drop_user $db_user
2022-03-13 15:22:35 +01:00
#=================================================
# REMOVE APP MAIN DIR
#=================================================
ynh_script_progression --message="Removing app main directory..." --weight=4
2017-11-14 16:05:26 +01:00
# Remove the app directory securely
2019-06-06 22:39:49 +02:00
ynh_secure_remove --file="$final_path"
2017-11-14 16:05:26 +01:00
2022-03-13 15:22:35 +01:00
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Removing NGINX web server configuration..."
2017-11-16 21:10:21 +01:00
2022-03-13 15:22:35 +01:00
# Remove the dedicated NGINX config
ynh_remove_nginx_config
2017-11-16 21:10:21 +01:00
2022-03-13 15:22:35 +01:00
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..." --weight=10
2017-11-16 21:10:21 +01:00
2022-03-13 15:22:35 +01:00
# Remove metapackage and its dependencies
ynh_remove_app_dependencies || true
2017-11-14 16:05:26 +01:00
2022-03-13 15:22:35 +01:00
#=================================================
# SPECIFIC REMOVE
#=================================================
# REMOVE VARIOUS FILES
#=================================================
ynh_script_progression --message="Removing various files..."
2017-11-14 16:05:26 +01:00
2022-03-13 15:22:35 +01:00
# Remove app data
ynh_secure_remove --file="/var/lib/$app"
# Remove the log files
ynh_secure_remove --file="/var/log/$app"
#=================================================
# GENERIC FINALIZATION
#=================================================
# REMOVE DEDICATED USER
#=================================================
2019-06-11 22:27:54 +02:00
ynh_script_progression --message="Removing the dedicated system user..."
2022-03-13 15:22:35 +01:00
# Delete a system user
ynh_system_user_delete --username=$app
#=================================================
# END OF SCRIPT
#=================================================
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