From: Trygve Aaberge Date: Sun, 12 Aug 2018 09:53:31 +0000 (+0200) Subject: Use systemd-resolve to check if resolved is running X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=60a5929a295b2fa94b97d1168e65181a3aa7b7a9;p=users%2Fdwmw2%2Fvpnc-scripts.git Use systemd-resolve to check if resolved is running resolved may be included in nsswitch.conf even though systemd-resolved is not running. E.g. Arch Linux includes resolved in nsswitch.conf by default, but systemd-resolved is not enabled by default, which causes this script to fail updating dns. This patch uses the systemd-resolve command, which is included with systemd, to check if systemd-resolved is actually running. Signed-off-by: Trygve Aaberge Signed-off-by: Daniel Lenski --- diff --git a/vpnc-script b/vpnc-script index f95a228..150e0b8 100755 --- a/vpnc-script +++ b/vpnc-script @@ -136,8 +136,7 @@ else ifconfig_syntax_ptpv6="" fi -grep ^hosts /etc/nsswitch.conf 2>/dev/null|grep resolve >/dev/null 2>&1 -if [ $? = 0 ];then +if grep -qs '^hosts.*resolve' /etc/nsswitch.conf 2>/dev/null && (command -v systemd-resolve && systemd-resolve --status) >/dev/null 2>&1; then RESOLVEDENABLED=1 else RESOLVEDENABLED=0