Renamed script ddrescue-tui, added launcher script
Launcher script runs the python script in tmux (same as hw-diags)
This commit is contained in:
parent
0c3b90eb63
commit
b2fc7ea860
3 changed files with 46 additions and 3 deletions
43
.bin/Scripts/ddrescue-tui
Executable file
43
.bin/Scripts/ddrescue-tui
Executable file
|
|
@ -0,0 +1,43 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
## Wizard Kit: ddrescue TUI Launcher
|
||||
|
||||
SESSION_NAME="ddrescue-tui"
|
||||
WINDOW_NAME="GNU ddrescue TUI"
|
||||
MENU="ddrescue-tui-menu"
|
||||
|
||||
function ask() {
|
||||
while :; do
|
||||
read -p "$1 " -r answer
|
||||
if echo "$answer" | egrep -iq '^(y|yes|sure)$'; then
|
||||
return 0
|
||||
elif echo "$answer" | egrep -iq '^(n|no|nope)$'; then
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
die () {
|
||||
echo "$0:" "$@" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Check for running session
|
||||
if tmux list-session | grep -q "$SESSION_NAME"; then
|
||||
echo "WARNING: tmux session $SESSION_NAME already exists."
|
||||
echo ""
|
||||
if ask "Kill current session?"; then
|
||||
tmux kill-session -t "$SESSION_NAME" || \
|
||||
die "Failed to kill session: $SESSION_NAME"
|
||||
else
|
||||
echo "Aborted."
|
||||
echo ""
|
||||
echo -n "Press Enter to exit... "
|
||||
read -r
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
# Start session
|
||||
tmux new-session -s "$SESSION_NAME" -n "$WINDOW_NAME" "$MENU" $*
|
||||
|
||||
|
|
@ -21,8 +21,8 @@ if __name__ == '__main__':
|
|||
menu_ddrescue(*sys.argv)
|
||||
|
||||
# Done
|
||||
#print_standard('\nDone.')
|
||||
#pause("Press Enter to exit...")
|
||||
print_standard('\nDone.')
|
||||
pause("Press Enter to exit...")
|
||||
exit_script()
|
||||
except SystemExit:
|
||||
pass
|
||||
|
|
@ -24,7 +24,7 @@ die () {
|
|||
|
||||
# Check for running session
|
||||
if tmux list-session | grep -q "$SESSION_NAME"; then
|
||||
echo "WARNING: hw-diags tmux session already exists."
|
||||
echo "WARNING: tmux session $SESSION_NAME already exists."
|
||||
echo ""
|
||||
if ask "Kill current session?"; then
|
||||
tmux kill-session -t "$SESSION_NAME" || \
|
||||
|
|
|
|||
Loading…
Reference in a new issue