2016-10-25 00:00:01 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2017-10-14 14:38:56 +02:00
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
2016-10-25 00:00:01 +02:00
|
|
|
|
2017-10-14 14:38:56 +02:00
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
2016-10-25 00:00:01 +02:00
|
|
|
|
2017-10-14 14:38:56 +02:00
|
|
|
#=================================================
|
|
|
|
# LOAD SETTINGS
|
|
|
|
#=================================================
|
2020-07-25 23:14:14 +02:00
|
|
|
ynh_script_progression --message="Loading installation settings..." --weight=1
|
2016-10-25 00:00:01 +02:00
|
|
|
|
2017-10-14 14:38:56 +02:00
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
2016-10-25 00:00:01 +02:00
|
|
|
|
2020-07-25 23:14:14 +02:00
|
|
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
|
|
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
2021-05-12 09:09:45 +02:00
|
|
|
data_path=$(ynh_app_setting_get --app=$app --key=data_path)
|
2016-10-25 00:00:01 +02:00
|
|
|
|
2017-10-14 14:38:56 +02:00
|
|
|
#=================================================
|
|
|
|
# STANDARD REMOVE
|
|
|
|
#=================================================
|
2020-07-25 23:14:14 +02:00
|
|
|
# REMOVE SERVICE INTEGRATION IN YUNOHOST
|
2017-10-14 14:38:56 +02:00
|
|
|
#=================================================
|
2016-10-25 00:00:01 +02:00
|
|
|
|
2020-12-14 10:34:54 +01:00
|
|
|
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
2020-07-25 23:14:14 +02:00
|
|
|
if ynh_exec_warn_less yunohost service status $app >/dev/null
|
|
|
|
then
|
|
|
|
ynh_script_progression --message="Removing $app service integration..." --weight=1
|
|
|
|
yunohost service remove $app
|
|
|
|
fi
|
2016-10-25 00:00:01 +02:00
|
|
|
|
2017-10-14 14:38:56 +02:00
|
|
|
#=================================================
|
2020-07-25 23:14:14 +02:00
|
|
|
# STOP AND REMOVE SERVICE
|
2017-10-14 14:38:56 +02:00
|
|
|
#=================================================
|
2020-07-25 23:14:14 +02:00
|
|
|
ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1
|
2016-10-25 00:00:01 +02:00
|
|
|
|
2020-07-25 23:14:14 +02:00
|
|
|
# Remove the dedicated systemd config
|
|
|
|
ynh_remove_systemd_config
|
2016-10-25 00:00:01 +02:00
|
|
|
|
2017-10-14 14:38:56 +02:00
|
|
|
#=================================================
|
|
|
|
# REMOVE APP MAIN DIR
|
|
|
|
#=================================================
|
2020-07-25 23:14:14 +02:00
|
|
|
ynh_script_progression --message="Removing app main directory..." --weight=2
|
2017-10-14 14:38:56 +02:00
|
|
|
|
2020-07-25 23:14:14 +02:00
|
|
|
# Remove the app directory securely
|
|
|
|
ynh_secure_remove --file="$final_path"
|
2017-10-14 14:38:56 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# REMOVE NGINX CONFIGURATION
|
|
|
|
#=================================================
|
2020-07-25 23:14:14 +02:00
|
|
|
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
|
2017-10-14 14:38:56 +02:00
|
|
|
|
2020-07-25 23:14:14 +02:00
|
|
|
# Remove the dedicated NGINX config
|
2017-10-14 14:38:56 +02:00
|
|
|
ynh_remove_nginx_config
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# REMOVE LOGROTATE CONFIGURATION
|
|
|
|
#=================================================
|
2020-07-25 23:14:14 +02:00
|
|
|
ynh_script_progression --message="Removing logrotate configuration..." --weight=1
|
2017-10-14 14:38:56 +02:00
|
|
|
|
|
|
|
ynh_remove_logrotate
|
|
|
|
|
|
|
|
#=================================================
|
2017-11-29 15:42:21 +01:00
|
|
|
# SPECIFIC REMOVE
|
|
|
|
#=================================================
|
|
|
|
# REMOVE HASTE BINARY
|
2017-10-14 14:38:56 +02:00
|
|
|
#=================================================
|
|
|
|
|
2020-07-25 23:14:14 +02:00
|
|
|
ynh_secure_remove --file="/usr/bin/$app"
|
2017-10-14 14:38:56 +02:00
|
|
|
|
|
|
|
#=================================================
|
2017-11-29 15:42:21 +01:00
|
|
|
# REMOVE DATADIR DIRECTORY
|
|
|
|
#=================================================
|
|
|
|
|
2021-05-12 09:09:45 +02:00
|
|
|
ynh_secure_remove --file="$data_path"
|
2017-11-29 15:42:21 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# REMOVE NODEJS
|
2017-10-14 14:38:56 +02:00
|
|
|
#=================================================
|
|
|
|
|
2017-11-29 15:42:21 +01:00
|
|
|
ynh_remove_nodejs
|
|
|
|
|
2017-10-14 14:38:56 +02:00
|
|
|
#=================================================
|
|
|
|
# GENERIC FINALIZATION
|
|
|
|
#=================================================
|
|
|
|
# REMOVE DEDICATED USER
|
|
|
|
#=================================================
|
2020-07-25 23:14:14 +02:00
|
|
|
ynh_script_progression --message="Removing the dedicated system user..." --weight=1
|
2017-10-14 14:38:56 +02:00
|
|
|
|
|
|
|
# Delete a system user
|
2020-07-25 23:14:14 +02:00
|
|
|
ynh_system_user_delete --username=$app
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
ynh_script_progression --message="Removal of $app completed" --last
|