From 13207293538d5abc35f2788eb3f5ac4841409e20 Mon Sep 17 00:00:00 2001 From: Halbe Bruno Date: Tue, 9 Dec 2025 07:58:41 -0300 Subject: [PATCH] =?UTF-8?q?corre=C3=A7=C3=A3o=20desisntalador?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install.sh | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/install.sh b/install.sh index 195aad5..0be9fe5 100755 --- a/install.sh +++ b/install.sh @@ -272,24 +272,28 @@ EOF # Remover o include do DNSBlock dos arquivos de configuração remover_include_unbound() { - local include_pattern='include:[[:space:]]*"/opt/dnsblock/unbound.conf"' - local comment_pattern='#[[:space:]]*DNSBlock' - # Remover do arquivo principal if [ -f "$UNBOUND_MAIN_CONF" ]; then - sed -i "/$include_pattern/d" "$UNBOUND_MAIN_CONF" 2>/dev/null || true - sed -i "/$comment_pattern/d" "$UNBOUND_MAIN_CONF" 2>/dev/null || true - # Remover linhas em branco duplicadas - sed -i '/^$/N;/^\n$/d' "$UNBOUND_MAIN_CONF" 2>/dev/null || true + # Criar arquivo temporário sem as linhas do DNSBlock + grep -v '/opt/dnsblock' "$UNBOUND_MAIN_CONF" | grep -v '^# DNSBlock' > "${UNBOUND_MAIN_CONF}.tmp" 2>/dev/null + if [ -s "${UNBOUND_MAIN_CONF}.tmp" ]; then + mv "${UNBOUND_MAIN_CONF}.tmp" "$UNBOUND_MAIN_CONF" + else + rm -f "${UNBOUND_MAIN_CONF}.tmp" + fi fi # Remover dos arquivos do diretório conf.d if [ -d "$UNBOUND_CONF_DIR" ]; then for conf in "$UNBOUND_CONF_DIR"/*.conf; do if [ -f "$conf" ]; then - sed -i "/$include_pattern/d" "$conf" 2>/dev/null || true - sed -i "/$comment_pattern/d" "$conf" 2>/dev/null || true - sed -i '/^$/N;/^\n$/d' "$conf" 2>/dev/null || true + # Criar arquivo temporário sem as linhas do DNSBlock + grep -v '/opt/dnsblock' "$conf" | grep -v '^# DNSBlock' > "${conf}.tmp" 2>/dev/null + if [ -s "${conf}.tmp" ]; then + mv "${conf}.tmp" "$conf" + else + rm -f "${conf}.tmp" + fi fi done fi