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-05-18 20:15:36 +02:00

90 lines
2.8 KiB
Bash

#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=2
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#=================================================
# STANDARD REMOVE
#=================================================
# STOP AND REMOVE SERVICE
#=================================================
ynh_script_progression --message="Stopping and removing the systemd service..."0
# Remove the uwsgi configuration
ynh_systemd_action --service_name=uwsgi --action=stop
if [ -h "/etc/uwsgi/apps-enabled/$app.ini" ]
then
ynh_print_info --message="Delete uwsgi config for $app"
ynh_secure_remove --file="/etc/uwsgi/apps-enabled/$app.ini"
fi
ynh_secure_remove --file="/etc/uwsgi/apps-available/$app.ini"
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..."3
ynh_remove_app_dependencies
#=================================================
# REMOVE THE MAIN DIR OF THE APP
#=================================================
ynh_script_progression --message="Removing app main directory..."
ynh_secure_remove --file="$final_path"
#=================================================
# REMOVE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Removing nginx web server configuration..." --weight=2
# 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 --message="Remove uwsgi service"
yunohost service remove uwsgi
fi
fi
#=================================================
# GENERIC FINALIZATION
#=================================================
# REMOVE DEDICATED USER
#=================================================
ynh_script_progression --message="Removing the dedicated system user..."
# Delete a system user
ynh_system_user_delete --username=$app
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Removal of $app completed" --last