ksud: add error context to log
This commit is contained in:
@@ -93,13 +93,13 @@ pub fn mount_systemlessly(module_dir: &str) -> Result<()> {
|
|||||||
|
|
||||||
// mount /system first
|
// mount /system first
|
||||||
if let Err(e) = mount_partition("system", &mut system_lowerdir) {
|
if let Err(e) = mount_partition("system", &mut system_lowerdir) {
|
||||||
warn!("mount system failed: {e}");
|
warn!("mount system failed: {:#}", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
// mount other partitions
|
// mount other partitions
|
||||||
for (k, mut v) in partition_lowerdir {
|
for (k, mut v) in partition_lowerdir {
|
||||||
if let Err(e) = mount_partition(&k, &mut v) {
|
if let Err(e) = mount_partition(&k, &mut v) {
|
||||||
warn!("mount {k} failed: {e}");
|
warn!("mount {k} failed: {:#}", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
use anyhow::{Ok, Result};
|
use anyhow::{bail, Ok, Result};
|
||||||
|
|
||||||
#[cfg(any(target_os = "linux", target_os = "android"))]
|
#[cfg(any(target_os = "linux", target_os = "android"))]
|
||||||
use anyhow::Context;
|
use anyhow::Context;
|
||||||
@@ -282,16 +282,21 @@ impl StockMount {
|
|||||||
let path = rootdir.join(dest.strip_prefix("/")?);
|
let path = rootdir.join(dest.strip_prefix("/")?);
|
||||||
log::info!("rootdir: {}, path: {}", rootdir.display(), path.display());
|
log::info!("rootdir: {}, path: {}", rootdir.display(), path.display());
|
||||||
if dest.is_dir() {
|
if dest.is_dir() {
|
||||||
utils::ensure_dir_exists(&path)?;
|
utils::ensure_dir_exists(&path)
|
||||||
|
.with_context(|| format!("Failed to create dir: {}", path.display(),))?;
|
||||||
} else if dest.is_file() {
|
} else if dest.is_file() {
|
||||||
utils::ensure_file_exists(&path)?;
|
utils::ensure_file_exists(&path)
|
||||||
|
.with_context(|| format!("Failed to create file: {}", path.display(),))?;
|
||||||
} else {
|
} else {
|
||||||
log::warn!("unknown file type: {:?}", dest);
|
bail!("unknown file type: {:?}", dest)
|
||||||
}
|
}
|
||||||
log::info!("bind stock mount: {} -> {}", dest.display(), path.display());
|
log::info!("bind stock mount: {} -> {}", dest.display(), path.display());
|
||||||
Mount::builder()
|
Mount::builder()
|
||||||
.flags(MountFlags::BIND)
|
.flags(MountFlags::BIND)
|
||||||
.mount(dest, &path)?;
|
.mount(dest, &path)
|
||||||
|
.with_context(|| {
|
||||||
|
format!("Failed to mount: {} -> {}", dest.display(), path.display())
|
||||||
|
})?;
|
||||||
|
|
||||||
ms.push((m.clone(), path));
|
ms.push((m.clone(), path));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user