From f5cc07fbbb07ea12ee892930b3babf6810a36017 Mon Sep 17 00:00:00 2001 From: Ruslan Date: Tue, 14 Apr 2026 10:54:17 +0300 Subject: [PATCH] Client: handle missing resolvconf when DNS is set --- client/install_client.sh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/client/install_client.sh b/client/install_client.sh index c62e138..f65d08f 100755 --- a/client/install_client.sh +++ b/client/install_client.sh @@ -164,6 +164,16 @@ collect_inputs() { install_packages() { apt_install_if_missing wireguard wireguard-tools iproute2 openssh-client sshpass ca-certificates + + if ! command -v resolvconf >/dev/null 2>&1; then + if apt-cache show openresolv >/dev/null 2>&1; then + apt_install_if_missing openresolv + elif apt-cache show resolvconf >/dev/null 2>&1; then + apt_install_if_missing resolvconf + else + log_warn "Пакеты openresolv/resolvconf недоступны. DNS-строка в wg0.conf будет пропущена." + fi + fi } reset_existing_client_install() { @@ -312,7 +322,11 @@ write_client_config() { echo "[Interface]" echo "PrivateKey = $(cat "$CLIENT_PRIV_KEY_PATH")" echo "Address = ${CLIENT_INTERFACE_ADDRESS}" - echo "DNS = ${dns}" + if command -v resolvconf >/dev/null 2>&1; then + echo "DNS = ${dns}" + else + log_warn "Команда resolvconf не найдена. Пропускаю строку DNS в конфиге WireGuard." + fi if [[ -n "$PRE_UP" ]]; then echo "$PRE_UP" fi