Jelajahi Sumber

Begin automating asciinema screencasts

Andrey Bienkowski 3 tahun lalu
induk
melakukan
910852acbf
2 mengubah file dengan 33 tambahan dan 0 penghapusan
  1. 6 0
      docs/misc/asciinema/basic-prepare.sh
  2. 27 0
      docs/misc/asciinema/basic.tcl

+ 6 - 0
docs/misc/asciinema/basic-prepare.sh

@@ -0,0 +1,6 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+sudo rm -r /media/backup/borgdemo || true
+sudo mkdir -p /media/backup/borgdemo
+sudo chown "$(whoami):$(whoami)" /media/backup/borgdemo

+ 27 - 0
docs/misc/asciinema/basic.tcl

@@ -0,0 +1,27 @@
+#!/usr/bin/env expect
+
+if {[file isdirectory /media/backup/borgdemo] == 0} {
+  send_user "Please, run basic-prepare.sh first\n"
+  exit 1
+}
+
+# Configuration for send -h
+# Tries to emulate a human typing
+# Tweak this if typing is too fast or too slow
+set send_human {.05 .1 1 .01 .2}
+
+# The screencast uses relative paths "Wallpaper"
+# We should not mess with the contents of whatever cwd happened to be
+cd [exec mktemp -d]
+mkdir Wallpaper
+
+if {0} {
+  spawn borg init --encryption=repokey /media/backup/borgdemo
+  expect "Enter new passphrase: "
+  send -h "correct horse battery staple\n"
+  expect "Enter same passphrase again: "
+  send -h "correct horse battery staple\n"
+  expect -ex {Do you want your passphrase to be displayed for verification? [yN]: }
+  send \n
+  expect eof
+}