1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/octoprint_ynh.git synced 2024-09-03 19:46:26 +02:00
octoprint_ynh/scripts/remove

47 lines
1.2 KiB
Bash

#!/bin/bash
# to test the functionnality :
# yunohost app remove octoprint
source _common.sh
source /usr/share/yunohost/helpers
# retrieve arguments
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
#REMOVEME? domain=$(ynh_app_setting_get "$app" domain)
#REMOVEME? port=$(ynh_app_setting_get $app port)
# definie useful vars
#REMOVEME? install_dir="/opt/yunohost/$app"
home_path="/home/$app"
# remove metapackage and its dependencies
#REMOVEME? ynh_remove_app_dependencies
# remove the app directory securely
#REMOVEME? ynh_secure_remove "$install_dir"
# remove the dedicated nginx config
ynh_remove_nginx_config
# remove a directory securely
ynh_secure_remove "$home_path"
# remove service from admin panel
if yunohost service status | grep -q "$app@$app"
then
yunohost service remove "$app@$app"
fi
# remove systemd service
ynh_system_reload --service_name="$app@$app" --action=stop
ynh_system_reload --service_name="$app@$app" --action=disable
ynh_secure_remove "/etc/systemd/system/$app@$app.service"
# close port
ynh_exec_fully_quiet yunohost firewall disallow TCP $port
# delete a system user
#REMOVEME? ynh_system_user_delete "$app"
# remove sudoers file
ynh_secure_remove "/etc/sudoers.d/$app"