1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/libreerp_ynh.git synced 2024-09-03 19:36:13 +02:00
libreerp_ynh/scripts/remove

117 lines
3.7 KiB
Text
Raw Normal View History

2015-09-14 17:12:17 +02:00
#!/bin/bash
2016-07-05 15:22:12 +02:00
2022-02-13 22:09:18 +01:00
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
2017-05-18 23:28:18 +02:00
source _common.sh
2022-02-13 22:09:18 +01:00
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..."
2017-05-18 23:28:18 +02:00
app=$YNH_APP_INSTANCE_NAME
2022-02-13 22:09:18 +01:00
domain=$(ynh_app_setting_get --app=$app --key=domain)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
conf_file=$(ynh_app_setting_get --app=$app --key=conf_file)
2016-07-05 15:22:12 +02:00
2022-02-13 22:09:18 +01:00
#=================================================
# STANDARD REMOVE
#=================================================
# REMOVE SERVICE INTEGRATION IN YUNOHOST
#=================================================
2016-07-05 15:22:12 +02:00
2022-02-13 22:09:18 +01:00
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
if ynh_exec_warn_less yunohost service status $app >/dev/null
then
ynh_script_progression --message="Removing $app service integration..."
yunohost service remove $app
fi
2018-12-14 03:36:58 +01:00
2022-02-13 22:09:18 +01:00
#=================================================
2022-02-17 01:23:35 +01:00
# STOP AND REMOVE SERVICE
2022-02-13 22:09:18 +01:00
#=================================================
2022-02-17 01:23:35 +01:00
ynh_script_progression --message="Stopping and removing the systemd service..."
# Remove the dedicated systemd config
ynh_remove_systemd_config
#=================================================
# REMOVE THE POSTGRESQL DATABASE
#=================================================
ynh_script_progression --message="Removing the PostgreSQL database..."
2017-05-18 23:28:18 +02:00
2022-02-13 22:09:18 +01:00
# Remove a database if it exists, along with the associated user
ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
#=================================================
# REMOVE APP MAIN DIR
#=================================================
ynh_script_progression --message="Removing app main directory..."
2022-02-13 22:09:18 +01:00
# Remove the app directory securely
ynh_secure_remove --file="$final_path"
2015-09-14 17:12:17 +02:00
2022-02-13 22:09:18 +01:00
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Removing NGINX web server configuration..."
# Remove the dedicated NGINX config
2018-12-14 03:36:58 +01:00
ynh_remove_nginx_config
2018-09-27 00:31:17 +02:00
2022-02-13 22:09:18 +01:00
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..."
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#=================================================
# SPECIFIC REMOVE
#=================================================
# REMOVE VARIOUS FILES
#=================================================
ynh_script_progression --message="Removing various files..."
2022-02-17 01:23:35 +01:00
# Remove a directory securely
ynh_secure_remove --file="/etc/$app"
# Remove the log files
ynh_secure_remove --file="/var/log/$app.log"
#=================================================
# REMOVE SWAP
#=================================================
ynh_script_progression --message="Removing swap..."
2022-02-13 22:09:18 +01:00
2022-05-29 16:07:32 +02:00
if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then
:
else
ynh_del_swap
fi
2022-02-13 22:09:18 +01:00
#=================================================
# GENERIC FINALIZATION
#=================================================
# REMOVE DEDICATED USER
#=================================================
ynh_script_progression --message="Removing the dedicated system user..."
# Delete a system user
ynh_system_user_delete --username=$app
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Removal of $app completed"