It appears that the "resolvectl status" command has been available since:
Ref: https://github.com/systemd/systemd/commit/
c2e84cab3afb09e726be40ce80b6ce6129c8af32
Ref: https://github.com/systemd/systemd/commit/
a7a4c60a253a181385764bcb542906a312b68fe9
which was first released in systemd v239 from June 2018.
systemd-resolve is usually symlinked to resolvectl, but it appears to
be deprecated. This change will still fallback to trying
systemd-resolve if resolvectl fails.
Signed-off-by: Jordan Justen <jljusten@gmail.com>
ifconfig_syntax_ptpv6=""
fi
-grep '^hosts' /etc/nsswitch.conf 2>/dev/null|grep resolve >/dev/null 2>&1 && command systemd-resolve --status >/dev/null 2>&1
+RESOLVEDENABLED=0
+grep '^hosts' /etc/nsswitch.conf 2>/dev/null|grep resolve >/dev/null 2>&1
if [ $? = 0 ];then
- RESOLVEDENABLED=1
-else
- RESOLVEDENABLED=0
+ command resolvectl status >/dev/null 2>&1 || command systemd-resolve --status >/dev/null 2>&1
+ if [ $? = 0 ];then
+ RESOLVEDENABLED=1
+ fi
fi
if [ -r /etc/openwrt_release ] && [ -n "$OPENWRT_INTERFACE" ]; then