[[ -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)"
+fi
# make sure /usr/bin/id is available
if [[ -x /usr/bin/id ]] ; then