Skip to content

Commit 39c3b7b

Browse files
committed
Add debug mode for the mounted filesystem
1 parent 2453656 commit 39c3b7b

File tree

3 files changed

+22
-10
lines changed

3 files changed

+22
-10
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "uruntime"
3-
version = "0.3.2"
3+
version = "0.3.3"
44
readme = "README.md"
55
license = "MIT"
66
repository = "https://github.com/VHSgunzo/uruntime"

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ RunImage runtime usage
144144
for reuse mount point
145145
TMPDIR=/path Specifies a custom path for mounting or extracting the image
146146
FUSERMOUNT_PROG=/path Specifies a custom path for fusermount
147+
ENABLE_FUSE_DEBUG=1 Enables debug mode for the mounted filesystem
147148
TARGET_RUNIMAGE=/path Operate on a target RunImage rather than this file itself
148149
DWARFS_WORKERS=2 Number of worker threads for DwarFS (default: equal CPU threads)
149150
DWARFS_CACHESIZE=1024M Size of the block cache, in bytes for DwarFS (suffixes K, M, G)
@@ -215,6 +216,7 @@ AppImage runtime usage
215216
for reuse mount point
216217
TMPDIR=/path Specifies a custom path for mounting or extracting the image
217218
FUSERMOUNT_PROG=/path Specifies a custom path for fusermount
219+
ENABLE_FUSE_DEBUG=1 Enables debug mode for the mounted filesystem
218220
TARGET_APPIMAGE=/path Operate on a target AppImage rather than this file itself
219221
DWARFS_WORKERS=2 Number of worker threads for DwarFS (default: equal CPU threads)
220222
DWARFS_CACHESIZE=1024M Size of the block cache, in bytes for DwarFS (suffixes K, M, G)

src/main.rs

+19-9
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,8 @@ fn mount_image(embed: &Embed, image: &Image, mount_dir: PathBuf) {
444444
if image.is_dwar {
445445
#[cfg(feature = "dwarfs")]
446446
{
447-
embed.dwarfs(vec!["-f".into(),
447+
let mut exec_args = vec![
448+
image_path, mount_dir, "-f".into(),
448449
"-o".into(), "ro,nodev,noatime,clone_fd".into(),
449450
"-o".into(), "cache_files,no_cache_image".into(),
450451
"-o".into(), format!("cachesize={}", get_dwfs_option("DWARFS_CACHESIZE", DWARFS_CACHESIZE)),
@@ -453,20 +454,28 @@ fn mount_image(embed: &Embed, image: &Image, mount_dir: PathBuf) {
453454
"-o".into(), "tidy_strategy=time,tidy_interval=1s,tidy_max_age=2s,seq_detector=1".into(),
454455
"-o".into(), format!("workers={}", get_dwfs_option("DWARFS_WORKERS", &num_cpus::get().to_string())),
455456
"-o".into(), format!("uid={uid},gid={gid}"),
456-
"-o".into(), format!("offset={}", image.offset),
457-
"-o".into(), "debuglevel=error".into(),
458-
image_path, mount_dir
459-
])
457+
"-o".into(), format!("offset={}", image.offset)
458+
];
459+
if get_env_var("ENABLE_FUSE_DEBUG") == "1" {
460+
exec_args.append(&mut vec!["-o".into(), "debuglevel=debug".into()]);
461+
} else {
462+
exec_args.append(&mut vec!["-o".into(), "debuglevel=error".into()]);
463+
}
464+
embed.dwarfs(exec_args)
460465
}
461466
} else {
462467
#[cfg(feature = "squashfs")]
463468
{
464-
embed.squashfuse(vec!["-f".into(),
469+
let mut exec_args = vec![
470+
image_path, mount_dir, "-f".into(),
465471
"-o".into(), "ro,nodev,noatime".into(),
466472
"-o".into(), format!("uid={uid},gid={gid}"),
467-
"-o".into(), format!("offset={}", image.offset),
468-
image_path, mount_dir
469-
])
473+
"-o".into(), format!("offset={}", image.offset)
474+
];
475+
if get_env_var("ENABLE_FUSE_DEBUG") == "1" {
476+
exec_args.append(&mut vec!["-o".into(), "debug".into()]);
477+
}
478+
embed.squashfuse(exec_args)
470479
}
471480
}
472481
}
@@ -717,6 +726,7 @@ fn print_usage(portable_home: &PathBuf, portable_config: &PathBuf) {
717726
for reuse mount point
718727
TMPDIR=/path Specifies a custom path for mounting or extracting the image
719728
FUSERMOUNT_PROG=/path Specifies a custom path for fusermount
729+
ENABLE_FUSE_DEBUG=1 Enables debug mode for the mounted filesystem
720730
TARGET_{}=/path Operate on a target {SELF_NAME} rather than this file itself",
721731
ARG_PFX.to_uppercase(), SELF_NAME.to_uppercase());
722732
#[cfg(feature = "dwarfs")]

0 commit comments

Comments
 (0)