-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrecord_demos.sh
More file actions
executable file
·60 lines (52 loc) · 1.19 KB
/
record_demos.sh
File metadata and controls
executable file
·60 lines (52 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/env bash
set -euo pipefail
DSSH_DIR="$HOME/.dssh"
DB="dssh.db"
DEMO_DB="demoDB_dssh.db"
BACKUP="/tmp/dssh.db"
OUTPUT_DIR="../dssh"
TAPES=(
demo_1.tape
demo_wizard.tape
demo_config.tape
demo_tabs.tape
demo_welcome.tape
)
cleanup() {
echo "Restoring original database..."
if [[ -f "$BACKUP" ]]; then
mv "$BACKUP" "$DSSH_DIR/$DB"
echo "Original database restored."
else
echo "WARNING: No backup found at $BACKUP"
fi
}
trap cleanup EXIT
if [[ -f "$DSSH_DIR/$DB" ]]; then
mv "$DSSH_DIR/$DB" "$BACKUP"
echo "Backed up $DB to $BACKUP"
else
echo "No existing $DB found, skipping backup."
fi
if [[ -f "$DSSH_DIR/$DEMO_DB" ]]; then
cp "$DSSH_DIR/$DEMO_DB" "$DSSH_DIR/$DB"
echo "Activated demo database."
else
echo "ERROR: $DSSH_DIR/$DEMO_DB not found" >&2
exit 1
fi
for tape in "${TAPES[@]}"; do
echo "Recording $tape..."
vhs "$tape"
done
mkdir -p "$OUTPUT_DIR"
for tape in "${TAPES[@]}"; do
gif="${tape%.tape}.gif"
if [[ -f "$gif" ]]; then
mv "$gif" "$OUTPUT_DIR/"
echo "Moved $gif to $OUTPUT_DIR/"
else
echo "WARNING: $gif not found"
fi
done
echo "Done. All demos created."