From 10570fa37e2a8903f42d2817644446b38680aee5 Mon Sep 17 00:00:00 2001 From: Nikos Mavrogiannopoulos Date: Wed, 4 Oct 2017 11:46:57 +0200 Subject: [PATCH] check of resolved is enabled prior to using it --- vpnc-script | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/vpnc-script b/vpnc-script index 6302987..ae13947 100644 --- a/vpnc-script +++ b/vpnc-script @@ -116,12 +116,19 @@ else ifconfig_syntax_ptpv6="" fi +grep ^hosts /etc/nsswitch.conf|grep resolve >/dev/null 2>&1 +if [ $? = 0 ];then + RESOLVEDENABLED=1 +else + RESOLVEDENABLED=0 +fi + if [ -r /etc/openwrt_release ] && [ -n "$OPENWRT_INTERFACE" ]; then . /etc/functions.sh include /lib/network MODIFYRESOLVCONF=modify_resolvconf_openwrt RESTORERESOLVCONF=restore_resolvconf_openwrt -elif [ -x /usr/bin/busctl ]; then # For systemd-resolved (version 229 and above) +elif [ -x /usr/bin/busctl ] && [ ${RESOLVEDENABLED} = 1 ]; then # For systemd-resolved (version 229 and above) MODIFYRESOLVCONF=modify_resolved_manager RESTORERESOLVCONF=restore_resolved_manager elif [ -x /sbin/resolvconf ]; then # Optional tool on Debian, Ubuntu, Gentoo and FreeBSD