From d4f7f97335913c977ad70e216459a621528d0588 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Tue, 5 Nov 2024 13:53:38 -0500 Subject: [PATCH] install: Track if we already had an ostree repo in rootfs Prep for https://github.com/containers/bootc/pull/137 Signed-off-by: Colin Walters --- lib/src/install.rs | 7 +++++++ lib/src/install/baseline.rs | 1 + 2 files changed, 8 insertions(+) diff --git a/lib/src/install.rs b/lib/src/install.rs index cdf36a9f0..ae5a6d3e5 100644 --- a/lib/src/install.rs +++ b/lib/src/install.rs @@ -877,6 +877,9 @@ fn require_skopeo_with_containers_storage() -> Result<()> { pub(crate) struct RootSetup { luks_device: Option, device_info: crate::blockdev::PartitionTable, + /// True if the rootfs already had /ostree + #[allow(dead_code)] + has_ostree: bool, rootfs: Utf8PathBuf, rootfs_fd: Dir, rootfs_uuid: Option, @@ -1744,6 +1747,9 @@ pub(crate) async fn install_to_filesystem( let skip_finalize = matches!(fsopts.replace, Some(ReplaceMode::Alongside)) || fsopts.skip_finalize; + let has_ostree = rootfs_fd + .try_exists("ostree/repo") + .context("Querying extant ostree repo")?; let mut rootfs = RootSetup { luks_device: None, device_info, @@ -1753,6 +1759,7 @@ pub(crate) async fn install_to_filesystem( boot, kargs, skip_finalize, + has_ostree, }; install_to_filesystem_impl(&state, &mut rootfs).await?; diff --git a/lib/src/install/baseline.rs b/lib/src/install/baseline.rs index f9b8795ca..334296393 100644 --- a/lib/src/install/baseline.rs +++ b/lib/src/install/baseline.rs @@ -428,5 +428,6 @@ pub(crate) fn install_create_rootfs( boot, kargs, skip_finalize: false, + has_ostree: false, // Must not exist yet }) }