[__hostname] Add support for NetBSD

remotes/origin/6.1
Dennis Camera 6 years ago
parent 1bab641c94
commit d43eb5b22f
  1. 10
      cdist/conf/type/__hostname/explorer/persistent_hostname
  2. 9
      cdist/conf/type/__hostname/manifest

@ -43,6 +43,16 @@ in
freebsd)
(. /etc/rc.conf && echo "$hostname")
;;
netbsd)
if grep -q '^hostname=' /etc/rc.conf
then
(. /etc/rc.conf && echo "$hostname")
elif [ -f /etc/myname ]
then
# Fall back to /etc/myname file
cat /etc/myname
fi
;;
openbsd)
cat /etc/myname
;;

@ -60,6 +60,15 @@ case "$os" in
--key 'hostname' \
--value "$name_should"
;;
netbsd)
__key_value rcconf-hostname \
--file /etc/rc.conf \
--delimiter '=' \
--key 'hostname' \
--value "\"$name_should\""
# To avoid confusion, ensure that the hostname is only stored once
__file /etc/myname --state absent
;;
openbsd)
echo "$name_should" | __file /etc/myname --source -
;;

Loading…
Cancel
Save