replace udisksctl with losetup for docker-friendliness

This commit is contained in:
Dominic 2023-04-21 14:36:08 +02:00
parent 9672d0cb55
commit 45da6cbc04
Signed by: msrd0
GPG key ID: DCC8C247452E98F9
2 changed files with 2 additions and 2 deletions

View file

@ -134,7 +134,7 @@ impl Deref for LoopDevice {
impl Drop for LoopDevice {
fn drop(&mut self) {
let res = run(&["udisksctl", "loop-delete", "--no-user-interaction", "-b", self]);
let res = run(&["losetup", "-d", self]);
if let Err(err) = res {
eprintln!("Failed to free loop device {}: {err}", self.0);
}

View file

@ -22,7 +22,7 @@ pub fn prepare_img() -> anyhow::Result<Image> {
run_parted!(path, "mkpart", "primary", "ext4", "128M", &size)?;
// create a loopback device
let output = run_output(&["udisksctl", "loop-setup", "--no-user-interaction", "-f", path.to_str().unwrap()])?;
let output = run_output(&["losetup", "-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();