1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/searx_ynh.git synced 2024-09-03 20:16:30 +02:00
searx_ynh/scripts/remove
2019-03-03 20:33:02 +01:00

90 lines
2.6 KiB
Bash

#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info "Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get $app domain)
final_path=$(ynh_app_setting_get $app final_path)
#=================================================
# STANDARD REMOVE
#=================================================
# STOP AND REMOVE SERVICE
#=================================================
ynh_print_info "Stopping and removing the systemd service"
# Remove the uwsgi configuration
ynh_systemd_action --service_name=uwsgi --action=stop
if [ -h "/etc/uwsgi/apps-enabled/$app.ini" ]
then
ynh_print_info "Delete uwsgi config for $app"
ynh_secure_remove "/etc/uwsgi/apps-enabled/$app.ini"
fi
ynh_secure_remove "/etc/uwsgi/apps-available/$app.ini"
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_print_info "Removing dependencies"
ynh_remove_app_dependencies
#=================================================
# REMOVE THE MAIN DIR OF THE APP
#=================================================
ynh_print_info "Removing app main directory"
ynh_secure_remove "$final_path"
#=================================================
# REMOVE THE NGINX CONFIGURATION
#=================================================
ynh_print_info "Removing nginx web server configuration"
# Remove the dedicated nginx config
ynh_remove_nginx_config
#=================================================
# REMOVE SERVICE FROM ADMIN PANEL
#=================================================
if [ -e /etc/init.d/uwsgi ]
then
# Redémarre le service uwsgi si il n'est pas désinstallé.
ynh_systemd_action --service_name=uwsgi --action=start
else
if yunohost service status | grep -q uwsgi
then
ynh_print_info "Remove uwsgi service"
yunohost service remove uwsgi
fi
fi
#=================================================
# GENERIC FINALIZATION
#=================================================
# 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"