mgord9518/shappimage

How can I integrate this into my project?

Closed this issue · 4 comments

Hi, this is a very interesting project. I have a similar one, except it is works on *BSD platforms, Linux, OpenIndiana and etc. I wanted to borrow some code from this project, but I couldn't find the part where the squashfs archive gets mounted, its a bit intrincate. I'd appreciate it if you could help me implement this in PELF or guide me a bit on what I should do to achieve this, I'd appreciate it very much:

  • Instead of packing everything into a TAR, only pack into the tar the metadata and the squashfs tools needed to mount the archive
  • Once the sqfs archive is mounted, proceed as normal, if the system is not able to mount it, extract it to the TEMPDIR.

I couldn't quite figure it out by myself, I'd appreciate help from someone more experienced, thanks!

  • I initially wanted to use a FUSE filesystem of TAR, but there aren't any readily implementations that'll work on other systems apart from Linux, I am also considering using CPIO, but then again, I need to mount the archive in order to have on-the-fly file-loading.

Any sort of help is appreciated, thanks!

  1. Working version of PELF: https://github.com/xplshn/pelf
  2. Unfinished implementation using sqfs: https://pastebin.com/rJ9S79xc

Thanks for taking interest! Our projects seem to have a very similar goal.

For mounting the bundle, this code is the most relevant. Much of it is extracting a static binary of my squashfuse-zig project which allows SquashFS images to be mounted without root permissions. So long as you have the offset of the SquashFS image in the file, mounting it is no issue

thanks!

I am still unable to understand how mnt_cmd works :(

mnt_cmd is defined in extract_exe, the only reason I'm even setting it is to allow DwarFS support, but I'll probably end up removing it anyway due to licensing

extract_exe extracts a gzip-compressed squashfuse binary at an offset (that gets set when the runtimes are built), then sets run_cmd to that binary with whatever flags it needs. If you only want SquashFS support, you can just extract squashfuse and run it directly