mirror of
https://gitlab.steamos.cloud/holo/steamos-manager.git
synced 2025-07-08 07:30:36 -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 {
|
||||
// Run steamos-format-sdcard script
|
||||
// return true on success, false otherwise
|
||||
run_script(
|
||||
"format sdcard",
|
||||
"/usr/bin/steamos-polkit-helpers/steamos-format-sdcard",
|
||||
&[""],
|
||||
async fn format_device(&self, device: &str, label: &str, validate: bool) -> Result<(), zbus::fdo::Error> {
|
||||
let mut args = vec!["--label", label, "--device", device];
|
||||
if !validate {
|
||||
args.push("--skip-validation");
|
||||
}
|
||||
let res = run_script(
|
||||
"format device",
|
||||
"/usr/lib/hwsupport/format-device.sh",
|
||||
args.as_ref()
|
||||
)
|
||||
.await
|
||||
.unwrap_or(false)
|
||||
.await;
|
||||
|
||||
match res {
|
||||
Ok(_) => Ok(()),
|
||||
Err(e) => Err(zbus::fdo::Error::Failed(e.to_string())),
|
||||
}
|
||||
}
|
||||
|
||||
#[zbus(property)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue