2017-12-14 18:03:01 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
source _common.sh
|
2020-03-24 02:27:29 +01:00
|
|
|
source ynh_add_extra_apt_repos
|
|
|
|
source ynh_install_php
|
2020-04-11 02:27:49 +02:00
|
|
|
source /usr/share/yunohost/helpers
|
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)
|
2020-03-24 15:27:09 +01:00
|
|
|
data_path=$(ynh_app_setting_get --app=$app --key=data_path)
|
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-27 14:17:52 +01:00
|
|
|
|
|
|
|
if [ "$(lsb_release --codename --short)" = "stretch" ]; then
|
|
|
|
ynh_remove_php
|
|
|
|
fi
|
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 15:27:09 +01:00
|
|
|
ynh_secure_remove --file="$data_path"
|
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
|