forked from msrd0/mkalpiimg
replace udisksctl with losetup for docker-friendliness
This commit is contained in:
parent
9672d0cb55
commit
45da6cbc04
2 changed files with 2 additions and 2 deletions
|
@ -134,7 +134,7 @@ impl Deref for LoopDevice {
|
||||||
|
|
||||||
impl Drop for LoopDevice {
|
impl Drop for LoopDevice {
|
||||||
fn drop(&mut self) {
|
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 {
|
if let Err(err) = res {
|
||||||
eprintln!("Failed to free loop device {}: {err}", self.0);
|
eprintln!("Failed to free loop device {}: {err}", self.0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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(&["udisksctl", "loop-setup", "--no-user-interaction", "-f", path.to_str().unwrap()])?;
|
let output = run_output(&["losetup", "-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();
|
||||||
|
|
Loading…
Reference in a new issue