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

92.16. tealdeer-1.9.0

Example-first help — the tldr pages, pre-seeded and never fetched

Version 1.9.0, release 1
Shelf cli — Command-line productivity utilities: search, view, navigation and text wrangling in the terminal
Phase 41_system (System), 297 of 1047 in build order
Licence (MIT OR Apache-2.0) AND CC-BY-4.0
Homepage https://tealdeer-rs.github.io/tealdeer/
Build time 3.4 SBU
Installed size 6.2 MiB in 5525 files
Recipe ports/core/cli/tealdeer/kpkgbuild

About

tealdeer is a fast client for the tldr pages, the community’s short, example-first help pages: tldr tar shows the handful of tar command lines people actually need. The program is tldr. A plain tealdeer has no pages until tldr --update downloads them, so this port ships them: the recipe’s second source is the tldr-pages release archive, and its English pages are installed with the program, so tldr answers with no network.

Why it is in KDOS

The comment above it in script/phases/41_system/packages.d/cli.txt:

The pages are seeded and auto-update is off: out of the box tldr downloads on first use, so its whole value appears only where there is a network — which is the case it was chosen FOR.

Sources

Dependencies

Depends on: rust.

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

What kpkg does

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

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/cli/tealdeer
echo '1387a04ddba714668ff0925377a2de0d0ab14533d44dd0766d673fbbd71e3119  tealdeer-1.9.0.tar.gz' | sha256sum -c -
echo '43603441aed2b4ec46bf46bd6120a7b524b3479e27e4be9889de69ad602eb596  tealdeer-vendor-1.9.0.tar.xz' | sha256sum -c -
echo 'a49c520fa0545286c268c907d6534503ed818a6e5c73cb5cb0c018e237b1f1c4  tldr-pages-2.3.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/tealdeer
SRC=$SRC_ROOT/tealdeer-1.9.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf tealdeer-1.9.0.tar.gz -C "$SRC" --strip-components=1
tar --no-same-permissions --warning=no-unknown-keyword -xf tldr-pages-2.3.tar.gz -C "$SRC_ROOT"

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 RUSTFLAGS="-C target-feature=-crt-static"
cargo build --release --frozen --offline
install -Dm755 target/release/tldr $PKG/usr/bin/tldr
install -Dm644 completion/bash_tealdeer $PKG/usr/share/bash-completion/completions/tldr
install -Dm644 completion/zsh_tealdeer $PKG/usr/share/zsh/site-functions/_tldr

install -dm755 $PKG/usr/share/tldr/tldr-pages
cp -a $SRC_ROOT/tldr-2.3/pages $PKG/usr/share/tldr/tldr-pages/pages.en

install -Dm644 /dev/stdin $PKG/etc/skel/.config/tealdeer/config.toml <<'TOML'
# The pages are shipped under /usr/share/tldr and are the only ones this
# machine will have. auto_update off is what stops `tldr` reaching for a cache
# it cannot download, and warn_cache_age off stops it calling the shipped set
# stale by its packaged date. `tldr --update` writes into cache_dir, so with
# a network, point cache_dir at a directory of your own first.
[directories]
cache_dir = "/usr/share/tldr"

[updates]
auto_update = false
warn_cache_age = "never"
TOML

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

Contents

Installed programs: tldr.

Installed directories: /etc/skel, /usr/share/licenses/tealdeer, /usr/share/tldr.

Notes

The pages are installed in the layout of a downloaded cache, /usr/share/tldr/tldr-pages/pages.en/, because tealdeer looks pages up only under <cache_dir>/tldr-pages/. The configuration that points it there is /etc/skel/.config/tealdeer/config.toml, which a new account’s home is copied from:

tealdeer reads no system-wide configuration: only ~/.config/tealdeer/config.toml, a config.toml in the directory TEALDEER_CONFIG_DIR names, or the file --config-path names. An account whose home has no ~/.config/tealdeer/config.toml falls back to ~/.cache/tealdeer, finds no pages there, and is told to run tldr --update.

kpkg unpacks the pages archive into $SRC_ROOT, beside the program’s source, and build.sh copies from $SRC_ROOT/tldr-<pages version>/pages by its literal directory name, so a new pages release changes build.sh as well as the source line. tealdeer itself is built from a vendor bundle, tealdeer-vendor-<version>.tar.xz, made by ports/fetch with cargo vendor; see Vendoring.