Merge remote-tracking branch 'origin/github/pr/95'
authorMichael Prokop <mika@grml.org>
Wed, 27 May 2020 09:14:01 +0000 (11:14 +0200)
committerMichael Prokop <mika@grml.org>
Wed, 27 May 2020 09:14:01 +0000 (11:14 +0200)
etc/tmux.conf
etc/zsh/zshenv
etc/zsh/zshrc

index c7e529e..0c55b57 100644 (file)
@@ -16,7 +16,7 @@ unbind space
 bind-key space next-window
 bind-key C-space next-window
 bind-key K confirm-before kill-pane
-bind-key \\ confirm-before kill-session
+bind-key '\' confirm-before kill-session
 #bind-key C-h previous-window
 
 ### join the last active pane to the currently active window
index 9a97788..9b70921 100644 (file)
 [[ -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
index 817a9b5..43cda0c 100644 (file)
@@ -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[@]"
@@ -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
 }