From 95f3dc03515bc64cd245324b90da15811618e40f Mon Sep 17 00:00:00 2001 From: Dominic Date: Fri, 21 Apr 2023 15:19:36 +0200 Subject: [PATCH] Run `apk` inside docker Co-authored-by: Glaeder --- src/steps/init_os.rs | 6 ++++++ src/steps/prepare_img.rs | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/steps/init_os.rs b/src/steps/init_os.rs index 788e6a8..8c42c66 100644 --- a/src/steps/init_os.rs +++ b/src/steps/init_os.rs @@ -79,6 +79,12 @@ initramfs initramfs-rpi4 // bootstrap alpine run(&[ + "docker", + "run", + "--rm", + "-v", + &format!("{root}:{root}", root = &*img.root), + "alpine", "apk", "add", "--root", diff --git a/src/steps/prepare_img.rs b/src/steps/prepare_img.rs index 87342ab..07f5277 100644 --- a/src/steps/prepare_img.rs +++ b/src/steps/prepare_img.rs @@ -22,7 +22,7 @@ pub fn prepare_img() -> anyhow::Result { run_parted!(path, "mkpart", "primary", "ext4", "128M", &size)?; // create a loopback device - let output = run_output(&["losetup", "-f", "--show", path.to_str().unwrap()])?; + let output = run_output(&["losetup", "-P", "-f", "--show", path.to_str().unwrap()])?; print!("{output}"); let idx = output.find("/dev/loop").ok_or_else(|| anyhow!("Unable to identify loop device"))?; let mut end = idx + "/dev/loop".len();