[__hostname] Source sysconfig file instead of processing through AWK

This way quotes and expansions will be handled correctly.
This commit is contained in:
Dennis Camera 2019-10-06 18:14:35 +02:00
parent 74568e8a0a
commit 3e7cf68de5

View file

@ -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")