]> www.infradead.org Git - users/dwmw2/vpnc-scripts.git/commitdiff
Use systemd-resolve to check if resolved is running
authorTrygve Aaberge <trygveaa@gmail.com>
Sun, 12 Aug 2018 09:53:31 +0000 (11:53 +0200)
committerDaniel Lenski <dlenski@gmail.com>
Mon, 30 Nov 2020 19:37:24 +0000 (19:37 +0000)
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 <trygveaa@gmail.com>
Signed-off-by: Daniel Lenski <dlenski@gmail.com>
vpnc-script

index f95a228f9ccc73ae661664f412a2a6259684803e..150e0b80e4bcab995455b25055a674b6edd45286 100755 (executable)
@@ -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