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

Apply example_ynh on remove

This commit is contained in:
yalh76 2019-02-05 22:17:28 +01:00
parent 66c394e0bc
commit 2c1dc36d21

View file

@ -13,38 +13,47 @@ source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
readonly app=$YNH_APP_INSTANCE_NAME
readonly domain=$(ynh_app_setting_get "$app" domain)
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get $app domain)
port=$(ynh_app_setting_get $app port)
db_name=$(ynh_app_setting_get $app db_name)
readonly final_path=$(ynh_app_setting_get "$app" final_path)
final_path=$(ynh_app_setting_get $app final_path)
#=================================================
# STANDARD REMOVE
#=================================================
# STOP AND REMOVE SERVICE
# REMOVE SERVICE FROM ADMIN PANEL
#=================================================
ynh_remove_systemd_config
#=================================================
# DISABLE SERVICE IN ADMIN PANEL
#=================================================
if yunohost service status | grep -q $app # Test l'existence du service dans Yunohost
# Remove a service from the admin panel, added by `yunohost service add`
if yunohost service status | grep -q $app
then
echo "Remove $app service"
yunohost service remove $app
echo "Remove $app service"
yunohost service remove $app
fi
#=================================================
# REMOVE DB
# STOP AND REMOVE SERVICE
#=================================================
# Remove the dedicated systemd config
ynh_remove_systemd_config
#=================================================
# REMOVE THE MONGODB DATABASE
#=================================================
# Remove a database if it exists, along with the associated user
mongo $db_name --eval "db.dropDatabase()"
#=================================================
# REMOVE DEPENDENCIES
#=================================================
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#=================================================
@ -54,23 +63,34 @@ ynh_remove_app_dependencies
ynh_remove_nodejs
#=================================================
# REMOVE THE MAIN DIR OF THE APP
# REMOVE APP MAIN DIR
#=================================================
ynh_secure_remove "/var/www/$app"
# Remove the app directory securely
ynh_secure_remove "$final_path"
#=================================================
# REMOVE THE NGINX CONFIGURATION
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_remove_nginx_config
# Remove the dedicated nginx config
ynh_remove_nginx_config
#=================================================
# GENERIC FINALISATION
# CLOSE A PORT
#=================================================
if yunohost firewall list | grep -q "\- $port$"
then
echo "Close port $port" >&2
yunohost firewall disallow TCP $port 2>&1
fi
#=================================================
# GENERIC FINALIZATION
#=================================================
# REMOVE DEDICATED USER
#=================================================
# Delete a system user
ynh_system_user_delete $app