Client: detect apt install candidate for resolvconf packages

This commit is contained in:
Ruslan
2026-04-14 11:04:15 +03:00
parent df24ccb96a
commit b54437a480

View File

@@ -170,12 +170,19 @@ detect_client_lan_subnets() {
} }
install_packages() { install_packages() {
pkg_has_install_candidate() {
local pkg="$1"
local candidate
candidate="$(apt-cache policy "$pkg" 2>/dev/null | awk '/Candidate:/ {print $2; exit}')"
[[ -n "$candidate" && "$candidate" != "(none)" ]]
}
apt_install_if_missing wireguard wireguard-tools iproute2 openssh-client sshpass ca-certificates apt_install_if_missing wireguard wireguard-tools iproute2 openssh-client sshpass ca-certificates
if ! command -v resolvconf >/dev/null 2>&1; then if ! command -v resolvconf >/dev/null 2>&1; then
if apt-cache show openresolv >/dev/null 2>&1; then if pkg_has_install_candidate openresolv; then
apt_install_if_missing openresolv apt_install_if_missing openresolv
elif apt-cache show resolvconf >/dev/null 2>&1; then elif pkg_has_install_candidate resolvconf; then
apt_install_if_missing resolvconf apt_install_if_missing resolvconf
else else
log_warn "Пакеты openresolv/resolvconf недоступны. DNS-строка в wg0.conf будет пропущена." log_warn "Пакеты openresolv/resolvconf недоступны. DNS-строка в wg0.conf будет пропущена."