2018-02-06 14:33:23 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-02-11 00:32:26 +01:00
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
|
2018-02-06 14:33:23 +01:00
|
|
|
# Source YunoHost helpers
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
# Import common cmd
|
|
|
|
source ./experimental_helper.sh
|
|
|
|
source ./_common.sh
|
|
|
|
|
2019-11-02 21:19:47 +01:00
|
|
|
ynh_script_progression --message="Loading installation settings..."
|
|
|
|
|
2018-02-06 14:33:23 +01:00
|
|
|
# Retrieve app settings
|
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
2019-11-02 21:19:47 +01:00
|
|
|
domain=$(ynh_app_setting_get --app $app --key domain)
|
|
|
|
port=$(ynh_app_setting_get --app $app --key port)
|
|
|
|
db_name=$(ynh_app_setting_get --app $app --key db_name)
|
|
|
|
db_user=$(ynh_app_setting_get --app $app --key db_user)
|
|
|
|
final_path=$(ynh_app_setting_get --app $app --key final_path)
|
2018-02-06 14:33:23 +01:00
|
|
|
|
2018-02-11 00:32:26 +01:00
|
|
|
#=================================================
|
|
|
|
# STANDARD REMOVE
|
|
|
|
#=================================================
|
|
|
|
|
2018-02-06 14:33:23 +01:00
|
|
|
# Remove metapackage and its dependencies
|
2019-11-02 21:19:47 +01:00
|
|
|
ynh_script_progression --message="Removing dependencies" --weight=10
|
2018-02-06 14:33:23 +01:00
|
|
|
ynh_remove_app_dependencies
|
|
|
|
|
|
|
|
# Remove a database if it exists, along with the associated user
|
2019-11-02 21:19:47 +01:00
|
|
|
ynh_script_progression --message="Removing databases..."
|
|
|
|
ynh_mysql_remove_db --db_user $db_user --db_name $db_name
|
2018-02-06 14:33:23 +01:00
|
|
|
|
|
|
|
# Remove the app directory securely
|
2019-11-02 21:19:47 +01:00
|
|
|
ynh_script_progression --message="Removing code..."
|
|
|
|
ynh_secure_remove --file="$final_path"
|
2018-02-06 14:33:23 +01:00
|
|
|
|
|
|
|
# Remove user data
|
2019-11-02 21:19:47 +01:00
|
|
|
ynh_script_progression --message="Removing user data..."
|
|
|
|
ynh_secure_remove --file="$gollem_data_dir"
|
2018-02-06 14:33:23 +01:00
|
|
|
|
|
|
|
# Remove the dedicated nginx config
|
2019-11-02 21:19:47 +01:00
|
|
|
ynh_script_progression --message="Removing nginx configuration..."
|
2018-02-06 14:33:23 +01:00
|
|
|
ynh_remove_nginx_config
|
|
|
|
|
|
|
|
# Remove the dedicated php-fpm config
|
|
|
|
ynh_remove_fpm_config
|
|
|
|
|
|
|
|
# Delete a system user
|
2019-11-02 21:19:47 +01:00
|
|
|
ynh_script_progression --message="Removing the dedicated system user..."
|
|
|
|
ynh_system_user_delete --username $app
|
2018-02-06 14:33:23 +01:00
|
|
|
|
|
|
|
# Remove the app-specific logrotate config
|
2019-11-02 21:19:47 +01:00
|
|
|
ynh_remove_logrotate
|
|
|
|
|
|
|
|
ynh_script_progression --message="Removal of $app completed" --last
|