99.6. squashfs-tools-4.7.5
Tools to create and extract squashfs filesystems
| Version | 4.7.5, release 1 |
| Shelf | filesystem — Filesystem utilities, FUSE, and network or encrypted filesystems |
| Phase | 41_system (System), 506 of 1047 in build order |
| Licence | GPL-2.0-or-later |
| Homepage | https://github.com/plougher/squashfs-tools |
| Build time | 0.1 SBU |
| Installed size | 658.8 KiB in 9 files |
| Recipe | ports/core/filesystem/squashfs-tools/kpkgbuild |
About
squashfs-tools makes and unpacks squashfs images, the compressed read-only filesystem the KDOS live medium boots from: mksquashfs builds one, unsquashfs lists and extracts one, and sqfstar and sqfscat build one from a tar archive and print files from one. script/phases/70_image/110_iso.sh writes the ISO’s system.sfs with mksquashfs, zstd at level 19 and 1 MiB blocks unless KDOS_ISO_COMP names another codec or level or KDOS_ISO_BLOCK another block size, then appends the recipe tree as /ports and checks the result with unsquashfs -l. kdos rebuild needs mksquashfs to make a new medium from a source tree on a running system. How the live root is mounted is in The live medium and persistence.
The tools have no configure step. The build is selected with variables on the make command line, which override the Makefile’s own assignments.
Sources
squashfs-tools-4.7.5.tar.gz(402.9 KiB)
sha256547b7b7f4d2e44bf91b6fc554664850c69563701deab9fd9cd7e21f694c88ea6
upstream: https://github.com/plougher/squashfs-tools/archive/refs/tags/4.7.5.tar.gz
archive copy: sources-2/filesystem--squashfs-tools-4.7.5.tar.gz
Dependencies
Depends on: zlib, xz, lzo, zstd, lz4, sed.
Required by: no port names it.
Installation
From the repository root, inside the build container, this is the line kdosbuild runs for the port:
script/chroot/exec.sh bash -c 'source script/phases/41_system/phase.env && kpkg install squashfs-tools'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/filesystem/squashfs-tools.
1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.
cd /ports/core/filesystem/squashfs-tools
echo '547b7b7f4d2e44bf91b6fc554664850c69563701deab9fd9cd7e21f694c88ea6 squashfs-tools-4.7.5.tar.gz' | sha256sum -c -
2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.
SRC_ROOT=/var/cache/kpkg/work/squashfs-tools
SRC=$SRC_ROOT/squashfs-tools-4.7.5
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf squashfs-tools-4.7.5.tar.gz -C "$SRC" --strip-components=1
Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.
3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
cd squashfs-tools
SED=/usr/bin/sed make \
XZ_SUPPORT=1 \
LZMA_XZ_SUPPORT=1 \
ZLIB_SUPPORT=1 \
LZ4_SUPPORT=1 \
ZSTD_SUPPORT=1 \
USE_PREBUILT_MANPAGES=y \
INSTALL_DIR=$PKG/usr/bin \
INSTALL_MANPAGES_DIR=$PKG/usr/share/man/man1 \
install
The switches, and why each is set:
XZ_SUPPORT=1— Builds the xz (LZMA2) compressor, from xz’s liblzma. It is on by default.110_iso.shacceptsKDOS_ISO_COMP=xz.LZMA_XZ_SUPPORT=1— Builds the LZMA1 compressor too, through the same liblzma. Upstream leaves it off and calls it obsolete in favour of xz.ZLIB_SUPPORT=1— The Makefile has no variable of this name, so it changes nothing. gzip comes fromGZIP_SUPPORT, which is on by default and links zlib.LZ4_SUPPORT=1— Builds the LZ4 compressor, from lz4. It is on by default.ZSTD_SUPPORT=1— Builds the zstd compressor, from zstd, the default codec of the ISO image. It is on by default.USE_PREBUILT_MANPAGES=y— Installs the manual pages shipped inDocumentation/manpagesinstead of generating them from the built programs’-helpoutput withhelp2man.INSTALL_DIR=$PKG/usr/bin,INSTALL_MANPAGES_DIR=$PKG/usr/share/man/man1— Wheremake installcopies the programs and the pages. The Makefile has noDESTDIR; these paths include$PKGthemselves, and its default is under/usr/local.SED=/usr/bin/sed— Thesedthe manual-page scripts use.install-manpages.shsourcesfunctions.sh, which checks that$SED, or the firstsedonPATH, behaves as GNU sed and stops the install if it does not, prebuilt pages or not. sed is independs.
The common switches of each build system are explained in the Flag glossary.
4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/squashfs-tools, prunes what the image does not ship, lints the tree and rolls it reproducibly:
tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
--mtime=@$SOURCE_DATE_EPOCH \
--use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
-cf squashfs-tools-4.7.5-1.tar.xz -C "$PKG" .
5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/squashfs-tools, and runs the triggers its paths call for.
Contents
Installed programs: mksquashfs, sqfscat, sqfstar, unsquashfs.
Installed directories: /usr/share/licenses/squashfs-tools.
Short descriptions
mksquashfs |
tool to create and append to squashfs filesystems |
sqfscat |
tool to cat files from a squashfs filesystem to stdout |
sqfstar |
tool to create a squashfs filesystem from a tar archive |
unsquashfs |
tool to uncompress, extract and list squashfs filesystems |
Notes
LZO (LZO_SUPPORT) is also on by Makefile default, and lzo is in depends for it.
The prebuilt manual pages list the compressors of upstream’s default build, which has no LZMA1, so they leave out the lzma this build adds. mksquashfs -help on the installed program is the accurate list.