mirror of
https://github.com/philmmanjaro/alma.git
synced 2025-07-26 23:19:29 +02:00
Support chroot images
This commit is contained in:
parent
eddecf8c6b
commit
92f5bdfeab
@ -330,7 +330,14 @@ fn chroot(command: ChrootCommand) -> Result<(), Error> {
|
|||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
|
||||||
let storage_device = storage::StorageDevice::from_path(&command.block_device)?;
|
let mut loop_device: Option<LoopDevice>;
|
||||||
|
let storage_device = match storage::StorageDevice::from_path(&command.block_device) {
|
||||||
|
Ok(b) => b,
|
||||||
|
Err(_) => {
|
||||||
|
loop_device = Some(LoopDevice::create(&command.block_device)?);
|
||||||
|
storage::StorageDevice::from_path(loop_device.as_ref().unwrap().path())?
|
||||||
|
}
|
||||||
|
};
|
||||||
let mount_point = tempdir().context(ErrorKind::TmpDirError)?;
|
let mount_point = tempdir().context(ErrorKind::TmpDirError)?;
|
||||||
|
|
||||||
let boot_partition = storage_device.get_partition(BOOT_PARTITION_INDEX)?;
|
let boot_partition = storage_device.get_partition(BOOT_PARTITION_INDEX)?;
|
||||||
|
@ -26,10 +26,10 @@ impl LoopDevice {
|
|||||||
))?
|
))?
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(LoopDevice {
|
let path = PathBuf::from(String::from_utf8(output.stdout).unwrap().trim());
|
||||||
path: PathBuf::from(String::from_utf8(output.stdout).unwrap().trim()),
|
info!("Mounted {} to {}", file.display(), path.display());
|
||||||
losetup,
|
|
||||||
})
|
Ok(LoopDevice { path, losetup })
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn path(&self) -> &Path {
|
pub fn path(&self) -> &Path {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user