diff options
author | Tony Asleson <tasleson@redhat.com> | 2024-04-29 20:36:52 -0500 |
---|---|---|
committer | Tony Asleson <tasleson@redhat.com> | 2024-05-07 12:20:49 -0500 |
commit | 761ef99f91774591495e2cded7b5d44c059bcd5d (patch) | |
tree | 318f87b6c085980b5c262985cbc25d0a1d6686e4 | |
parent | 1fb1898b244a319de613317eb4fbfa0933a28b56 (diff) |
Add env. variable BCACHEFS_BLOCK_SCAN
Introduce an env. variable for users that have a broken blkid which
renders the udev db as incomplete. Only checks for the existence
of the variable, not its value.
Signed-off-by: Tony Asleson <tasleson@redhat.com>
-rw-r--r-- | src/commands/mount.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/commands/mount.rs b/src/commands/mount.rs index 9ce689ac..03215fcd 100644 --- a/src/commands/mount.rs +++ b/src/commands/mount.rs @@ -5,8 +5,7 @@ use clap::Parser; use uuid::Uuid; use std::io::{stdout, IsTerminal}; use std::path::PathBuf; -use std::fs; -use std::str; +use std::{fs, str, env}; use crate::key; use crate::key::UnlockPolicy; use std::ffi::{CString, c_char, c_void}; @@ -124,6 +123,12 @@ fn device_property_map(dev: &udev::Device) -> HashMap<String, String> { fn udev_bcachefs_info() -> anyhow::Result<HashMap<String, Vec<String>>> { let mut info = HashMap::new(); + + if env::var("BCACHEFS_BLOCK_SCAN").is_ok() { + debug!("Checking all block devices for bcachefs super block!"); + return Ok(info); + } + let mut udev = udev::Enumerator::new()?; debug!("Walking udev db!"); |