2018-09-25 19:03:30 +02:00
|
|
|
#!/bin/bash
|
|
|
|
# to test the functionnality :
|
|
|
|
# yunohost app remove homeassistant
|
|
|
|
|
2018-10-18 05:16:40 +02:00
|
|
|
source _common.sh
|
2018-09-25 19:03:30 +02:00
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
# retrieve arguments
|
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
2020-08-12 22:22:59 +02:00
|
|
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
|
|
|
port=$(ynh_app_setting_get --app=$app --key=port)
|
2018-09-25 19:03:30 +02:00
|
|
|
|
|
|
|
# definie useful vars
|
2018-10-18 05:16:40 +02:00
|
|
|
final_path="/opt/yunohost/$app"
|
2018-09-25 19:03:30 +02:00
|
|
|
home_path="/home/$app"
|
|
|
|
|
|
|
|
# remove metapackage and its dependencies
|
|
|
|
ynh_remove_app_dependencies
|
|
|
|
|
|
|
|
# remove the app directory securely
|
2020-08-12 22:22:59 +02:00
|
|
|
ynh_secure_remove --file="$final_path"
|
2018-09-25 19:03:30 +02:00
|
|
|
|
|
|
|
# remove the dedicated nginx config
|
|
|
|
ynh_remove_nginx_config
|
|
|
|
|
|
|
|
# remove a directory securely
|
2020-08-12 22:22:59 +02:00
|
|
|
ynh_secure_remove --file="$home_path"
|
2018-09-25 19:03:30 +02:00
|
|
|
|
|
|
|
# remove service from admin panel
|
|
|
|
if yunohost service status | grep -q "$app@$app"
|
|
|
|
then
|
|
|
|
yunohost service remove "$app@$app"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# remove systemd service
|
2018-10-18 05:16:40 +02:00
|
|
|
ynh_system_reload --service_name="$app@$app" --action=stop
|
|
|
|
ynh_system_reload --service_name="$app@$app" --action=disable
|
2020-08-12 22:22:59 +02:00
|
|
|
ynh_secure_remove --file="/etc/systemd/system/$app.service"
|
2018-09-25 19:03:30 +02:00
|
|
|
|
|
|
|
# close port
|
2018-10-18 05:16:40 +02:00
|
|
|
ynh_exec_fully_quiet yunohost firewall disallow TCP $port
|
2018-09-25 19:03:30 +02:00
|
|
|
|
|
|
|
# delete a system user
|
2020-08-12 22:22:59 +02:00
|
|
|
ynh_system_user_delete --username=$app
|
2018-12-18 07:30:30 +01:00
|
|
|
|
|
|
|
# remove sudoers file
|
|
|
|
ynh_secure_remove "/etc/sudoers.d/$app"
|