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
2017-10-16 22:48:13 +02:00

71 lines
1.9 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)
final_path=$(ynh_app_setting_get $app final_path)
launch_on_boot=$(ynh_app_setting_get $app launch_on_boot)
#=================================================
# REMOVE SYSTEMD SCRIPT (SERVICE)
#=================================================
ynh_remove_systemd_config
#=================================================
# REMOVE SERVICE FROM ADMIN PANEL
#=================================================
if yunohost service status | grep -q $app
then
echo "Remove $app service"
yunohost service remove $app
fi
sudo systemctl daemon-reload
#=================================================
# REMOVE DEPENDENCIES
#=================================================
# Remove metapackage and its dependencies
sudo sed -i 's/allowed_users=anybody/allowed_users=console/' /etc/X11/Xwrapper.config
ynh_package_autoremove kodi xorg dbus-x11 xserver-xorg-legacy
arch=$(uname -m)
if [[ $arch != arm* ]]; then
sudo rm -f "/etc/apt/sources.list.d/${app}.list"
fi
ynh_package_update
#=================================================
# REMOVE APP MAIN DIR
#=================================================
# Remove the app directory securely
ynh_secure_remove "$final_path"
#=================================================
# REMOVE KODI USER
#=================================================
ynh_system_user_delete "$app"
sudo rm -rf "/home/$app"
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_remove_nginx_config