1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/spip_ynh.git synced 2024-09-03 20:25:59 +02:00
spip_ynh/scripts/remove

81 lines
2.6 KiB
Text
Raw Normal View History

2015-04-28 17:32:31 +02:00
#!/bin/bash
2019-03-10 02:20:27 +01:00
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
2017-02-21 04:04:26 +01:00
2019-03-10 02:20:27 +01:00
source _common.sh
2017-03-29 19:00:53 +02:00
source /usr/share/yunohost/helpers
2019-03-10 02:20:27 +01:00
#=================================================
# LOAD SETTINGS
#=================================================
2020-12-18 10:52:22 +01:00
ynh_script_progression --message="Loading installation settings..."
2019-03-10 02:20:27 +01:00
2016-09-20 01:51:28 +02:00
app=$YNH_APP_INSTANCE_NAME
2020-12-18 10:52:22 +01:00
domain=$(ynh_app_setting_get --app=$app --key=domain)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
2019-03-10 02:20:27 +01:00
db_user=$db_name
2020-12-18 10:52:22 +01:00
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
2019-03-10 02:20:27 +01:00
#=================================================
# STANDARD REMOVE
#=================================================
# STOP AND REMOVE SERVICE
#=================================================
2021-05-18 04:02:21 +02:00
ynh_script_progression --message="Stopping and removing the systemd service..."
2019-03-10 02:20:27 +01:00
# Remove the dedicated systemd config
ynh_remove_systemd_config
#=================================================
# REMOVE THE MYSQL DATABASE
#=================================================
2021-05-18 04:02:21 +02:00
ynh_script_progression --message="Removing the MySQL database..."
2019-03-10 02:20:27 +01:00
# Remove a database if it exists, along with the associated user
2021-05-18 04:02:21 +02:00
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
2019-03-10 02:20:27 +01:00
#=================================================
# REMOVE APP MAIN DIR
#=================================================
2020-12-18 10:52:22 +01:00
ynh_script_progression --message="Removing app main directory..."
2019-03-10 02:20:27 +01:00
# Remove the app directory securely
2020-12-18 10:52:22 +01:00
ynh_secure_remove --file="$final_path"
2019-03-10 02:20:27 +01:00
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
2020-12-18 10:52:22 +01:00
ynh_script_progression --message="Removing NGINX web server configuration..."
2019-03-10 02:20:27 +01:00
2021-05-18 04:02:21 +02:00
# Remove the dedicated NGINX config
2019-03-10 02:20:27 +01:00
ynh_remove_nginx_config
#=================================================
# REMOVE PHP-FPM CONFIGURATION
#=================================================
2020-12-18 10:52:22 +01:00
ynh_script_progression --message="Removing PHP-FPM configuration..."
2019-03-10 02:20:27 +01:00
2021-05-18 04:02:21 +02:00
# Remove the dedicated PHP-FPM config
2019-03-10 02:20:27 +01:00
ynh_remove_fpm_config
#=================================================
# GENERIC FINALIZATION
#=================================================
# REMOVE DEDICATED USER
#=================================================
2020-12-18 10:52:22 +01:00
ynh_script_progression --message="Removing the dedicated system user..."
2019-03-10 02:20:27 +01:00
# Delete a system user
2020-12-18 10:52:22 +01:00
ynh_system_user_delete --username=$app
2019-03-10 02:20:27 +01:00
#=================================================
# END OF SCRIPT
#=================================================
2020-12-18 10:52:22 +01:00
ynh_script_progression --message="Removal of $app completed" --last