mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 18:31:52 +00:00
do not error if cannot determine live usb device (#1986)
This commit is contained in:
@@ -37,22 +37,35 @@ pub fn disk() -> Result<(), Error> {
|
||||
|
||||
#[command(display(display_none))]
|
||||
pub async fn list() -> Result<Vec<DiskInfo>, Error> {
|
||||
let skip = Path::new(
|
||||
&String::from_utf8(
|
||||
Command::new("grub-probe-default")
|
||||
.arg("-t")
|
||||
.arg("disk")
|
||||
.arg("/cdrom")
|
||||
.invoke(crate::ErrorKind::Grub)
|
||||
.await?,
|
||||
)?
|
||||
.trim(),
|
||||
)
|
||||
.to_owned();
|
||||
let skip = match async {
|
||||
Ok::<_, Error>(
|
||||
Path::new(
|
||||
&String::from_utf8(
|
||||
Command::new("grub-probe-default")
|
||||
.arg("-t")
|
||||
.arg("disk")
|
||||
.arg("/cdrom")
|
||||
.invoke(crate::ErrorKind::Grub)
|
||||
.await?,
|
||||
)?
|
||||
.trim(),
|
||||
)
|
||||
.to_owned(),
|
||||
)
|
||||
}
|
||||
.await
|
||||
{
|
||||
Ok(a) => Some(a),
|
||||
Err(e) => {
|
||||
tracing::error!("Could not determine live usb device: {}", e);
|
||||
tracing::debug!("{:?}", e);
|
||||
None
|
||||
}
|
||||
};
|
||||
Ok(crate::disk::util::list(&Default::default())
|
||||
.await?
|
||||
.into_iter()
|
||||
.filter(|i| &*i.logicalname != skip)
|
||||
.filter(|i| Some(&*i.logicalname) != skip.as_deref())
|
||||
.collect())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user