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

106 lines
3.4 KiB
Text
Raw Permalink Normal View History

2017-09-27 23:15:40 +02:00
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
2021-04-04 00:21:27 +02:00
ynh_script_progression --message="Loading installation settings..."
2017-09-27 23:15:40 +02:00
app=$YNH_APP_INSTANCE_NAME
2021-04-04 00:21:27 +02:00
domain=$(ynh_app_setting_get --app=$app --key=domain)
port=$(ynh_app_setting_get --app=$app --key=port)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
launch_on_boot=$(ynh_app_setting_get --app=$app --key=launch_on_boot)
open_webserver_port=$(ynh_app_setting_get --app=$app --key=open_webserver_port)
#=================================================
2021-04-04 00:21:27 +02:00
# STANDARD REMOVE
#=================================================
# REMOVE SERVICE INTEGRATION IN YUNOHOST
#=================================================
2021-04-04 00:21:27 +02:00
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
if ynh_exec_warn_less yunohost service status $app >/dev/null
then
ynh_script_progression --message="Removing $app service integration..."
yunohost service remove $app
fi
2017-09-27 23:15:40 +02:00
2017-10-16 22:48:13 +02:00
#=================================================
2021-04-04 00:21:27 +02:00
# STOP AND REMOVE SERVICE
2017-10-16 22:48:13 +02:00
#=================================================
2021-04-04 00:21:27 +02:00
ynh_script_progression --message="Stopping and removing the systemd service..."
# Remove the dedicated systemd config
2017-10-16 22:48:13 +02:00
ynh_remove_systemd_config
#=================================================
2021-04-04 00:21:27 +02:00
# REMOVE DEPENDENCIES
#=================================================
2021-04-04 00:21:27 +02:00
ynh_script_progression --message="Removing dependencies..."
2021-04-04 00:21:27 +02:00
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#=================================================
2021-04-04 00:21:27 +02:00
# REMOVE APP MAIN DIR
#=================================================
2021-04-04 00:21:27 +02:00
ynh_script_progression --message="Removing app main directory..."
2021-04-04 00:21:27 +02:00
# Remove the app directory securely
ynh_secure_remove --file="$final_path"
2017-10-16 22:48:13 +02:00
#=================================================
2021-04-04 00:21:27 +02:00
# REMOVE NGINX CONFIGURATION
2017-10-16 22:48:13 +02:00
#=================================================
2021-04-04 00:21:27 +02:00
ynh_script_progression --message="Removing NGINX web server configuration..."
# Remove the dedicated NGINX config
ynh_remove_nginx_config
2017-10-16 22:48:13 +02:00
2017-09-27 23:15:40 +02:00
#=================================================
2021-04-04 00:21:27 +02:00
# CLOSE A PORT
2017-09-27 23:15:40 +02:00
#=================================================
2021-04-04 00:21:27 +02:00
if yunohost firewall list | grep -q "\- $port$"
then
ynh_script_progression --message="Closing port $port..."
ynh_exec_warn_less yunohost firewall disallow TCP $port
fi
#=================================================
2021-04-04 00:21:27 +02:00
# SPECIFIC REMOVE
#=================================================
2021-04-04 00:21:27 +02:00
# X11 SETTINGS
#=================================================
ynh_script_progression --message="Configuring X11..."
2021-04-04 00:21:27 +02:00
ynh_replace_string "allowed_users=anybody" "allowed_users=console" /etc/X11/Xwrapper.config
2017-09-27 23:15:40 +02:00
#=================================================
2021-04-04 00:21:27 +02:00
# GENERIC FINALIZATION
2017-09-27 23:15:40 +02:00
#=================================================
2021-04-04 00:21:27 +02:00
# REMOVE DEDICATED USER
#=================================================
ynh_script_progression --message="Removing the dedicated system user..."
2017-09-27 23:15:40 +02:00
2021-04-04 00:21:27 +02:00
# Delete a system user
ynh_system_user_delete --username=$app
2017-09-27 23:15:40 +02:00
#=================================================
2021-04-04 00:21:27 +02:00
# END OF SCRIPT
2017-09-27 23:15:40 +02:00
#=================================================
2021-04-04 00:21:27 +02:00
ynh_script_progression --message="Removal of $app completed"