mirror of
https://github.com/YunoHost-Apps/lufi_ynh.git
synced 2024-09-03 19:36:28 +02:00
Update remove
This commit is contained in:
parent
d29b959167
commit
4d9cf80c9d
1 changed files with 76 additions and 34 deletions
110
scripts/remove
110
scripts/remove
|
@ -1,53 +1,95 @@
|
||||||
#!/bin/bash
|
#=================================================
|
||||||
|
# GENERIC START
|
||||||
|
#=================================================
|
||||||
|
# IMPORT GENERIC HELPERS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
# Exit on command errors and treat unset variables as an error
|
source _common.sh
|
||||||
set -u
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
if [ ! -e .fonctions ]; then
|
#=================================================
|
||||||
# Get file fonction if not been to the current directory
|
# LOAD SETTINGS
|
||||||
sudo cp ../settings/scripts/.fonctions ./.fonctions
|
#=================================================
|
||||||
sudo chmod a+rx .fonctions
|
|
||||||
fi
|
|
||||||
source .fonctions # Loads the generic functions usually used in the script
|
|
||||||
source /usr/share/yunohost/helpers # Source app helpers
|
|
||||||
|
|
||||||
# Get multi-instances specific variables
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
domain=$(ynh_app_setting_get $app domain)
|
||||||
|
|
||||||
# Stop lufi service
|
#=================================================
|
||||||
if [ -e "/etc/systemd/system/lufi.service" ]; then
|
# STANDARD REMOVE
|
||||||
echo "Delete systemd script"
|
#=================================================
|
||||||
sudo service lufi stop
|
# STOP AND REMOVE SERVICE
|
||||||
sudo rm "/etc/systemd/system/lufi.service"
|
#=================================================
|
||||||
sudo systemctl disable lufi.service
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Remove monitoring service Yunohost.
|
# Remove the dedicated systemd config
|
||||||
if sudo yunohost service status | grep -q lufi # Test l'existence du service dans Yunohost
|
ynh_remove_systemd_config
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# 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
|
then
|
||||||
echo "Remove lufi service"
|
echo "Remove $app service"
|
||||||
sudo yunohost service remove lufi
|
yunohost service remove $app
|
||||||
fi
|
fi
|
||||||
|
|
||||||
SECURE_REMOVE '/var/www/$app' # Delete directory application
|
#=================================================
|
||||||
|
# REMOVE DEPENDENCIES
|
||||||
|
#=================================================
|
||||||
|
|
||||||
REMOVE_NGINX_CONF # Delete nginx configuration
|
# Remove metapackage and its dependencies
|
||||||
|
ynh_remove_app_dependencies
|
||||||
|
|
||||||
# Delete cron
|
#=================================================
|
||||||
if [ -e "/etc/cron.d/$app" ]; then
|
# REMOVE APP MAIN DIR
|
||||||
echo "Delete cron"
|
#=================================================
|
||||||
sudo rm "/etc/cron.d/$app"
|
|
||||||
|
# Remove the app directory securely
|
||||||
|
ynh_secure_remove "$final_path"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# 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" >&2
|
||||||
|
yunohost firewall disallow TCP $port 2>&1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
SECURE_REMOVE '/var/log/$app/' # Delete log
|
#=================================================
|
||||||
|
# SPECIFIC REMOVE
|
||||||
|
#=================================================
|
||||||
|
# REMOVE THE CRON FILE
|
||||||
|
#=================================================
|
||||||
|
|
||||||
REMOVE_LOGROTATE_CONF # Delete logrotate configuration
|
# Remove a cron file
|
||||||
|
ynh_secure_remove "/etc/cron.d/$app"
|
||||||
|
|
||||||
ynh_package_remove build-essential || echo "build-essential already uninstalled"
|
# Remove the log files
|
||||||
|
ynh_secure_remove "/var/log/$app/"
|
||||||
|
|
||||||
# Reload SSOwat configuration
|
#=================================================
|
||||||
sudo yunohost app ssowatconf
|
# GENERIC FINALIZATION
|
||||||
|
#=================================================
|
||||||
|
# REMOVE DEDICATED USER
|
||||||
|
#=================================================
|
||||||
|
|
||||||
echo -e "\e[0m" # Restore normal color
|
# Delete a system user
|
||||||
|
ynh_system_user_delete $app
|
||||||
|
|
Loading…
Reference in a new issue