1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/squid3_ynh.git synced 2024-09-03 20:26:11 +02:00
squid3_ynh/scripts/remove
2020-11-02 23:57:34 +05:30

65 lines
2 KiB
Bash
Executable file

#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
squid_port=$(ynh_app_setting_get $app squid_port)
squid=$(ynh_app_setting_get $app squid_folder)
#=================================================
# STANDARD REMOVE
#=================================================
# REMOVE SERVICE INTEGRATION IN YUNOHOST
#=================================================
# 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="Remove $squid service"
yunohost service remove $app
fi
#=================================================
# REMOVE DEPENDENCIES
#=================================================
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#=================================================
# CLOSE A PORT
#=================================================
if yunohost firewall list | grep -q "\- $squid_port$"
then
ynh_script_progression --message="Closing port $squid_port..."
ynh_exec_warn_less yunohost firewall disallow TCP $squid_port
fi
#=================================================
# SPECIFIC REMOVE
#=================================================
# REMOVE VARIOUS FILES
#=================================================
# Remove a directory securely
ynh_secure_remove --file="/etc/$squid/"
# Remove the log files
ynh_secure_remove --file="/var/log/$squid/access.log"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Removal of $app completed"