Run apk inside docker

Co-authored-by: Glaeder <niklas@vousten.dev>
This commit is contained in:
Dominic 2023-04-21 15:19:36 +02:00
parent 45da6cbc04
commit 95f3dc0351
Signed by: msrd0
GPG key ID: DCC8C247452E98F9
2 changed files with 7 additions and 1 deletions

View file

@ -79,6 +79,12 @@ initramfs initramfs-rpi4
// bootstrap alpine // bootstrap alpine
run(&[ run(&[
"docker",
"run",
"--rm",
"-v",
&format!("{root}:{root}", root = &*img.root),
"alpine",
"apk", "apk",
"add", "add",
"--root", "--root",

View file

@ -22,7 +22,7 @@ pub fn prepare_img() -> anyhow::Result<Image> {
run_parted!(path, "mkpart", "primary", "ext4", "128M", &size)?; run_parted!(path, "mkpart", "primary", "ext4", "128M", &size)?;
// create a loopback device // 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}"); print!("{output}");
let idx = output.find("/dev/loop").ok_or_else(|| anyhow!("Unable to identify loop device"))?; let idx = output.find("/dev/loop").ok_or_else(|| anyhow!("Unable to identify loop device"))?;
let mut end = idx + "/dev/loop".len(); let mut end = idx + "/dev/loop".len();