1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/kodi_ynh.git synced 2024-09-03 19:26:34 +02:00
kodi_ynh/scripts/remove
Gredin 67 a4703fba8c
2021-01-23 21:57:24 +01:00

90 lines
2.5 KiB
Bash

#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get "$app" domain)
path_url=$(ynh_app_setting_get "$app" path)
final_path=$(ynh_app_setting_get "$app" final_path)
launch_on_boot=$(ynh_app_setting_get "$app" launch_on_boot)
open_webserver_port=$(ynh_app_setting_get "$app" open_webserver_port)
#=================================================
# GLOBAL VARS
#=================================================
arch=$(uname -m)
#=================================================
# REMOVE SYSTEMD SCRIPT (SERVICE)
#=================================================
# Stop and diasble Kodi service
# Remove kodi.service file
ynh_remove_systemd_config
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_remove_nginx_config
#=================================================
# CLOSE WEB SERVER PORT
#=================================================
if [ "$open_webserver_port" -eq 1 ]
then
yunohost firewall disallow TCP 8080 2>&1
fi
#=================================================
# REMOVE SERVICE FROM ADMIN PANEL
#=================================================
if yunohost service status | grep -q "$app"
then
echo "Remove $app service"
yunohost service remove "$app"
fi
systemctl daemon-reload
#=================================================
# X11 SETTINGS
#=================================================
ynh_replace_string "allowed_users=anybody" "allowed_users=console" /etc/X11/Xwrapper.config
#=================================================
# REMOVE DEPENDENCIES AND KODI
#=================================================
if [[ $arch != arm* ]]; then
ynh_package_remove xorg xinit dbus-x11 kodi
ynh_secure_remove "/etc/apt/sources.list.d/${app}.list"
ynh_package_update
else
ynh_package_remove xserver-xorg-legacy xorg dbus-x11 kodi
fi
#=================================================
# REMOVE APP MAIN DIR
#=================================================
# Remove the app directory securely
ynh_secure_remove "$final_path"
#=================================================
# REMOVE KODI USER
#=================================================
ynh_system_user_delete "$app"