mirror of
https://gitlab.steamos.cloud/holo/steamos-manager.git
synced 2025-07-08 15:40:34 -04:00
manager: Implement format_device
This commit is contained in:
parent
69e6477053
commit
fd14514d6c
1 changed files with 15 additions and 9 deletions
|
@ -252,16 +252,22 @@ impl SteamOSManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn format_sdcard(&self) -> bool {
|
async fn format_device(&self, device: &str, label: &str, validate: bool) -> Result<(), zbus::fdo::Error> {
|
||||||
// Run steamos-format-sdcard script
|
let mut args = vec!["--label", label, "--device", device];
|
||||||
// return true on success, false otherwise
|
if !validate {
|
||||||
run_script(
|
args.push("--skip-validation");
|
||||||
"format sdcard",
|
}
|
||||||
"/usr/bin/steamos-polkit-helpers/steamos-format-sdcard",
|
let res = run_script(
|
||||||
&[""],
|
"format device",
|
||||||
|
"/usr/lib/hwsupport/format-device.sh",
|
||||||
|
args.as_ref()
|
||||||
)
|
)
|
||||||
.await
|
.await;
|
||||||
.unwrap_or(false)
|
|
||||||
|
match res {
|
||||||
|
Ok(_) => Ok(()),
|
||||||
|
Err(e) => Err(zbus::fdo::Error::Failed(e.to_string())),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[zbus(property)]
|
#[zbus(property)]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue