From abc765bd99fae9e479dfed2a3d39e780a1ab3c34 Mon Sep 17 00:00:00 2001 From: Dennis Camera Date: Mon, 30 Sep 2019 12:52:43 +0200 Subject: [PATCH] [__hostname/explorer/hostname] Darwin: Always fall back to hostname if scutil is missing or fails --- cdist/conf/type/__hostname/explorer/hostname | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cdist/conf/type/__hostname/explorer/hostname b/cdist/conf/type/__hostname/explorer/hostname index 0b562d11..8aab1ec0 100644 --- a/cdist/conf/type/__hostname/explorer/hostname +++ b/cdist/conf/type/__hostname/explorer/hostname @@ -41,8 +41,8 @@ elif [ -f /etc/myname ]; then elif [ "$(uname -s)" == FreeBSD ]; then (. /etc/rc.conf && echo $hostname) # Mac OS X -elif [ "$(uname -s)" == Darwin -a -x "$(command -v scutil)" ]; then - scutil --get HostName 2>/dev/null || hostname -s +elif [ "$(uname -s)" == Darwin ]; then + [ -x "$(command -v scutil)" ] && scutil --get HostName 2>/dev/null || hostname -s else command -v hostname && hostname -s fi