Skip to content

๐Ÿ—œ๏ธ fast r/o squashfs implementation written in C.

License

Notifications You must be signed in to change notification settings

Gottox/sqsh-tools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

sqsh-tools CI codecov Quality Gate Status License

squashfs is an open and free compressed read-only filesystem. It is used in embedded devices, live-CDs, or in packaging. The original implementation resides in the linux kernel, but there are also userspace implementations.

This project provides a userspace implementation of the squashfs filesystem containing a set of command line tools and a C library.

users of sqsh-tools

  • radare2 - A reverse engineering framework. Integrates libsqsh into their virtual filesystem framework to explore inline squashfs archives.
  • Filer - A file manager for Unix systems. Uses libsqsh to show previews of AppImages without mounting them first.
  • sqsh-rs - Rust bindings for libsqsh.

Building

Dependencies

  • libc: Any POSIX compliant libc should work. Open a bug if it doesn't.
  • zlib optional: For gzip compression support.
  • liblz4 optional: For lz4 compression support.
  • liblzma optional: For lzma compression support.
  • libzstd optional: For zstd compression support.
  • fuse3 optional: For mounting squashfs archives.
  • fuse2 optional: For mounting squashfs archives on systems that don't support fuse3. e.g. OpenBSD.
  • libcurl optional: For transparently reading squashfs archives from the internet without downloading them first.

Note that to do anything useful with libsqsh, you need to have at least one of the compression libraries enabled.

Compile & Install

meson setup build
cd build
meson compile
meson install

tools

This project provides a set of command line tools to interact with squashfs archives.

  • sqsh-cat: Prints the content of one or multiple files to stdout.
  • sqsh-ls: Lists the content of a directory.
  • sqsh-stat: Prints the metadata of a file, directory, or the whole archive.
  • sqsh-unpack: Extracts a squashfs archive to a directory.
  • sqsh-xattr: Prints the extended attributes of a file or directory.
  • sqshfs: Mounts a squashfs archive to a directory. There are two versions of this tool, one for fuse3 and one for fuse2.

libsqsh

sqsh-tools also provides a C library to interact with squashfs archives. There are two APIs available:

  • Easy API: This API is designed to be easy to use and provides a simple interface to read the content of a squashfs archive. It is the recommended API to use.

  • Low-level API: This API provides a more fine-grained control over the squashfs archive. It allows zero copy reading of the archive.

For more information, see the libsqsh README.

LZO2

LZO2 is a fast compression algorithm. Unfortunately the current implementation is GPL licensed and therefore not included in this library. If you want to use LZO2 there's and independent glue library called libsqsh-lzo.