Skip to the text
KDOS
Menu
kdos.dev KDOS from Scratch KDOS 0.2 · 4dd4a10 · 2026-11-30 Contents Index

93.3. duf-0.9.1

Disk usage and free space, in the manner of df

Version 0.9.1, release 1
Shelf files — File managers, disk-usage analysers, duplicate finders and file locators
Phase 41_system (System), 501 of 1047 in build order
Licence MIT
Homepage https://github.com/muesli/duf
Build time 0.1 SBU
Installed size 4.3 MiB in 3 files
Recipe ports/core/files/duf/kpkgbuild

About

duf lists mounted filesystems with their size, use and free space, in the manner of df, as coloured tables grouped into local, network, FUSE and special devices. It is a single Go binary with no C dependencies. The interactive shell aliases it as dff (/etc/bash.bashrc).

Sources

Dependencies

Depends on: go.

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 duf'

What kpkg does

kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/files/duf.

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/files/duf
echo '1334d8c1a7957d0aceebe651e3af9e1c1e0c6f298f1feb39643dd0bd8ad1e955  duf-0.9.1.tar.gz' | sha256sum -c -
echo '62d571754aad4b3e766bd26e5db2b9327a69d0d058da8ec8192d228cce7ad4d5  duf-vendor-0.9.1.tar.xz' | 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/duf
SRC=$SRC_ROOT/duf-0.9.1
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf duf-0.9.1.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:

tar xf $PORT_SRC/${name}-vendor-${version}.tar.xz

export CGO_ENABLED=0
go build -ldflags "-s -w -X main.Version=$version" -o duf
install -Dm755 duf $PKG/usr/bin/duf
install -Dm644 duf.1 -t $PKG/usr/share/man/man1

The switches, and why each is set:

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/duf, 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 duf-0.9.1-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/duf, and runs the triggers its paths call for.

Contents

Installed programs: duf.

Installed directories: /usr/share/licenses/duf.

Short descriptions

duf Disk Usage/Free Utility

Notes

The Go modules come from the vendor bundle, duf-vendor-<version>.tar.xz, which ports/fetch writes with go mod vendor and pins with its own sha256 = line. build.sh passes no -mod=vendor: when a vendor/ directory with its modules.txt sits beside a go.mod whose go line is 1.14 or later, go build uses it by default. See Vendoring.