1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/webtrees_ynh.git synced 2024-09-03 18:26:37 +02:00
webtrees_ynh/scripts/remove

80 lines
2.3 KiB
Text
Raw Normal View History

2017-07-01 19:54:37 +02:00
#!/bin/bash
2017-08-01 11:29:01 +02:00
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
2017-08-01 11:29:01 +02:00
source _common.sh
2017-07-01 19:54:37 +02:00
source /usr/share/yunohost/helpers
2017-08-01 11:29:01 +02:00
#=================================================
# LOAD SETTINGS
#=================================================
2019-04-06 20:29:15 +02:00
ynh_print_info "Loading installation settings..."
2018-09-01 18:12:10 +02:00
2017-08-01 11:29:01 +02:00
app=$YNH_APP_INSTANCE_NAME
2017-07-01 19:54:37 +02:00
# Retrieve app settings
domain=$(ynh_app_setting_get "$app" domain)
2017-08-01 11:29:01 +02:00
db_name=$(ynh_app_setting_get $app db_name)
2018-09-01 18:12:10 +02:00
db_user=$db_name
final_path=$(ynh_app_setting_get $app final_path)
2017-08-01 11:29:01 +02:00
2019-04-06 20:29:15 +02:00
#=================================================
# REMOVE THE MYSQL DATABASE
#=================================================
ynh_print_info "Removing the MySQL database"
# Remove a database if it exists, along with the associated user
ynh_mysql_remove_db $db_user $db_name
#=================================================
# REMOVE DEPENDENCIES
#=================================================
2020-02-23 19:45:22 +01:00
ynh_print_info "Removing dependencies..."
2019-04-06 20:29:15 +02:00
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
2018-09-01 18:12:10 +02:00
#=================================================
# REMOVE APP MAIN DIR
#=================================================
2020-02-23 19:45:22 +01:00
ynh_print_info "Removing app main directory..."
2017-08-01 11:29:01 +02:00
# Remove the app directory securely
2018-09-01 18:12:10 +02:00
ynh_secure_remove "$final_path"
2017-08-01 11:29:01 +02:00
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
2020-02-23 19:45:22 +01:00
ynh_print_info "Removing nginx web server configuration..."
2017-07-01 19:54:37 +02:00
2017-08-01 11:29:01 +02:00
# Remove the dedicated nginx config
ynh_remove_nginx_config
2017-07-01 19:54:37 +02:00
2018-09-01 18:12:10 +02:00
#=================================================
# REMOVE PHP-FPM CONFIGURATION
#=================================================
2019-04-06 20:29:15 +02:00
ynh_print_info "Removing php-fpm configuration"
2018-09-01 18:12:10 +02:00
# Remove the dedicated php-fpm config
ynh_remove_fpm_config
2017-07-01 19:54:37 +02:00
2018-09-01 18:12:10 +02:00
#=================================================
2019-04-06 20:29:15 +02:00
# GENERIC FINALIZATION
#=================================================
# REMOVE DEDICATED USER
2018-09-01 18:12:10 +02:00
#=================================================
2020-02-23 19:45:22 +01:00
ynh_print_info "Removing the dedicated system user..."
2017-07-01 19:54:37 +02:00
2019-04-06 20:29:15 +02:00
# Delete a system user
ynh_system_user_delete $app
#=================================================
# END OF SCRIPT
#=================================================
ynh_print_info "Removal of $app completed"