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

83 lines
2.5 KiB
Text
Raw Normal View History

2018-01-24 20:18:53 +01:00
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
2020-12-07 11:54:33 +01:00
ynh_script_progression --message="Loading installation settings..."
2018-01-24 20:18:53 +01:00
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get $app domain)
2019-03-09 10:14:08 +01:00
db_name=$(ynh_app_setting_get $app db_name)
db_user=$db_name
2018-01-24 20:18:53 +01:00
final_path=$(ynh_app_setting_get $app final_path)
#=================================================
# STANDARD REMOVE
#=================================================
# REMOVE SERVICE FROM ADMIN PANEL
#=================================================
2019-03-09 10:14:08 +01:00
if yunohost service status $app >/dev/null 2>&1
2018-01-24 20:18:53 +01:00
then
2019-03-09 10:14:08 +01:00
ynh_print_info "Removing $app service"
2018-01-24 20:18:53 +01:00
yunohost service remove $app
fi
2019-03-09 10:14:08 +01:00
#=================================================
# REMOVE THE MYSQL DATABASE
#=================================================
2020-12-07 11:54:33 +01:00
ynh_script_progression --message="Removing the MySQL database"
2019-03-09 10:14:08 +01:00
# Remove a database if it exists, along with the associated user
2020-12-07 11:54:33 +01:00
ynh_mysql_remove_db --db_user=$db_name --db_name=$db_name
2018-01-24 20:18:53 +01:00
#=================================================
# REMOVE APP MAIN DIR
#=================================================
2020-12-07 11:54:33 +01:00
ynh_script_progression --message="Removing app main directory"
2018-01-24 20:18:53 +01:00
# Remove the app directory securely
2020-12-07 11:54:33 +01:00
ynh_secure_remove --file="$final_path"
2018-01-24 20:18:53 +01:00
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
2020-12-07 11:54:33 +01:00
ynh_script_progression --message="Removing NGINX web server configuration"
2018-01-24 20:18:53 +01:00
# Remove the dedicated nginx config
ynh_remove_nginx_config
#=================================================
# REMOVE PHP-FPM CONFIGURATION
#=================================================
2020-12-07 11:54:33 +01:00
ynh_script_progression --message="Removing PHP-FPM configuration"
2018-01-24 20:18:53 +01:00
2020-12-07 11:54:33 +01:00
# Remove the dedicated PHP-FPM config
2018-01-24 20:18:53 +01:00
ynh_remove_fpm_config
2019-03-09 10:14:08 +01:00
#=================================================
# GENERIC FINALIZATION
#=================================================
# REMOVE DEDICATED USER
#=================================================
2020-12-07 11:54:33 +01:00
ynh_script_progression --message="Removing the dedicated system user"
2018-01-24 20:18:53 +01:00
# Delete a system user
2020-12-07 11:54:33 +01:00
ynh_system_user_delete --username=$app
2019-03-09 10:14:08 +01:00
#=================================================
# END OF SCRIPT
#=================================================
2020-12-07 11:54:33 +01:00
ynh_script_progression --message="Removal of $app completed"