Skip to content

Commit eb53e87

Browse files
committed
install/aleph: add aleph-version.json symlink
This adds a compatibility symlink along the created `.bootc-aleph.json` named `.aleph-version.json`. This compat symlink allow for an easier migration from osbuild's aleph stage [1] to the aleph provided by `bootc install`. This also create a precedent for a "standard" aleph well-known filename that isn't tied to the name of the tool creating it. Note that coreOS and bootupd relies on this aleph file to exist. [1] https://github.com/osbuild/osbuild/blob/main/stages/org.osbuild.ostree.aleph See coreos/fedora-coreos-tracker#2187 Signed-off-by: JB Trystram <jbtrystram@redhat.com>
1 parent a2bc817 commit eb53e87

3 files changed

Lines changed: 16 additions & 2 deletions

File tree

crates/lib/src/install/aleph.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ use super::SELinuxFinalState;
1111

1212
/// Path to initially deployed version information
1313
pub(crate) const BOOTC_ALEPH_PATH: &str = ".bootc-aleph.json";
14+
/// Compatibility symlink so the aleph data is also accessible as `.aleph-version.json`
15+
const BOOTC_ALEPH_SYMLINK: &str = ".aleph-version.json";
1416

1517
/// The "aleph" version information is injected into /root/.bootc-aleph.json
1618
/// and contains the image ID that was initially used to install. This can
@@ -80,11 +82,15 @@ impl InstallAleph {
8082
Ok(r)
8183
}
8284

83-
/// Serialize to a file in the target root.
85+
/// Serialize to a file in the target root, and create a compatibility symlink.
8486
pub(crate) fn write_to(&self, root: &Dir) -> Result<()> {
8587
root.atomic_replace_with(BOOTC_ALEPH_PATH, |f| {
8688
anyhow::Ok(self.to_canon_json_writer(f)?)
8789
})
88-
.context("Writing aleph version")
90+
.context("Writing aleph version")?;
91+
// Create a symlink so the aleph data is also accessible via `.aleph-version.json`
92+
root.symlink(BOOTC_ALEPH_PATH, BOOTC_ALEPH_SYMLINK)
93+
.context("Creating aleph symlink")?;
94+
Ok(())
8995
}
9096
}

docs/src/bootc-install.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,3 +544,5 @@ filesystem (`.bootc-aleph.json`) containing installation provenance information:
544544

545545
This file is useful for auditing and understanding how a system was provisioned.
546546
From the booted system, this file is accessible at `/sysroot/.bootc-aleph.json`.
547+
A compatibility symlink `.aleph-version.json` is also created, pointing to
548+
`.bootc-aleph.json`.

tmt/tests/booted/readonly/013-test-aleph.nu

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,14 @@ if $is_composefs {
2828
} else {
2929

3030
let aleph_path = "/sysroot/.bootc-aleph.json"
31+
let symlink_path = "/sysroot/.aleph-version.json"
3132
let aleph = open $aleph_path
3233

34+
# Verify that the compatibility symlink exists and points to the aleph file
35+
assert (($symlink_path | path exists)) "aleph symlink should exist"
36+
let aleph_via_symlink = open $symlink_path
37+
assert equal $aleph $aleph_via_symlink "symlink content should match aleph file"
38+
3339
# Verify required fields exist and are non-empty
3440
assert ($aleph.kernel | is-not-empty) "kernel field should be non-empty"
3541
assert ($aleph.selinux | is-not-empty) "selinux field should be non-empty"

0 commit comments

Comments
 (0)