Skip to content

Commit b9b311f

Browse files
authored
Merge pull request #154 from cgwalters/check-skopeo
install: Query skopeo upfront
2 parents c5ecb15 + 8ec4295 commit b9b311f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/src/install.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,8 @@ pub(crate) struct State {
203203
pub(crate) source: SourceInfo,
204204
/// Force SELinux off in target system
205205
pub(crate) override_disable_selinux: bool,
206+
/// True if the skoepo on host supports containers-storage:
207+
pub(crate) skopeo_supports_containers_storage: bool,
206208
#[allow(dead_code)]
207209
pub(crate) setenforce_guard: Option<crate::lsm::SetEnforceGuard>,
208210
pub(crate) config_opts: InstallConfigOpts,
@@ -501,7 +503,7 @@ async fn initialize_ostree_root_from_self(
501503
};
502504

503505
let mut temporary_dir = None;
504-
let src_imageref = if skopeo_supports_containers_storage()? {
506+
let src_imageref = if state.skopeo_supports_containers_storage {
505507
// We always use exactly the digest of the running image to ensure predictability.
506508
let spec =
507509
crate::utils::digested_pullspec(&state.source.imageref.name, &state.source.digest);
@@ -792,6 +794,9 @@ async fn prepare_install(
792794
anyhow::bail!("Cannot install from rootless podman; this command must be run as root");
793795
}
794796

797+
let skopeo_supports_containers_storage = skopeo_supports_containers_storage()
798+
.context("Failed to run skopeo (it currently must be installed in the host root)")?;
799+
795800
let source = SourceInfo::from_container(&container_info)?;
796801

797802
ensure_var()?;
@@ -815,6 +820,7 @@ async fn prepare_install(
815820
// combines our command line options along with some bind mounts from the host.
816821
let state = Arc::new(State {
817822
override_disable_selinux,
823+
skopeo_supports_containers_storage,
818824
setenforce_guard,
819825
source,
820826
config_opts,

0 commit comments

Comments
 (0)