Client: handle missing resolvconf when DNS is set
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user