2017-04-08 00:06:50 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-05-04 11:47:06 +02:00
|
|
|
#=================================================
|
2022-05-28 01:29:55 +02:00
|
|
|
# GENERIC START
|
2018-05-04 11:47:06 +02:00
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
2017-07-23 00:14:35 +02:00
|
|
|
|
2017-07-23 17:46:25 +02:00
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
2018-05-04 11:47:06 +02:00
|
|
|
#=================================================
|
|
|
|
# LOAD SETTINGS
|
|
|
|
#=================================================
|
2020-07-18 11:46:45 +02:00
|
|
|
ynh_script_progression --message="Loading installation settings..." --weight=1
|
2018-05-04 11:47:06 +02:00
|
|
|
|
2017-04-08 00:06:50 +02:00
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
2020-07-18 11:46:45 +02:00
|
|
|
|
|
|
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
2022-05-28 01:29:55 +02:00
|
|
|
port=$(ynh_app_setting_get --app=$app --key=port)
|
2020-07-18 11:46:45 +02:00
|
|
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
2017-04-08 00:06:50 +02:00
|
|
|
|
2018-05-04 11:47:06 +02:00
|
|
|
#=================================================
|
|
|
|
# STANDARD REMOVE
|
|
|
|
#=================================================
|
2020-07-18 11:46:45 +02:00
|
|
|
# REMOVE SERVICE INTEGRATION IN YUNOHOST
|
2018-05-04 11:47:06 +02:00
|
|
|
#=================================================
|
|
|
|
|
2020-12-04 11:33:12 +01:00
|
|
|
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
2020-07-18 11:46:45 +02:00
|
|
|
if ynh_exec_warn_less yunohost service status $app >/dev/null
|
|
|
|
then
|
2022-05-28 01:29:55 +02:00
|
|
|
ynh_script_progression --message="Removing $app service integration..." --weight=3
|
2020-07-18 11:46:45 +02:00
|
|
|
yunohost service remove $app
|
|
|
|
fi
|
2017-04-08 00:06:50 +02:00
|
|
|
|
2018-05-04 11:47:06 +02:00
|
|
|
#=================================================
|
2020-07-18 11:46:45 +02:00
|
|
|
# STOP AND REMOVE SERVICE
|
2018-05-04 11:47:06 +02:00
|
|
|
#=================================================
|
2020-07-18 11:46:45 +02:00
|
|
|
ynh_script_progression --message="Stopping and removing the systemd service..." --weight=2
|
2017-07-30 21:33:54 +02:00
|
|
|
|
2020-07-18 11:46:45 +02:00
|
|
|
# Remove the dedicated systemd config
|
|
|
|
ynh_remove_systemd_config
|
2017-04-08 00:06:50 +02:00
|
|
|
|
2018-05-04 11:47:06 +02:00
|
|
|
#=================================================
|
2019-01-05 20:42:54 +01:00
|
|
|
# REMOVE APP MAIN DIR
|
|
|
|
#=================================================
|
2022-05-28 01:29:55 +02:00
|
|
|
ynh_script_progression --message="Removing app main directory..." --weight=3
|
2019-01-05 20:42:54 +01:00
|
|
|
|
|
|
|
# Remove the app directory securely
|
2020-07-18 11:46:45 +02:00
|
|
|
ynh_secure_remove --file="$final_path"
|
2019-01-05 20:42:54 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# REMOVE NGINX CONFIGURATION
|
2018-05-04 11:47:06 +02:00
|
|
|
#=================================================
|
2020-10-13 13:52:56 +02:00
|
|
|
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
|
2017-04-08 00:06:50 +02:00
|
|
|
|
2020-10-13 13:52:56 +02:00
|
|
|
# Remove the dedicated NGINX config
|
2019-01-05 20:42:54 +01:00
|
|
|
ynh_remove_nginx_config
|
2018-05-04 11:47:06 +02:00
|
|
|
|
2022-05-28 01:29:55 +02:00
|
|
|
#=================================================
|
|
|
|
# REMOVE DEPENDENCIES
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Removing dependencies..." --weight=3
|
|
|
|
|
|
|
|
ynh_remove_nodejs
|
|
|
|
|
2018-05-04 11:47:06 +02:00
|
|
|
#=================================================
|
2020-07-18 11:46:45 +02:00
|
|
|
# GENERIC FINALIZATION
|
2018-05-04 11:47:06 +02:00
|
|
|
#=================================================
|
2020-07-18 11:46:45 +02:00
|
|
|
# REMOVE DEDICATED USER
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Removing the dedicated system user..." --weight=1
|
2018-05-04 11:47:06 +02:00
|
|
|
|
2020-07-18 11:46:45 +02:00
|
|
|
# Delete a system user
|
|
|
|
ynh_system_user_delete --username=$app
|
2018-05-04 11:47:06 +02:00
|
|
|
|
|
|
|
#=================================================
|
2020-07-18 11:46:45 +02:00
|
|
|
# END OF SCRIPT
|
2018-05-04 11:47:06 +02:00
|
|
|
#=================================================
|
|
|
|
|
2021-09-19 08:33:36 +02:00
|
|
|
ynh_script_progression --message="Removal of $app completed" --last
|