I had a brief go at this myself, but I quickly got stuck.
* mmdebstrap always has tar write to stdout, rather than adding "-f
$filename" to @taropts.
mksquashfs doesn't allow this.
mksquashfs *has to* write to a regular file (AFAIK).
* mmdebstrap adds compression to the pipeline itself, rather than adding e.g.
"--zstd" to @taropts.
mksquashfs doesn't allow this.
mksquashfs *has to* do compression itself.
* mmdebstrap avoids avoid mknod() by assembling a "/dev only" uncompressed
tar from raw bytes ($devtar),
and just printing it to stdout before the main tar run. i.e. it relies on
tape archives being concatenative.
mksquashfs doesn't allow this.
mksquashfs *can* append to an existing tarball, but (again) they have to be
regular files.
So mmdebstrap would have to do something like
print $devsq >unstable-chroot.squashfs
mksquashfs root $filename
This also has implications for reproducible builds when the mode changes (I
think).
* Note that appending to an existing file is the *default behaviour*.
To avoid this, you need -noappend.
This can trick you if you do multiple builds to the same destination, e.g.
mksquashfs attempt-1/ final.squashfs
mksquashfs attempt-2/ final.squashfs # weird errors, because it
overwrite the old final.squashfs contents!
I did also consider piping, something like:
mmdebstrap unstable | tar2squashfs unstable.squashfs
but such a command doesn't exist, and would preclude some of
squashfs's compression and reproducible builds functionality.