[__hostname] Make __key_value names more meaningful
This commit is contained in:
parent
b9571a2bbd
commit
66c85230a0
1 changed files with 13 additions and 15 deletions
|
@ -61,12 +61,7 @@ fi
|
||||||
case $os
|
case $os
|
||||||
in
|
in
|
||||||
alpine|debian|devuan|ubuntu|void)
|
alpine|debian|devuan|ubuntu|void)
|
||||||
echo "$name_should" \
|
echo "$name_should" | __file /etc/hostname --source -
|
||||||
| __file /etc/hostname --source -
|
|
||||||
;;
|
|
||||||
macosx)
|
|
||||||
# handled in gencode-remote
|
|
||||||
:
|
|
||||||
;;
|
;;
|
||||||
archlinux)
|
archlinux)
|
||||||
if test -n "$has_hostnamectl"
|
if test -n "$has_hostnamectl"
|
||||||
|
@ -75,7 +70,8 @@ in
|
||||||
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.
|
||||||
__key_value sysconfig-hostname \
|
# There are some versions which use /etc/hostname but not systemd. It is unclear which ones these are.
|
||||||
|
__key_value '/etc/rc.conf:HOSTNAME' \
|
||||||
--file /etc/rc.conf \
|
--file /etc/rc.conf \
|
||||||
--delimiter '=' --exact_delimiter \
|
--delimiter '=' --exact_delimiter \
|
||||||
--key 'HOSTNAME' \
|
--key 'HOSTNAME' \
|
||||||
|
@ -87,7 +83,7 @@ in
|
||||||
then
|
then
|
||||||
# Only write to /etc/sysconfig/network on non-systemd versions.
|
# Only write to /etc/sysconfig/network on non-systemd versions.
|
||||||
# On systemd-based versions this entry is ignored.
|
# On systemd-based versions this entry is ignored.
|
||||||
__key_value sysconfig-hostname \
|
__key_value '/etc/sysconfig/network:HOSTNAME' \
|
||||||
--file /etc/sysconfig/network \
|
--file /etc/sysconfig/network \
|
||||||
--delimiter '=' --exact_delimiter \
|
--delimiter '=' --exact_delimiter \
|
||||||
--key HOSTNAME \
|
--key HOSTNAME \
|
||||||
|
@ -101,7 +97,7 @@ in
|
||||||
then
|
then
|
||||||
# Only write to /etc/conf.d/hostname on OpenRC-based installations.
|
# Only write to /etc/conf.d/hostname on OpenRC-based installations.
|
||||||
# On systemd use hostnamectl(1) in gencode-remote.
|
# On systemd use hostnamectl(1) in gencode-remote.
|
||||||
__key_value confd-hostname \
|
__key_value '/etc/conf.d/hostname:hostname' \
|
||||||
--file /etc/conf.d/hostname \
|
--file /etc/conf.d/hostname \
|
||||||
--delimiter '=' --exact_delimiter \
|
--delimiter '=' --exact_delimiter \
|
||||||
--key 'hostname' \
|
--key 'hostname' \
|
||||||
|
@ -111,14 +107,18 @@ in
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
freebsd)
|
freebsd)
|
||||||
__key_value rcconf-hostname \
|
__key_value '/etc/rc.conf:hostname' \
|
||||||
--file /etc/rc.conf \
|
--file /etc/rc.conf \
|
||||||
--delimiter '=' --exact_delimiter \
|
--delimiter '=' --exact_delimiter \
|
||||||
--key 'hostname' \
|
--key 'hostname' \
|
||||||
--value "\"$name_should\""
|
--value "\"$name_should\""
|
||||||
;;
|
;;
|
||||||
|
macosx)
|
||||||
|
# handled in gencode-remote
|
||||||
|
:
|
||||||
|
;;
|
||||||
netbsd)
|
netbsd)
|
||||||
__key_value rcconf-hostname \
|
__key_value '/etc/rc.conf:hostname' \
|
||||||
--file /etc/rc.conf \
|
--file /etc/rc.conf \
|
||||||
--delimiter '=' --exact_delimiter \
|
--delimiter '=' --exact_delimiter \
|
||||||
--key 'hostname' \
|
--key 'hostname' \
|
||||||
|
@ -128,14 +128,12 @@ in
|
||||||
__file /etc/myname --state absent
|
__file /etc/myname --state absent
|
||||||
;;
|
;;
|
||||||
openbsd)
|
openbsd)
|
||||||
echo "$name_should" \
|
echo "$name_should" | __file /etc/myname --source -
|
||||||
| __file /etc/myname --source -
|
|
||||||
;;
|
;;
|
||||||
suse)
|
suse)
|
||||||
# We write into /etc/HOSTNAME for backwards-compatibility. Modern SuSE
|
# We write into /etc/HOSTNAME for backwards-compatibility. Modern SuSE
|
||||||
# has hostnamectl anyway and symlinks /etc/HOSTNAME to /etc/hostname.
|
# has hostnamectl anyway and symlinks /etc/HOSTNAME to /etc/hostname.
|
||||||
echo "$name_should" \
|
echo "$name_should" | __file /etc/HOSTNAME --source -
|
||||||
| __file /etc/HOSTNAME --source -
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
# On other operating systems we fall back to systemd's hostnamectl if available…
|
# On other operating systems we fall back to systemd's hostnamectl if available…
|
||||||
|
|
Loading…
Reference in a new issue