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

299.1. termshark-2.4.0

Terminal UI for tshark

Version 2.4.0, release 1
Shelf net-diag — Network diagnostics, capture, measurement and low-level socket tools
Phase 44_apps (Applications), 309 of 422 in build order
Licence MIT
Homepage https://termshark.io/
Build time 0.6 SBU
Installed size 18.9 MiB in 2 files
Recipe ports/core/net-diag/termshark/kpkgbuild

About

termshark is a terminal interface for packet captures, written in Go. It does no dissection of its own: it runs tshark from wireshark, reads its PDML output (tshark -T pdml) and draws the packet list, the protocol tree and the hex view, which can be scrolled and filtered interactively. wireshark in depends is therefore a run-time dependency the program cannot do without: with no tshark on the PATH, termshark stops at start with Could not find tshark in your PATH.

Why it is in KDOS

The comment above it in script/phases/44_apps/packages.d/net-diag.txt:

termshark does no dissection itself: it drives tshark -T pdml and draws the result, so the two ship together or neither is worth having.

Sources

Dependencies

Depends on: go, wireshark.

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/44_apps/phase.env && kpkg install termshark'

What kpkg does

kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/net-diag/termshark.

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/net-diag/termshark
echo '949c71866fcd2f9ed71a754ea9e3d1bdc23dee85969dcdc78180f1d18ca8b087  termshark-2.4.0.tar.gz' | sha256sum -c -
echo '0fb1adb5efe2a53ef4a07e92b0522bbf9b591d87d55695271171a282b7cca8ac  termshark-vendor-2.4.0.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/termshark
SRC=$SRC_ROOT/termshark-2.4.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf termshark-2.4.0.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 -mod=vendor -ldflags "-s -w" -o termshark ./cmd/termshark
install -Dm755 termshark $PKG/usr/bin/termshark

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

Contents

Installed programs: termshark.

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

Notes

The build is the canonical Go shape, with cgo off; see go. Its module dependencies come from the vendor bundle, termshark-vendor-<version>.tar.xz, which ports/fetch makes by running go mod vendor at the top of the source (vendoring = go) and which is held to its own sha256 = line in the recipe; see Vendoring. build.sh unpacks it beside go.mod and builds with -mod=vendor, so the build reaches no module proxy.