| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147 |
- #!/bin/bash
- #=================================================
- # GENERIC STARTING
- #=================================================
- # 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)
- port=$(ynh_app_setting_get $app port)
- #=================================================
- # STANDARD REMOVE
- #=================================================
- # DISABLE SERVICE IN ADMIN PANEL
- #=================================================
- if yunohost service status | grep -q pihole-FTL # Test l'existence du service dans Yunohost
- then
- ynh_print_info "Remove pihole-FTL service" >&2
- yunohost service remove pihole-FTL
- fi
- #=================================================
- # STOP THE SERVICE PIHOLE-FTL
- #=================================================
- ynh_system_reload pihole-FTL stop
- ynh_exec_warn_less systemctl disable pihole-FTL
- rm -f "/etc/init.d/pihole-FTL" "/usr/bin/pihole-FTL" "/var/run/pihole-FTL.pid" "/var/run/pihole-FTL.port"
- #=================================================
- # REMOVE DEPENDENCIES
- #=================================================
- ynh_remove_app_dependencies
- #=================================================
- # REMOVE THE DIRECTORIES OF THE APP
- #=================================================
- ynh_secure_remove "/etc/pihole" # Suppression du dossier de stockage l'application
- ynh_secure_remove "/opt/pihole" # Suppression du dossier l'application
- ynh_secure_remove "/var/www/pihole" # Suppression de l'interface de l'application
- ynh_secure_remove "/etc/.pihole" # Suppression du clone local du dépôt
- #=================================================
- # REMOVE THE NGINX CONFIGURATION
- #=================================================
- ynh_remove_nginx_config # Suppression de la configuration nginx
- #=================================================
- # REMOVE THE PHP-FPM CONFIGURATION
- #=================================================
- ynh_remove_fpm_config # Suppression de la configuration du pool php-fpm
- #=================================================
- # CLOSE A PORT
- #=================================================
- if yunohost firewall list | grep -q "\- $port$"
- then
- ynh_print_info "Close port $port" >&2
- ynh_exec_quiet yunohost firewall disallow TCP $port
- fi
- if yunohost firewall list | grep -q "\- 67$"
- then
- ynh_print_info "Close port 67" >&2
- ynh_exec_quiet yunohost firewall disallow UDP 67
- fi
- #=================================================
- # SPECIFIC REMOVE
- #=================================================
- # REMOVE THE CRON FILE
- #=================================================
- ynh_secure_remove "/etc/cron.d/pihole"
- #=================================================
- # REMOVE OTHER FILES
- #=================================================
- # Suppression des log
- ynh_secure_remove "/var/log/pihole.log"
- ynh_secure_remove "/var/log/pihole-FTL.log"
- # Remove the main script
- ynh_secure_remove "/usr/local/bin/pihole"
- ynh_secure_remove "/etc/bash_completion.d/pihole"
- # Remove the sudoer file
- ynh_secure_remove "/etc/sudoers.d/pihole"
- #=================================================
- # REMOVE THE DNSMASQ CONFIG
- #=================================================
- ynh_system_reload dnsmasq stop
- rm -f "/etc/dnsmasq.d/01-pihole.conf"
- rm -f "/etc/dnsmasq.d/02-pihole-dhcp.conf"
- rm -f "/etc/dnsmasq.d/03-pihole-wildcard.conf"
- rm -f "/etc/dnsmasq.d/04-pihole-static-dhcp.conf"
- ynh_replace_string "#pihole# " "" /etc/dnsmasq.conf
- #=================================================
- # CLEAN /etc/hosts
- #=================================================
- # Restaure les résolutions qui avaient été commentées par pihole
- sed -i "s/#Commented by pihole# //g" /etc/hosts
- # Et supprime les lignes ajoutées par pihole
- sed -i "/#Added by pihole#/d" /etc/hosts
- #=================================================
- # RESTART DNSMASQ
- #=================================================
- ynh_system_reload dnsmasq restart
- #=================================================
- # REMOVE THE CONF_REGEN HOOK
- #=================================================
- ynh_secure_remove /usr/share/yunohost/hooks/conf_regen/50-dnsmasq_$app
- #=================================================
- # GENERIC FINALISATION
- #=================================================
- # REMOVE DEDICATED USER
- #=================================================
- ynh_system_user_delete $app
|