[__hostname] Add support for NetBSD
This commit is contained in:
parent
1bab641c94
commit
d43eb5b22f
2 changed files with 19 additions and 0 deletions
|
@ -43,6 +43,16 @@ in
|
||||||
freebsd)
|
freebsd)
|
||||||
(. /etc/rc.conf && echo "$hostname")
|
(. /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)
|
openbsd)
|
||||||
cat /etc/myname
|
cat /etc/myname
|
||||||
;;
|
;;
|
||||||
|
|
|
@ -60,6 +60,15 @@ case "$os" in
|
||||||
--key 'hostname' \
|
--key 'hostname' \
|
||||||
--value "$name_should"
|
--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)
|
openbsd)
|
||||||
echo "$name_should" | __file /etc/myname --source -
|
echo "$name_should" | __file /etc/myname --source -
|
||||||
;;
|
;;
|
||||||
|
|
Loading…
Reference in a new issue