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

Apply example_ynh to remove

This commit is contained in:
yalh76 2019-02-14 19:40:31 +01:00
parent 499a52b1e0
commit 427b54c949

View file

@ -1,7 +1,7 @@
#!/bin/bash
#=================================================
# GENERIC STARTING
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
@ -12,6 +12,7 @@ source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info "Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
@ -20,39 +21,48 @@ port=$(ynh_app_setting_get $app port)
#=================================================
# STANDARD REMOVE
#=================================================
# REMOVE SERVICE FROM ADMIN PANEL
#=================================================
# Remove a service from the admin panel, added by `yunohost service add`
if yunohost service status | grep -q $app
then
ynh_print_info "Removing $app service"
yunohost service remove $app
fi
#=================================================
# STOP AND REMOVE SERVICE
#=================================================
ynh_print_info "Stopping and removing the service"
# Remove the dedicated systemd config
ynh_remove_systemd_config
#=================================================
# DISABLE SERVICE IN ADMIN PANEL
#=================================================
if yunohost service status | grep -q $app # Test l'existence du service dans Yunohost
then
ynh_print_info "Remove $app service" >&2
yunohost service remove $app.service
fi
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_print_info "Removing dependencies"
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#=================================================
# REMOVE THE MAIN DIR OF THE APP
# REMOVE APP MAIN DIR
#=================================================
ynh_print_info "Removing app main directory"
ynh_secure_remove "/var/www/$app" # Suppression du dossier de l'application
# Remove the app directory securely
ynh_secure_remove "$final_path"
#=================================================
# REMOVE THE NGINX CONFIGURATION
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_print_info "Removing nginx configuration"
ynh_remove_nginx_config # Suppression de la configuration nginx
# Remove the dedicated nginx config
ynh_remove_nginx_config
#=================================================
# CLOSE A PORT
@ -60,8 +70,8 @@ ynh_remove_nginx_config # Suppression de la configuration nginx
if yunohost firewall list | grep -q "\- $port$"
then
ynh_print_info "Close port $port" >&2
ynh_exec_quiet yunohost firewall disallow TCP $port
ynh_print_info "Closing port $port"
ynh_exec_warn_less yunohost firewall disallow TCP $port
fi
#=================================================
@ -69,5 +79,13 @@ fi
#=================================================
# REMOVE DEDICATED USER
#=================================================
ynh_print_info "Removing the dedicated system user"
# Delete a system user
ynh_system_user_delete $app
#=================================================
# END OF SCRIPT
#=================================================
ynh_print_info "Removal of $app completed"