Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/github/pr/97'
Browse files Browse the repository at this point in the history
  • Loading branch information
mika committed May 27, 2020
2 parents e796c32 + 7642276 commit 594a332
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
8 changes: 7 additions & 1 deletion etc/zsh/zshenv
Expand Up @@ -26,7 +26,13 @@
[[ -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
Expand Down
21 changes: 18 additions & 3 deletions etc/zsh/zshrc
Expand Up @@ -837,8 +837,16 @@ function grmlcomp () {
_ssh_hosts=()
_etc_hosts=()
fi

local localname
if check_com hostname ; then
localname=$(hostname)
elif check_com hostnamectl ; then
localname=$(hostnamectl --static)
fi

hosts=(
$(hostname)
"${localname}"
"$_ssh_config_hosts[@]"
"$_ssh_hosts[@]"
"$_etc_hosts[@]"
Expand Down Expand Up @@ -2509,8 +2517,15 @@ function grml_vcs_to_screen_title () {
}

function grml_maintain_name () {
# set hostname if not running on host with name 'grml'
if [[ -n "$HOSTNAME" ]] && [[ "$HOSTNAME" != $(hostname) ]] ; then
local localname
if check_com hostname ; then
localname=$(hostname)
elif check_com hostnamectl ; then
localname=$(hostnamectl --static)
fi

# set hostname if not running on local machine
if [[ -n "$HOSTNAME" ]] && [[ "$HOSTNAME" != "${localname}" ]] ; then
NAME="@$HOSTNAME"
fi
}
Expand Down

0 comments on commit 594a332

Please sign in to comment.