diff --git a/.gitignore b/.gitignore
index 6963297..e610a0e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
target
result*
+/recordings/
diff --git a/README.md b/README.md
index 6e8433a..0ffa706 100644
--- a/README.md
+++ b/README.md
@@ -9,7 +9,7 @@ I started bootvine out of frustration with the boot screen of most Linux
distributions: a wall of log lines scrolling past too fast to read, which never
gave me any idea of what was going on.
-
+
It also follows shutdowns, answers passphrase prompts such as a
[LUKS](https://gitlab.com/cryptsetup/cryptsetup) unlock in place, and shows why
diff --git a/docs/development.md b/docs/development.md
index 50a45f1..d089092 100644
--- a/docs/development.md
+++ b/docs/development.md
@@ -9,7 +9,7 @@
| `xtask/` | repository tasks run with `cargo xtask` |
| `vm-tests/` | the sample NixOS machines, one folder each with its VM check |
| `nix/` | the crane builds and the NixOS module |
-| `recordings/` | the scripted demo GIFs and the sample machine WebP recordings the README and the [guide](guide.md) show |
+| `recordings/` | ignored output of `record-screencasts`: the scripted demo GIFs and the sample machine WebP recordings, published on the `recordings` branch for the README and the [guide](guide.md) |
`cargo build` and `cargo test` act on every crate. `cargo run` needs the binary:
`--bin bootvine`, `--bin scripted-boot` and so on.
@@ -109,6 +109,10 @@ exports libraries that clash with [QEMU](https://www.qemu.org) or Chromium.
- `nix run .#record-screencasts` re-records the animations from the scripted
demos and turns the frames each VM check captured into
`recordings/.webp`, for the README and the [guide](guide.md).
+- `nix run .#publish-recordings` force-pushes `recordings/` as the single,
+ parentless commit of the `recordings` branch, which the README and the guide
+ link to. Keeping the recordings off `main` keeps them out of every clone and
+ flake fetch.
- `cargo xtask sync-default-config` rewrites the defaults block in
[configuration](configuration.md#defaults) from `bootvine defaults`.
- `cargo run --bin bootvine -- install --destdir --initrd dracut` stages an install
diff --git a/docs/guide.md b/docs/guide.md
index e91351b..816fa0f 100644
--- a/docs/guide.md
+++ b/docs/guide.md
@@ -7,7 +7,7 @@ by their [VM checks](development.md#testing).
## Reading the screen
-
+
From top to bottom:
@@ -47,7 +47,7 @@ From top to bottom:
## Booting through the initrd
-
+
The `slow-services` machine boots with a held hardware probe in the initrd,
slow units in stage 2 and one failing unit, hands over to its greetd login
@@ -69,7 +69,7 @@ How bootvine gets in that early and survives the switch is in
### Without a display manager
-
+
The `text-console` machine boots the same units without greetd. With no
display manager to wait for, bootvine hands the console back as soon as the
@@ -77,7 +77,7 @@ default target is reached, and the text login on `tty1` comes forward.
### Without a systemd initrd
-
+
The `scripted-initrd` machine uses NixOS's older scripted initrd, which has no
systemd. The initrd's lines scroll past as usual, and bootvine starts in
@@ -85,7 +85,7 @@ stage 2, from `sysinit.target` on.
## Shutdown
-
+
On a poweroff, reboot or halt the tree turns around:
@@ -97,7 +97,7 @@ On a poweroff, reboot or halt the tree turns around:
## Passphrase prompts
-
+
The `encrypted-volume` machine asks for a LUKS passphrase in the initrd; its
recording shows a wrong answer, then the right one.
@@ -118,7 +118,7 @@ bootvine started, bootvine waits behind it.
## Failures
-
+
A unit that broke or timed out gets an entry in the failure panel, newest
first:
diff --git a/flake.nix b/flake.nix
index acb41e3..34029c9 100644
--- a/flake.nix
+++ b/flake.nix
@@ -124,7 +124,7 @@
record-screencasts =
shellScriptApp "record-screencasts"
- "Re-record the scripted demo animations and the sample machine recordings into recordings/"
+ "Re-record the scripted demo animations and the sample machine recordings into recordings/; publish them with publish-recordings"
{
runtimeInputs = [
pkgs.vhs
@@ -139,6 +139,17 @@
}";
};
+ publish-recordings =
+ shellScriptApp "publish-recordings"
+ "Replace the recordings branch on origin with a single commit holding recordings/"
+ {
+ runtimeInputs = [
+ pkgs.gitMinimal
+ builds.repo-tasks
+ ];
+ text = "exec xtask publish-recordings";
+ };
+
build-and-push-to-cachix =
shellScriptApp "build-and-push-to-cachix"
"Build flake outputs and push everything built to the wvhulle Cachix cache"
diff --git a/xtask/src/main.rs b/xtask/src/main.rs
index f627c3d..e82fc3b 100644
--- a/xtask/src/main.rs
+++ b/xtask/src/main.rs
@@ -1,3 +1,4 @@
+mod publish_recordings;
mod record_screencasts;
mod sync_default_config;
mod task_error;
@@ -20,6 +21,10 @@ enum Task {
screenshots to WebP in recordings/"
)]
RecordScreencasts(RecordScreencastsOptions),
+ #[command(
+ about = "Replace the recordings branch on origin with a single commit holding recordings/"
+ )]
+ PublishRecordings,
#[command(
about = "Rewrite the defaults block in docs/configuration.md from `bootvine defaults`"
)]
@@ -41,6 +46,7 @@ fn main() -> ExitCode {
Task::RecordScreencasts(options) => {
record_screencasts::record_screencasts(&options.vm_check_outputs)
}
+ Task::PublishRecordings => publish_recordings::publish_recordings(),
Task::SyncDefaultConfig => sync_default_config::sync_default_config(),
};
match outcome {
diff --git a/xtask/src/publish_recordings.rs b/xtask/src/publish_recordings.rs
new file mode 100644
index 0000000..bae24e3
--- /dev/null
+++ b/xtask/src/publish_recordings.rs
@@ -0,0 +1,38 @@
+use std::path::Path;
+
+use xshell::{Shell, cmd};
+
+use crate::{record_screencasts::RECORDINGS_DIRECTORY, task_error::TaskError};
+
+const RECORDINGS_BRANCH: &str = "refs/heads/recordings";
+
+pub fn publish_recordings() -> Result<(), TaskError> {
+ if !Path::new(RECORDINGS_DIRECTORY).is_dir() {
+ return Err(TaskError::RecordingsMissing);
+ }
+ let shell = Shell::new()?;
+ let git_directory = cmd!(shell, "git rev-parse --absolute-git-dir").read()?;
+ let temporary_directory = shell.create_temp_dir()?;
+ let _index_override = shell.push_env(
+ "GIT_INDEX_FILE",
+ temporary_directory.path().join("recordings-index"),
+ );
+ let _git_directory_override = shell.push_env("GIT_DIR", &git_directory);
+ let _recordings_directory = shell.push_dir(RECORDINGS_DIRECTORY);
+ cmd!(shell, "git --work-tree=. add --all --force .")
+ .quiet()
+ .run()?;
+ let recordings_tree = cmd!(shell, "git write-tree").read()?;
+ let recordings_commit = cmd!(
+ shell,
+ "git commit-tree {recordings_tree} -m 'chore: sample recordings [skip ci]'"
+ )
+ .read()?;
+ let branch = RECORDINGS_BRANCH;
+ cmd!(
+ shell,
+ "git push --force origin {recordings_commit}:{branch}"
+ )
+ .run()?;
+ Ok(())
+}
diff --git a/xtask/src/record_screencasts.rs b/xtask/src/record_screencasts.rs
index d649cc7..c84cdd7 100644
--- a/xtask/src/record_screencasts.rs
+++ b/xtask/src/record_screencasts.rs
@@ -13,6 +13,7 @@ const TAPES: [&str; 2] = [
"scripted-demos/tapes/scripted-shutdown.tape",
];
const RECORDING_FRAME_MILLISECONDS: &str = "500";
+pub const RECORDINGS_DIRECTORY: &str = "recordings";
fn sorted_entries(directory: &Path) -> Result, TaskError> {
let read_failure = |source| TaskError::File {
@@ -106,10 +107,14 @@ fn encode_machine_recording(
}
pub fn record_screencasts(vm_check_outputs: &Path) -> Result<(), TaskError> {
- let recordings = Path::new("recordings");
- if !recordings.is_dir() {
+ if !TAPES.iter().all(|tape| Path::new(tape).is_file()) {
return Err(TaskError::NotInRepositoryRoot);
}
+ let recordings = Path::new(RECORDINGS_DIRECTORY);
+ fs::create_dir_all(recordings).map_err(|source| TaskError::File {
+ path: recordings.to_path_buf(),
+ source,
+ })?;
let shell = Shell::new()?;
TAPES.iter().try_for_each(|tape| {
let tape_path = Path::new(tape);
diff --git a/xtask/src/task_error.rs b/xtask/src/task_error.rs
index 840fa83..1113b72 100644
--- a/xtask/src/task_error.rs
+++ b/xtask/src/task_error.rs
@@ -10,8 +10,10 @@ pub enum TaskError {
File { path: PathBuf, source: io::Error },
#[error("{} has no recording frames", .0.display())]
NoRecordingFrames(PathBuf),
- #[error("no recordings directory here; run from the repository root")]
+ #[error("no VHS tapes here; run from the repository root")]
NotInRepositoryRoot,
+ #[error("no recordings/ directory here; run record-screencasts from the repository root first")]
+ RecordingsMissing,
#[error("{0} has no ```toml block under its Defaults heading")]
DefaultsBlockMissing(&'static str),
}