Record FreeBSD base provenance in system artifacts

This commit is contained in:
2026-04-02 21:41:04 +02:00
parent 4b786c356f
commit a04e650326
11 changed files with 759 additions and 5 deletions

View File

@@ -49,6 +49,7 @@ trap cleanup_workdir EXIT INT TERM
action_env() {
sudo env \
HOME="$HOME" \
GUILE_AUTO_COMPILE=0 \
GUIX_SOURCE_DIR="${GUIX_SOURCE_DIR:-$HOME/repos/guix}" \
GUILE_BIN="${GUILE_BIN:-/tmp/guile-freebsd-validate-install/bin/guile}" \
GUILE_EXTRA_PREFIX="${GUILE_EXTRA_PREFIX:-/tmp/guile-gnutls-freebsd-validate-install}" \
@@ -71,6 +72,17 @@ disk_image=$(sed -n 's/^disk_image=//p' "$build_metadata")
closure_path=$(sed -n 's/^closure_path=//p' "$build_metadata")
disk_capacity_reported=$(sed -n 's/^disk_capacity=//p' "$build_metadata")
store_item_count=$(sed -n 's/^store_item_count=//p' "$build_metadata")
host_base_store_count=$(sed -n 's/^host_base_store_count=//p' "$build_metadata")
host_base_stores=$(sed -n 's/^host_base_stores=//p' "$build_metadata")
fruix_runtime_store_count=$(sed -n 's/^fruix_runtime_store_count=//p' "$build_metadata")
fruix_runtime_stores=$(sed -n 's/^fruix_runtime_stores=//p' "$build_metadata")
host_base_provenance_file=$(sed -n 's/^host_base_provenance_file=//p' "$build_metadata")
store_layout_file=$(sed -n 's/^store_layout_file=//p' "$build_metadata")
host_freebsd_version=$(sed -n 's/^host_freebsd_version=//p' "$build_metadata")
host_uname=$(sed -n 's/^host_uname=//p' "$build_metadata")
usr_src_git_revision=$(sed -n 's/^usr_src_git_revision=//p' "$build_metadata")
usr_src_git_branch=$(sed -n 's/^usr_src_git_branch=//p' "$build_metadata")
usr_src_newvers_sha256=$(sed -n 's/^usr_src_newvers_sha256=//p' "$build_metadata")
raw_sha256=$(sha256 -q "$disk_image")
image_size_bytes=$(stat -f '%z' "$disk_image")
closure_base=$(basename "$closure_path")
@@ -111,6 +123,10 @@ loader_conf_image=$mnt_root/frx/store/$closure_base/boot/loader.conf
rc_conf_image=$mnt_root/frx/store/$closure_base/etc/rc.conf
grep -F 'comconsole' "$loader_conf_image" >/dev/null || { echo "loader.conf is missing serial console config" >&2; exit 1; }
grep -F 'hostname="fruix-freebsd"' "$rc_conf_image" >/dev/null || { echo "rc.conf is missing hostname" >&2; exit 1; }
[ -f "$host_base_provenance_file" ] || { echo "missing host base provenance file: $host_base_provenance_file" >&2; exit 1; }
[ -f "$store_layout_file" ] || { echo "missing store layout file: $store_layout_file" >&2; exit 1; }
[ -n "$host_freebsd_version" ] || { echo "missing host freebsd version provenance" >&2; exit 1; }
[ -n "$host_uname" ] || { echo "missing host uname provenance" >&2; exit 1; }
cat >"$metadata_file" <<EOF
workdir=$workdir
@@ -124,6 +140,17 @@ raw_sha256=$raw_sha256
image_size_bytes=$image_size_bytes
disk_capacity=$disk_capacity_reported
store_item_count=$store_item_count
host_base_store_count=$host_base_store_count
host_base_stores=$host_base_stores
fruix_runtime_store_count=$fruix_runtime_store_count
fruix_runtime_stores=$fruix_runtime_stores
host_base_provenance_file=$host_base_provenance_file
store_layout_file=$store_layout_file
host_freebsd_version=$host_freebsd_version
host_uname=$host_uname
usr_src_git_revision=$usr_src_git_revision
usr_src_git_branch=$usr_src_git_branch
usr_src_newvers_sha256=$usr_src_newvers_sha256
gpart_log=$gpart_log
esp_fstype=$esp_fstype
root_fstype=$root_fstype