[__hostname] Small fixes
This commit is contained in:
parent
5eb9fec550
commit
c939bd6bf6
2 changed files with 4 additions and 7 deletions
|
@ -66,15 +66,12 @@ in
|
||||||
"&& hostnamectl set-hostname '$name_should'" \
|
"&& hostnamectl set-hostname '$name_should'" \
|
||||||
"|| hostname '$name_should'"
|
"|| hostname '$name_should'"
|
||||||
;;
|
;;
|
||||||
centos|fedora|redhat|scientific|freebsd|netbsd|gentoo|slackware|void)
|
centos|fedora|redhat|scientific|freebsd|netbsd|openbsd|gentoo|slackware|void)
|
||||||
echo "hostname '$name_should'"
|
echo "hostname '$name_should'"
|
||||||
;;
|
;;
|
||||||
macosx)
|
macosx)
|
||||||
echo "scutil --set HostName '$name_should'"
|
echo "scutil --set HostName '$name_should'"
|
||||||
;;
|
;;
|
||||||
openbsd)
|
|
||||||
echo 'hostname -F /etc/myname'
|
|
||||||
;;
|
|
||||||
suse)
|
suse)
|
||||||
echo 'hostname -F /etc/HOSTNAME'
|
echo 'hostname -F /etc/HOSTNAME'
|
||||||
;;
|
;;
|
||||||
|
|
|
@ -52,7 +52,7 @@ else
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test -n "${max_len}" -a "$(printf '%s' "${name_should}" | wc -c)" -gt "${max_len}"
|
if test -n "${max_len}" && test "$(printf '%s' "${name_should}" | wc -c)" -gt "${max_len}"
|
||||||
then
|
then
|
||||||
printf "Host name too long. Up to %u characters allowed.\n" "${max_len}" >&2
|
printf "Host name too long. Up to %u characters allowed.\n" "${max_len}" >&2
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -69,8 +69,8 @@ in
|
||||||
set_hostname_systemd "$name_should"
|
set_hostname_systemd "$name_should"
|
||||||
else
|
else
|
||||||
# Only for ancient ArchLinux, write to /etc/rc.conf on pre-systemd
|
# Only for ancient ArchLinux, write to /etc/rc.conf on pre-systemd
|
||||||
# versions.
|
# versions. There are some versions which use /etc/hostname but not
|
||||||
# There are some versions which use /etc/hostname but not systemd. It is unclear which ones these are.
|
# systemd. It is unclear which ones these are.
|
||||||
__key_value '/etc/rc.conf:HOSTNAME' \
|
__key_value '/etc/rc.conf:HOSTNAME' \
|
||||||
--file /etc/rc.conf \
|
--file /etc/rc.conf \
|
||||||
--delimiter '=' --exact_delimiter \
|
--delimiter '=' --exact_delimiter \
|
||||||
|
|
Loading…
Reference in a new issue