2021-04-21 09:45:19 -04:00
|
|
|
#! /bin/bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
set -o pipefail
|
|
|
|
|
|
|
|
function cleanup()
|
|
|
|
{
|
2021-04-22 09:33:45 -04:00
|
|
|
kill 0
|
2021-04-21 09:45:19 -04:00
|
|
|
exit 0
|
|
|
|
}
|
|
|
|
|
2021-04-22 09:33:45 -04:00
|
|
|
trap cleanup EXIT
|
2021-04-21 09:45:19 -04:00
|
|
|
|
|
|
|
positional=()
|
2021-05-03 07:40:09 -04:00
|
|
|
while [ $# -gt 0 ]; do
|
2021-04-21 09:45:19 -04:00
|
|
|
argument="$1"
|
|
|
|
case $argument in
|
|
|
|
-h|--help)
|
|
|
|
printf "%s\n" \
|
2021-04-22 09:33:45 -04:00
|
|
|
"Usage: trezor-verify-integrity.sh [options]" \
|
2021-04-21 09:45:19 -04:00
|
|
|
"" \
|
|
|
|
"Options:" \
|
|
|
|
" --qr-restore-options see \`qr-restore.sh --help\`" \
|
|
|
|
" -h, --help display help for command"
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
--qr-restore-options)
|
|
|
|
qr_restore_options=$2
|
|
|
|
shift
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
positional+=("$1")
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
set -- "${positional[@]}"
|
|
|
|
|
|
|
|
bold=$(tput bold)
|
|
|
|
normal=$(tput sgr0)
|
|
|
|
|
|
|
|
basedir=$(dirname "$0")
|
|
|
|
|
|
|
|
tput reset
|
|
|
|
|
|
|
|
printf "%s\n" "Spawning tmux panes…"
|
|
|
|
|
|
|
|
sleep 1
|
|
|
|
|
2021-04-22 09:33:45 -04:00
|
|
|
python3 $basedir/tmux-buttons.py &
|
2021-04-21 09:45:19 -04:00
|
|
|
|
2021-04-22 09:33:45 -04:00
|
|
|
tmux new -d -s trezor-verify-integrity
|
|
|
|
tmux rename-window -t trezor-verify-integrity trezorctl
|
|
|
|
tmux send-keys -t trezor-verify-integrity "trezorctl recovery-device --words 24 --type scrambled --dry-run" Enter
|
|
|
|
tmux split-window -t trezor-verify-integrity
|
|
|
|
tmux rename-window -t trezor-verify-integrity qr-restore
|
|
|
|
tmux send-keys -t trezor-verify-integrity "qr-restore.sh $(echo $qr_restore_options | sed 's/--word-list *//') --word-list" Enter
|
|
|
|
tmux attach -t trezor-verify-integrity
|