1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/moodle_ynh.git synced 2024-09-03 19:46:23 +02:00
moodle_ynh/scripts/remove

96 lines
3 KiB
Text
Raw Normal View History

2017-12-14 18:03:01 +01:00
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
2020-03-24 02:27:29 +01:00
source ynh_add_extra_apt_repos
source ynh_install_php
2017-12-14 18:03:01 +01:00
#=================================================
# LOAD SETTINGS
#=================================================
2020-03-24 15:11:10 +01:00
ynh_script_progression --message="Loading installation settings..."
2017-12-14 18:03:01 +01:00
app=$YNH_APP_INSTANCE_NAME
2020-03-24 02:27:29 +01:00
domain=$(ynh_app_setting_get --app=$app --key=domain)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
data_root=$(ynh_app_setting_get --app=$app --key=data_root)
2017-12-14 18:03:01 +01:00
#=================================================
# STANDARD REMOVE
#=================================================
2019-03-12 18:10:10 +01:00
# REMOVE THE POSTGRESQL DATABASE
2017-12-14 18:03:01 +01:00
#=================================================
2020-03-24 15:11:10 +01:00
ynh_script_progression --message="Removing the PostgresSQL database..."
2019-03-12 18:10:10 +01:00
2017-12-14 18:03:01 +01:00
# Remove a database if it exists, along with the associated user
2020-03-24 02:27:29 +01:00
ynh_psql_remove_db --db_user=$db_name --db_name=$db_name
2017-12-14 18:03:01 +01:00
2019-03-12 18:10:10 +01:00
#=================================================
# REMOVE DEPENDENCIES
#=================================================
2020-03-24 15:11:10 +01:00
ynh_script_progression --message="Removing dependencies..."
2019-03-12 18:10:10 +01:00
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
2017-12-14 18:03:01 +01:00
#=================================================
# REMOVE APP MAIN DIR
#=================================================
2020-03-24 15:11:10 +01:00
ynh_script_progression --message="Removing app main directory..."
2017-12-14 18:03:01 +01:00
# Remove the app directory securely
2020-03-24 02:27:29 +01:00
ynh_secure_remove --file="$final_path"
2017-12-14 18:03:01 +01:00
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
2020-03-24 15:11:10 +01:00
ynh_script_progression --message="Removing nginx web server configuration..."
2017-12-14 18:03:01 +01:00
# Remove the dedicated nginx config
ynh_remove_nginx_config
#=================================================
2019-03-12 18:10:10 +01:00
# REMOVE PHP-FPM CONFIGURATION
2017-12-14 18:03:01 +01:00
#=================================================
2020-03-24 15:11:10 +01:00
ynh_script_progression --message="Removing php-fpm configuration..." --weight=20
2017-12-14 18:03:01 +01:00
# Remove the dedicated php-fpm config
2019-03-13 21:39:39 +01:00
ynh_remove_fpm_config
2020-03-24 02:27:29 +01:00
ynh_remove_php "7.3"
2019-03-12 18:10:10 +01:00
2017-12-14 18:03:01 +01:00
#=================================================
# SPECIFIC REMOVE
#=================================================
# REMOVE THE CRON FILE
#=================================================
# Remove a cron file
2020-03-24 02:27:29 +01:00
ynh_secure_remove --file="/etc/cron.d/$app"
2017-12-14 18:03:01 +01:00
# Remove a directory securely
2020-03-24 02:27:29 +01:00
ynh_secure_remove --file="$data_root"
2017-12-14 18:03:01 +01:00
#=================================================
# GENERIC FINALIZATION
#=================================================
# REMOVE DEDICATED USER
#=================================================
2020-03-24 15:11:10 +01:00
ynh_script_progression --message="Removing the dedicated system user..."
2017-12-14 18:03:01 +01:00
# Delete a system user
2020-03-24 02:27:29 +01:00
ynh_system_user_delete --username=$app
2019-03-12 18:10:10 +01:00
#=================================================
# END OF SCRIPT
#=================================================
2020-03-24 15:11:10 +01:00
ynh_script_progression --message="Removal of $app completed" --last