[__hostname] Add support for macosx
This commit is contained in:
parent
3c9eb7bce7
commit
2804a8bae6
3 changed files with 5 additions and 2 deletions
|
@ -41,7 +41,7 @@ elif [ -f /etc/myname ]; then
|
|||
elif [ "$(uname -s)" == FreeBSD ]; then
|
||||
(. /etc/rc.conf && echo $hostname)
|
||||
# Mac OS X
|
||||
elif [ "$(uname -s)" == Darwin -a -f "$(command -v scutil)" ]; then
|
||||
elif [ "$(uname -s)" == Darwin -a -x "$(command -v scutil)" ]; then
|
||||
scutil --get HostName 2>/dev/null || hostname -s
|
||||
else
|
||||
command -v hostname && hostname -s
|
||||
|
|
|
@ -86,6 +86,9 @@ case "$os" in
|
|||
echo "hostname '$name_should'"
|
||||
printf "printf '%%s\\\\n' '$name_should' > /etc/HOSTNAME\\n"
|
||||
;;
|
||||
macosx)
|
||||
echo "scutil --set HostName '$name_should'"
|
||||
;;
|
||||
*)
|
||||
echo "echo 'Unsupported OS: $os' >&2; exit 1"
|
||||
;;
|
||||
|
|
|
@ -42,7 +42,7 @@ not_supported() {
|
|||
}
|
||||
|
||||
case "$os" in
|
||||
archlinux|debian|suse|ubuntu|devuan|coreos|alpine)
|
||||
archlinux|debian|suse|ubuntu|devuan|coreos|alpine|macosx)
|
||||
# handled in gencode-remote
|
||||
:
|
||||
;;
|
||||
|
|
Loading…
Reference in a new issue