X-Git-Url: http://git.iain.cx/?a=blobdiff_plain;f=opt%2Fbin%2Fktmux;h=9989842efe98f074bf211343c6ec12655cab7dff;hb=33e89a52bbbf10cc2294c7589711b17d7470dfcc;hp=d0c063c48c4e28a1e7dab47cbf605270f2e9a685;hpb=c23dc0b9470e74a417e8eb796920d7da87eb243d;p=profile.git diff --git a/opt/bin/ktmux b/opt/bin/ktmux index d0c063c..9989842 100755 --- a/opt/bin/ktmux +++ b/opt/bin/ktmux @@ -1,14 +1,36 @@ #!/bin/bash +# +# ktmux: Start tmux and ktmux_helper. +# Usage: ktmux [options] +# Options: -I Pass path to kinit through to ktmux_helper. +# -L Pass path to klist through to ktmux_helper. +# -R Pass path to krenew through to ktmux_helper. +# -S Socket path for tmux. +# -T Path to tmux. +# -n Window name for new tmux session. +# -s Session name for new tmux session. +# -t Target session name for new tmux session. +# tmux=tmux +helper_opts= tmux_opts= session_opts= -while getopts ":T:n:s:t:" opt; do +while getopts ":I:L:R:S:T:n:s:t:" opt; do case $opt in - T) tmux="$OPTARG";; + I|L|R) helper_opts="$helper_opts -$opt $OPTARG";; + T) tmux="$OPTARG"; helper_opts="$helper_opts -$opt $OPTARG";; n|s|t) session_opts="$session_opts -$opt $OPTARG";; + S) tmux_opts="$tmux_opts -$opt $OPTARG";; esac 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 ${helper_opts## }"