Use tmux for sessions.
[profile.git] / opt / bin / ktmux
index d0c063c..eb590da 100755 (executable)
@@ -11,4 +11,11 @@ while getopts ":T:n:s:t:" opt; do
 done
 shift $((OPTIND-1))
 
-exec $tmux ${tmux_opts## } new-session ${session_opts## } -d ';' attach ';' run-shell ktmux_helper
+if [ -z "$KRB5CCNAME" ]; then
+  krb5ccname="$KRB5CCNAME"
+  [ -z "$krb5ccname" ] && krb5ccname=FILE:${TMPDIR:-/tmp}/krb5cc_${UID}_ktmux_$$
+  export KRB5CCNAME="$krb5ccname"
+fi
+klist -s || kinit
+
+exec $tmux ${tmux_opts## } new-session ${session_opts## } -d ';' set-environment KRB5CCNAME "$KRB5CCNAME" ';' attach ';' run-shell ktmux_helper