X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=etc%2Fzsh%2Fzshenv;h=8e4ae78234718aeae80ea60cb71216994a20c93d;hb=41249966740c33a591b9dcc14edc37ddaa595bb6;hp=9a97788c4804687783b6eab41bead2871f34db65;hpb=7df9a4a974f8fdbc65571836d996fd1a077a9081;p=grml-etc-core.git diff --git a/etc/zsh/zshenv b/etc/zsh/zshenv index 9a97788..8e4ae78 100644 --- a/etc/zsh/zshenv +++ b/etc/zsh/zshenv @@ -26,7 +26,15 @@ [[ -r /etc/environment ]] && source /etc/environment # set environment variables (important for autologin on tty) -export HOSTNAME=${HOSTNAME:-$(hostname)} +if [ -n "${HOSTNAME}" ] ; then + export HOSTNAME="${HOSTNAME}" +elif [[ -x $(which hostname) ]] ; then + export HOSTNAME="$(hostname)" +elif [[ -x $(which hostnamectl) ]] ; then + export HOSTNAME="$(hostnamectl --static)" +else + export HOSTNAME="$(uname -n)" +fi # make sure /usr/bin/id is available if [[ -x /usr/bin/id ]] ; then