You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
146 lines
4.4 KiB
146 lines
4.4 KiB
#!/bin/bash
|
|
|
|
#=================================================
|
|
# GENERIC STARTING
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
source _common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#=================================================
|
|
# LOAD SETTINGS
|
|
#=================================================
|
|
ynh_script_progression --message="Loading installation settings..." --weight=2
|
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
|
app_dev=$app-dev
|
|
app_staging=$app-staging
|
|
app_initial=$app
|
|
|
|
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)
|
|
|
|
domain_dev=$(ynh_app_setting_get --app=$app --key=domain_dev)
|
|
db_name_dev=$(ynh_app_setting_get --app=$app --key=db_name_dev)
|
|
final_path_dev=$(ynh_app_setting_get --app=$app --key=final_path_dev)
|
|
|
|
domain_staging=$(ynh_app_setting_get --app=$app --key=domain_staging)
|
|
db_name_staging=$(ynh_app_setting_get --app=$app --key=db_name_staging)
|
|
final_path_staging=$(ynh_app_setting_get --app=$app --key=final_path_staging)
|
|
|
|
#=================================================
|
|
# STANDARD REMOVE
|
|
#=================================================
|
|
# REMOVE THE MYSQL DATABASE
|
|
#=================================================
|
|
ynh_script_progression --message="Removing the MySQL database..." --weight=2
|
|
|
|
# Remove a database if it exists, along with the associated user
|
|
ynh_mysql_remove_db --db_user=$db_name --db_name=$db_name
|
|
|
|
# Remove a database if it exists, along with the associated user
|
|
ynh_mysql_remove_db --db_user=$db_name_dev --db_name=$db_name_dev
|
|
|
|
# Remove a database if it exists, along with the associated user
|
|
ynh_mysql_remove_db --db_user=$db_name_staging --db_name=$db_name_staging
|
|
|
|
#=================================================
|
|
# REMOVE APP MAIN DIR
|
|
#=================================================
|
|
ynh_script_progression --message="Removing app main directory..."
|
|
|
|
# Remove the app directory securely
|
|
ynh_secure_remove --file="$final_path"
|
|
|
|
# Remove the app directory securely
|
|
ynh_secure_remove --file="$final_path_dev"
|
|
|
|
# Remove the app directory securely
|
|
ynh_secure_remove --file="$final_path_staging"
|
|
|
|
#=================================================
|
|
# REMOVE NGINX CONFIGURATION
|
|
#=================================================
|
|
ynh_script_progression --message="Removing NGINX web server configuration..."
|
|
|
|
# Remove the dedicated NGINX config
|
|
ynh_remove_nginx_config
|
|
|
|
app=$app_dev
|
|
# Remove the dedicated NGINX config
|
|
ynh_remove_nginx_config
|
|
|
|
app=$app_staging
|
|
# Remove the dedicated NGINX config
|
|
ynh_remove_nginx_config
|
|
|
|
app=$app_initial
|
|
|
|
#=================================================
|
|
# REMOVE PHP-FPM CONFIGURATION
|
|
#=================================================
|
|
ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=2
|
|
|
|
# Remove the dedicated PHP-FPM config
|
|
ynh_remove_fpm_config
|
|
|
|
app=$app_dev
|
|
# Remove the dedicated PHP-FPM config
|
|
ynh_remove_fpm_config
|
|
|
|
app=$app_staging
|
|
# Remove the dedicated PHP-FPM config
|
|
ynh_remove_fpm_config
|
|
|
|
app=$app_initial
|
|
|
|
#=================================================
|
|
# REMOVE FAIL2BAN CONFIGURATION
|
|
#=================================================
|
|
ynh_script_progression --message="Removing Fail2Ban configuration..." --weight=8
|
|
|
|
# Remove the dedicated Fail2Ban config
|
|
ynh_remove_fail2ban_config
|
|
|
|
app=$app_dev
|
|
# Remove the dedicated Fail2Ban config
|
|
ynh_remove_fail2ban_config
|
|
|
|
app=$app_staging
|
|
# Remove the dedicated Fail2Ban config
|
|
ynh_remove_fail2ban_config
|
|
|
|
app=$app_initial
|
|
|
|
#=================================================
|
|
# REMOVE THE CRON
|
|
#=================================================
|
|
|
|
ynh_secure_remove /etc/cron.d/$app
|
|
ynh_secure_remove /etc/cron.d/$app_dev
|
|
ynh_secure_remove /etc/cron.d/$app_staging
|
|
|
|
#=================================================
|
|
# GENERIC FINALISATION
|
|
#=================================================
|
|
# REMOVE DEDICATED USER
|
|
#=================================================
|
|
ynh_script_progression --message="Removing the dedicated system user..." --weight=3
|
|
|
|
# Delete dedicated system user
|
|
ynh_system_user_delete --username=$app
|
|
|
|
# Delete dedicated system user
|
|
ynh_system_user_delete --username=$app_dev
|
|
|
|
# Delete dedicated system user
|
|
ynh_system_user_delete --username=$app_staging
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Removal of $app completed" --last
|