Trying to figure out blkid thing. Add --probe flag.

This commit is contained in:
2026-07-29 23:16:32 +02:00
parent c132ca3ffa
commit 316ffce414
4 changed files with 23 additions and 4 deletions
+14
View File
@@ -115,6 +115,7 @@ pub fn exec_command(cmd: &str, args: &Vec<&str>) -> Result<(), ExecCommandError>
pub fn find_partlabel(partlabel: &str) -> Result<String, ExecCommandError> {
let out = Command::new("/usr/bin/blkid")
.args([
"--probe",
"-s",
"PARTLABEL",
"--match-token",
@@ -138,6 +139,19 @@ pub fn find_partlabel(partlabel: &str) -> Result<String, ExecCommandError> {
}
}
pub fn list_partlabel() -> Result<String, ExecCommandError> {
let out = Command::new("/usr/bin/blkid")
.args(["--probe", "-s", "PARTLABEL"])
.output()?;
if out.status.success() {
let out_text = String::from_utf8(out.stdout)?;
Ok(out_text)
} else {
Err(ExecCommandError::Other("Oh no".to_string()))
}
}
/// exec given command with arguments, returning stdout parsed to UTF-8 string
/// capturing stderr in case or failure
// pub fn exec_command_out(cmd: &str, args: &Vec<&str>) -> Result<String, ExecCommandError> {