Client: detect apt install candidate for resolvconf packages
This commit is contained in:
@@ -170,12 +170,19 @@ detect_client_lan_subnets() {
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
elif apt-cache show resolvconf >/dev/null 2>&1; then
|
||||
elif pkg_has_install_candidate resolvconf; then
|
||||
apt_install_if_missing resolvconf
|
||||
else
|
||||
log_warn "Пакеты openresolv/resolvconf недоступны. DNS-строка в wg0.conf будет пропущена."
|
||||
|
||||
Reference in New Issue
Block a user