Skip to content

linux-packaging-rs/squashfuse-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

squashfuse-rs

Implementation of FUSE for SquashFS in rust using the fuser and backhand crates!

Inspired by a C library called squashfuse https://github.com/vasi/squashfuse/tree/master

PRs are welcome, I don't claim to know a lot about SquashFS and FUSE, so if there is a better way of doing things, please let me know!

Example usage from appimage-type2-runtime-rs:

fn fusefs_main(offset: u64, mountpoint: &Path, archive_path: &Path) -> anyhow::Result<()> {
    let reader = BufReader::new(File::open(&archive_path)?);
    let fs = squashfuse_rs::SquashfsFilesystem::new(
        backhand::FilesystemReader::from_reader_with_offset(reader, offset)?,
    );
    let mount_options = vec![
        fuser::MountOption::FSName("squashfuse".to_string()),
        fuser::MountOption::RO,
    ];
    match fuser::mount2(fs, mountpoint, &mount_options) {
        Ok(()) => {
            println!("Mounted {:?} at {:?}", archive_path, mountpoint);
            Ok(())
        }
        Err(err) => Err(anyhow::anyhow!("Failed to mount: {}", err)),
}

About

FUSE Filesystem implementation for Squashfs in Rust

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages