Closed gmkurtzer closed 1 year ago
An additional application is to exploit tar's superior file selection options. An actual limitation I ran into this: From a read-only root-owned source containing...
/nix/store/0000/
/nix/store/0001/
/nix/store/0002/
...
/nix/store/9999/
...I want just the following in my squashfs...
/nix/store/1234/
/nix/store/8888/
If I mksquashfs /nix/store/1234 /nix/store/8888 result.squashfs
I get the wrong result...
1234/
8888/
But tar does this correctly: tar -cf result.tar /nix/store/1234 /nix/store/8888
. It also provides all kinds of features to slice and dice paths.
Ultimately what I really want is...
tar -cf - /nix/store/1234 /nix/store/8888 | mksquashfs result.squashfs
tar2sqfs
and sqfs2tar
are provided by squashfs-tools-ng. Works great in my testing.
This is fixed by the introduction of the sqfstar
command in squashfs-tools 4.5
@plougher, Apologies for necro-ing this issue, I know you're super busy.
This been fixed since the Squashfs-tools 4.5 release, with the Sqfstar command.
e.g.
tar -cf - /nix/store/1234 /nix/store/8888 | sqfstar result.squashfs
I see that there was a request for this in SF (https://sourceforge.net/p/squashfs/feature-requests/14/), but wanted to bring up an additional use case which I feel is very valuable.
Tarballs are being used as a portable format for container mobility, it would be very useful if a non-privileged user could pipe the tar contents directly into a squashFS file system in such a manner to avoid having to be root.
I realize that the contents could be splat out to a temporary directory structure but this is not only IO inefficient, it also can break privileged permissions (e.g. SUID) and ownership of the squashed files (even when --all-root, because not all files within a root file system are root owned).
Thank you!