From 3e7cf68de590c755c74bd3542166a698b86b27d4 Mon Sep 17 00:00:00 2001 From: Dennis Camera Date: Sun, 6 Oct 2019 18:14:35 +0200 Subject: [PATCH] [__hostname] Source sysconfig file instead of processing through AWK This way quotes and expansions will be handled correctly. --- cdist/conf/type/__hostname/explorer/persistent_hostname | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cdist/conf/type/__hostname/explorer/persistent_hostname b/cdist/conf/type/__hostname/explorer/persistent_hostname index ce71d06a..6bc0786f 100755 --- a/cdist/conf/type/__hostname/explorer/persistent_hostname +++ b/cdist/conf/type/__hostname/explorer/persistent_hostname @@ -38,7 +38,8 @@ in [ -f /etc/HOSTNAME ] && cat /etc/HOSTNAME ;; centos|fedora|redhat|scientific) - [ -f /etc/sysconfig/network ] && awk -F= '/^HOSTNAME=/ { print $2 }' /etc/sysconfig/network + [ -f /etc/sysconfig/network ] \ + && (. /etc/sysconfig/network && echo "$HOSTNAME") ;; freebsd) (. /etc/rc.conf && echo "$hostname")