mirror of
https://github.com/borgbackup/borg.git
synced 2026-09-02 06:33:19 +02:00
The screencast is still typed by expect, but it now runs in a container (podman or docker) instead of a vagrant VM, see #8040. record.sh builds borg from the git tag given by BORG_VERSION, generates the demo data and records docs/misc/asciinema/borg2-demo.cast. The demo itself was rewritten for borg 2: repo-create, an archive series addressed by archive IDs, mount, delete/undelete, prune, compact, check. The demo data is generated (notes, logs, a database dump) instead of downloading wallpaper jpegs, so that compression is actually visible. Removes the borg 1.2 screencast scripts and recordings. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
56 lines
2.3 KiB
Bash
Executable file
56 lines
2.3 KiB
Bash
Executable file
#!/bin/sh
|
|
# Record the borg2 demo screencast in a container, see README.rst.
|
|
#
|
|
# Usage: ./record.sh [output directory]
|
|
#
|
|
# Set ENGINE=docker if you do not want to use podman.
|
|
set -eu
|
|
|
|
# The borg release the screencast is recorded with: borg is built from this git
|
|
# tag and the tag is what borg --version shows in the screencast. Update it for
|
|
# every screencast we publish. Use BORG_VERSION=HEAD (or export it in your
|
|
# environment) to record from your work tree while working on the demo.
|
|
BORG_VERSION="${BORG_VERSION:-2.0.0b22}"
|
|
|
|
cd "$(dirname "$0")"
|
|
OUTDIR=$(cd "${1:-.}" && pwd)
|
|
|
|
ENGINE=${ENGINE:-podman}
|
|
command -v "$ENGINE" > /dev/null || { echo "$ENGINE not found, set ENGINE=docker?" >&2; exit 1; }
|
|
|
|
ROOT=$(git rev-parse --show-toplevel)
|
|
git -C "$ROOT" rev-parse --verify --quiet "$BORG_VERSION^{commit}" > /dev/null || {
|
|
echo "no such git tag / commit: $BORG_VERSION - tag the release first?" >&2; exit 1; }
|
|
|
|
# The exported sources have no .git, so we have to tell setuptools-scm the
|
|
# version. For HEAD that is something like 2.0.0b21.dev42+g0123456.
|
|
if [ "$BORG_VERSION" = HEAD ]; then
|
|
VERSION=$(git -C "$ROOT" describe --tags --match '[0-9]*' \
|
|
| sed -e 's/-\([0-9]*\)-g\([0-9a-f]*\)$/.dev\1+g\2/')
|
|
else
|
|
VERSION="$BORG_VERSION"
|
|
fi
|
|
|
|
# Build the image from a clean context: the borg sources of that tag plus the
|
|
# scripts in this directory (and not the whole, possibly dirty, work tree).
|
|
CONTEXT=$(mktemp -d)
|
|
trap 'rm -rf "$CONTEXT"' EXIT
|
|
git -C "$ROOT" archive --format=tar --prefix=borg/ "$BORG_VERSION" > "$CONTEXT/borg-src.tar"
|
|
cp Containerfile demo.tcl demo-data.py record.exp entrypoint.sh "$CONTEXT/"
|
|
|
|
echo "recording with borg $VERSION"
|
|
$ENGINE build -t borg-demo-screencast --build-arg "BORG_VERSION=$VERSION" "$CONTEXT"
|
|
|
|
# --device /dev/fuse and SYS_ADMIN are needed for the "borg mount" part.
|
|
# Without label=disable, the files we back up have a security.selinux xattr,
|
|
# which borg extract then complains about (in the middle of the screencast).
|
|
$ENGINE run --rm -t \
|
|
--hostname host \
|
|
--device /dev/fuse --cap-add SYS_ADMIN \
|
|
--security-opt apparmor=unconfined --security-opt label=disable \
|
|
-v "$OUTDIR:/out" \
|
|
borg-demo-screencast
|
|
|
|
echo
|
|
echo "Play it: asciinema play $OUTDIR/borg2-demo.cast"
|
|
echo "Upload it: asciinema upload $OUTDIR/borg2-demo.cast"
|