1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/osjs_ynh.git synced 2024-09-03 19:56:11 +02:00

Update remove

This commit is contained in:
frju365 2018-05-06 11:54:30 +02:00 committed by GitHub
parent 466ce98693
commit a107719bea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,34 +1,79 @@
#!/bin/bash
# Source app helpers
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
# Exit on command errors and treat unset variables as an error
set -u
set -eu
#=================================================
# LOAD SETTINGS
#=================================================
app=$YNH_APP_INSTANCE_NAME
# Retrieve app settings
domain=$(ynh_app_setting_get $app domain)
port=$(ynh_app_setting_get $app port)
domain=$(ynh_app_setting_get $app domain)
sudo systemctl stop $app.service
#=================================================
# STANDARD REMOVE
#=================================================
# STOP AND REMOVE SERVICE
#=================================================
# Remove sources
sudo rm -rf /var/www/$app
# Remove the dedicated systemd config
ynh_remove_systemd_config
# Remove nginx configuration file
[[ -n $domain ]] && sudo rm -f /etc/nginx/conf.d/${domain}.d/${app}.conf
#=================================================
# REMOVE SERVICE FROM ADMIN PANEL
#=================================================
# Remove haste user and data
sudo userdel -r $app
if yunohost service status | grep -q $app
then
echo "Remove $app service"
yunohost service remove $app
fi
# Remove init script
sudo systemctl disable $app.service
sudo rm -f /etc/systemd/system/$app.service
sudo systemctl daemon-reload
#=================================================
# REMOVE APP MAIN DIR
#=================================================
# Remove monitor
sudo yunohost service remove $app
# Remove the app directory securely
ynh_secure_remove "$final_path"
# Reload nginx service
sudo systemctl reload nginx.service
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
# Remove the dedicated nginx config
ynh_remove_nginx_config
#=================================================
# REMOVE LOGROTATE CONFIGURATION
#=================================================
# Remove the app-specific logrotate config
ynh_remove_logrotate
#=================================================
# CLOSE A PORT
#=================================================
if yunohost firewall list | grep -q "\- $port$"
then
echo "Close port $port"
yunohost firewall disallow TCP $port 2>&1
fi
#=================================================
# GENERIC FINALIZATION
#=================================================
# REMOVE DEDICATED USER
#=================================================
# Delete a system user
ynh_system_user_delete $app