Skip to content

Commit

Permalink
install: Trim bind/btrfs mount information
Browse files Browse the repository at this point in the history
This happens with btrfs subvolumes for the root; we'll need
to handle that separately.

Signed-off-by: Colin Walters <[email protected]>
  • Loading branch information
cgwalters committed Sep 23, 2023
1 parent 6c0b7f3 commit 2599c92
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions lib/src/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -967,6 +967,15 @@ pub(crate) async fn install_to_filesystem(opts: InstallToFilesystemOpts) -> Resu
// for GRUB (BIOS) and in the future zipl (I think).
let backing_device = {
let mut dev = inspect.source;
// Hack: trim bind mount information from source
if dev.contains('[') {
dev = inspect
.sources
.into_iter()
.flatten()
.next()
.ok_or_else(|| anyhow!("Expected `sources` in findmnt output"))?;
}
loop {
tracing::debug!("Finding parents for {dev}");
let mut parents = crate::blockdev::find_parent_devices(&dev)?.into_iter();
Expand Down
2 changes: 1 addition & 1 deletion lib/src/mount.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub(crate) struct Findmnt {
pub(crate) fn inspect_filesystem(path: &Utf8Path) -> Result<Filesystem> {
tracing::debug!("Inspecting {path}");
let o = Command::new("findmnt")
.args(["-J", "--output-all", path.as_str()])
.args(["-J", "-v", "--output-all", path.as_str()])
.output()?;
let st = o.status;
if !st.success() {
Expand Down

0 comments on commit 2599c92

Please sign in to comment.