[__hostname] Add support for Gentoo
This commit is contained in:
parent
064e992a7a
commit
c11e757dfa
3 changed files with 15 additions and 5 deletions
|
@ -41,6 +41,9 @@ in
|
|||
freebsd)
|
||||
(. /etc/rc.conf && echo "$hostname")
|
||||
;;
|
||||
gentoo)
|
||||
(. /etc/conf.d/hostname && echo "$hostname")
|
||||
;;
|
||||
macosx)
|
||||
scutil --get HostName 2>/dev/null
|
||||
;;
|
||||
|
|
|
@ -74,14 +74,10 @@ fi
|
|||
# Use the good old way to set the hostname. Also if hostnamectl fails.
|
||||
case $os
|
||||
in
|
||||
archlinux|debian|ubuntu|devuan|coreos|alpine)
|
||||
alpine|archlinux|coreos|debian|devuan|ubuntu)
|
||||
echo "printf '%s\\n' '$name_should' > /etc/hostname"
|
||||
echo "hostname -F /etc/hostname"
|
||||
;;
|
||||
centos|fedora|redhat|scientific|freebsd|openbsd)
|
||||
# NOTE: Writing the hostname to file is done in the manifest.
|
||||
echo "hostname '$name_should'"
|
||||
;;
|
||||
macosx)
|
||||
echo "scutil --set HostName '$name_should'"
|
||||
;;
|
||||
|
@ -91,6 +87,10 @@ in
|
|||
echo "printf '%s\\n' '$name_should' > /etc/HOSTNAME"
|
||||
echo 'hostname -F /etc/HOSTNAME'
|
||||
;;
|
||||
centos|fedora|freebsd|gentoo|netbsd|openbsd|redhat|scientific)
|
||||
# NOTE: Writing the hostname to file is done in the manifest.
|
||||
echo "hostname '$name_should'"
|
||||
;;
|
||||
*)
|
||||
echo "echo 'Unsupported OS: $os' >&2; exit 1"
|
||||
;;
|
||||
|
|
|
@ -58,6 +58,13 @@ in
|
|||
--key HOSTNAME \
|
||||
--value "\"$name_should\""
|
||||
;;
|
||||
gentoo)
|
||||
__key_value confd-hostname \
|
||||
--file /etc/conf.d/hostname \
|
||||
--delimiter '=' --exact_delimiter \
|
||||
--key 'hostname' \
|
||||
--value "\"$name_should\""
|
||||
;;
|
||||
freebsd)
|
||||
__key_value rcconf-hostname \
|
||||
--file /etc/rc.conf \
|
||||
|
|
Loading…
Reference in a new issue