From c939bd6bf676b186ced82bebf925ce83b7c79df4 Mon Sep 17 00:00:00 2001 From: Dennis Camera Date: Sun, 27 Oct 2019 20:12:10 +0100 Subject: [PATCH] [__hostname] Small fixes --- cdist/conf/type/__hostname/gencode-remote | 5 +---- cdist/conf/type/__hostname/manifest | 6 +++--- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/cdist/conf/type/__hostname/gencode-remote b/cdist/conf/type/__hostname/gencode-remote index 1e798036..4532bacf 100755 --- a/cdist/conf/type/__hostname/gencode-remote +++ b/cdist/conf/type/__hostname/gencode-remote @@ -66,15 +66,12 @@ in "&& hostnamectl set-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'" ;; macosx) echo "scutil --set HostName '$name_should'" ;; - openbsd) - echo 'hostname -F /etc/myname' - ;; suse) echo 'hostname -F /etc/HOSTNAME' ;; diff --git a/cdist/conf/type/__hostname/manifest b/cdist/conf/type/__hostname/manifest index 8b4d26b1..31d43264 100755 --- a/cdist/conf/type/__hostname/manifest +++ b/cdist/conf/type/__hostname/manifest @@ -52,7 +52,7 @@ else esac 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 printf "Host name too long. Up to %u characters allowed.\n" "${max_len}" >&2 exit 1 @@ -69,8 +69,8 @@ in set_hostname_systemd "$name_should" else # Only for ancient ArchLinux, write to /etc/rc.conf on pre-systemd - # versions. - # There are some versions which use /etc/hostname but not systemd. It is unclear which ones these are. + # versions. 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 \ --delimiter '=' --exact_delimiter \