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

Update remove

This commit is contained in:
frju365 2018-02-23 20:17:09 +01:00 committed by GitHub
parent f2a0416363
commit 908d9f6e8a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,47 +1,82 @@
#!/bin/bash #!/bin/bash
# vim:set noexpandtab:
# Exit on command errors and treat unset variables as an error #=================================================
set -u # GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source .fonctions # Loads the generic functions usually used in the script source _common.sh
source /usr/share/yunohost/helpers # Source app helpers source /usr/share/yunohost/helpers
# Get multi-instances specific variables #=================================================
# LOAD SETTINGS
#=================================================
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get $app final_path)
port=$(ynh_app_setting_get $app port)
domain=$(ynh_app_setting_get $app domain) domain=$(ynh_app_setting_get $app domain)
# Stop lstu service #=================================================
if [ -e "/etc/systemd/system/lstu.service" ]; then # STANDARD REMOVE
echo "Delete systemd script" #=================================================
sudo systemctl stop lstu.service # STOP AND REMOVE SERVICE
sudo systemctl disable lstu.service #=================================================
sudo rm "/etc/systemd/system/lstu.service"
systemctl daemon-reload
fi
# Remove monitoring service Yunohost. # Remove the dedicated systemd config
if sudo yunohost service status | grep -q lstu # Test the existence of the service in Yunohost ynh_remove_systemd_config
#=================================================
# REMOVE SERVICE FROM ADMIN PANEL
#=================================================
if yunohost service status | grep -q $app
then then
echo "Remove lstu service" echo "Remove $app service"
sudo yunohost service remove lstu yunohost service remove $app
fi fi
SECURE_REMOVE '/var/www/$app' # Delete directory application #=================================================
# REMOVE APP MAIN DIR
#=================================================
REMOVE_NGINX_CONF # Delete nginx configuration # Remove the app directory securely
ynh_secure_remove "$final_path"
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
SECURE_REMOVE '/var/log/$app/' # Delete log # Remove the dedicated nginx config
ynh_remove_nginx_config
REMOVE_LOGROTATE_CONF # Delete logrotate configuration #=================================================
# Delete Log
#=================================================
ynh_package_remove build-essential || echo "build-essential already uninstalled" ynh_secure_remove "/var/log/$app/"
ynh_package_remove libssl-dev || echo "libssl-dev already uninstalled"
ynh_package_remove libpq-dev || echo "libpq-dev already uninstalled"
# Reload SSOwat configuration #=================================================
sudo yunohost app ssowatconf # REMOVE LOGROTATE CONFIGURATION
#=================================================
echo -e "\e[0m" # Restore normal color # 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
#=================================================
# REMOVE DEPENDENCIES
#=================================================
# Remove metapackage and its dependencies
ynh_remove_app_dependencies