Allow hw-diags to reattach to the tmux session

* The option to kill the current session and start a new was left in place
This commit is contained in:
2Shirt 2018-09-12 18:56:39 -06:00
parent deec1746e4
commit d9a9ce0a86
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C
2 changed files with 7 additions and 3 deletions

View file

@ -8,7 +8,7 @@ MENU="hw-diags-menu"
function ask() {
while :; do
read -p "$1 " -r answer
read -p "$1 [Y/N] " -r answer
if echo "$answer" | egrep -iq '^(y|yes|sure)$'; then
return 0
elif echo "$answer" | egrep -iq '^(n|no|nope)$'; then
@ -26,7 +26,10 @@ die () {
if tmux list-session | grep -q "$SESSION_NAME"; then
echo "WARNING: tmux session $SESSION_NAME already exists."
echo ""
if ask "Kill current session?"; then
if ask "Connect to current session?"; then
# Do nothing, the command below will attach/connect
echo ""
elif ask "Kill current session and start new session?"; then
tmux kill-session -t "$SESSION_NAME" || \
die "Failed to kill session: $SESSION_NAME"
else
@ -39,5 +42,5 @@ if tmux list-session | grep -q "$SESSION_NAME"; then
fi
# Start session
tmux new-session -s "$SESSION_NAME" -n "$WINDOW_NAME" "$MENU" $*
tmux new-session -A -s "$SESSION_NAME" -n "$WINDOW_NAME" "$MENU" $*

View file

@ -76,6 +76,7 @@ spice-vdagent
terminus-font
testdisk-wip
thunar
tigervnc
tint2
tk
tmux