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:
parent
deec1746e4
commit
d9a9ce0a86
2 changed files with 7 additions and 3 deletions
|
|
@ -8,7 +8,7 @@ MENU="hw-diags-menu"
|
||||||
|
|
||||||
function ask() {
|
function ask() {
|
||||||
while :; do
|
while :; do
|
||||||
read -p "$1 " -r answer
|
read -p "$1 [Y/N] " -r answer
|
||||||
if echo "$answer" | egrep -iq '^(y|yes|sure)$'; then
|
if echo "$answer" | egrep -iq '^(y|yes|sure)$'; then
|
||||||
return 0
|
return 0
|
||||||
elif echo "$answer" | egrep -iq '^(n|no|nope)$'; then
|
elif echo "$answer" | egrep -iq '^(n|no|nope)$'; then
|
||||||
|
|
@ -26,7 +26,10 @@ die () {
|
||||||
if tmux list-session | grep -q "$SESSION_NAME"; then
|
if tmux list-session | grep -q "$SESSION_NAME"; then
|
||||||
echo "WARNING: tmux session $SESSION_NAME already exists."
|
echo "WARNING: tmux session $SESSION_NAME already exists."
|
||||||
echo ""
|
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" || \
|
tmux kill-session -t "$SESSION_NAME" || \
|
||||||
die "Failed to kill session: $SESSION_NAME"
|
die "Failed to kill session: $SESSION_NAME"
|
||||||
else
|
else
|
||||||
|
|
@ -39,5 +42,5 @@ if tmux list-session | grep -q "$SESSION_NAME"; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Start session
|
# Start session
|
||||||
tmux new-session -s "$SESSION_NAME" -n "$WINDOW_NAME" "$MENU" $*
|
tmux new-session -A -s "$SESSION_NAME" -n "$WINDOW_NAME" "$MENU" $*
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,7 @@ spice-vdagent
|
||||||
terminus-font
|
terminus-font
|
||||||
testdisk-wip
|
testdisk-wip
|
||||||
thunar
|
thunar
|
||||||
|
tigervnc
|
||||||
tint2
|
tint2
|
||||||
tk
|
tk
|
||||||
tmux
|
tmux
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue