91.7. atuin-18.23.0
Shell history in a searchable SQLite database, local only
| Version | 18.23.0, release 1 |
| Shelf | shells — Interactive shells and their add-ons, terminal multiplexers, and terminal emulators |
| Phase | 41_system (System), 952 of 1047 in build order |
| Licence | MIT |
| Homepage | https://atuin.sh/ |
| Build time | 4.3 SBU |
| Installed size | 23.1 MiB in 2 files |
| Recipe | ports/core/shells/atuin/kpkgbuild |
About
atuin keeps shell history in a SQLite database and replaces Ctrl+R with a full-screen search over it. The system bash.bashrc runs atuin init bash --disable-up-arrow, so Ctrl+R is atuin’s search and the Up arrow stays readline’s (see Shell environment). The package is the client alone, built without sync, so the history stays on the machine.
Why it is in KDOS
The comment above it in script/phases/41_system/packages.d/shells.txt:
Shell history in a local SQLite database. Built --no-default-features --features client: no sync, no update check, no daemon and no clipboard, so the history of everything typed on this machine has no route off it.
Sources
atuin-18.23.0.tar.gz(3.5 MiB)
sha256c01c12bcd14b851176cadf50cf7cc07c28a11652f94febd229602a94615a7f7a
upstream: https://github.com/atuinsh/atuin/archive/v18.23.0.tar.gz
archive copy: sources-4/shells--atuin-18.23.0.tar.gzatuin-vendor-18.23.0.tar.xz(58.5 MiB)
sha256f7b71cdc83113889507ff025150dc9044a44e98c3b6194db4dcb2192ce179c39
a vendor bundle: the dependencies upstream’s own tool would download, packed once
archive copy: sources-4/shells--atuin-vendor-18.23.0.tar.xz
Dependencies
Depends on: rust, openssl, sqlite, zstd.
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 atuin'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/shells/atuin.
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/shells/atuin
echo 'c01c12bcd14b851176cadf50cf7cc07c28a11652f94febd229602a94615a7f7a atuin-18.23.0.tar.gz' | sha256sum -c -
echo 'f7b71cdc83113889507ff025150dc9044a44e98c3b6194db4dcb2192ce179c39 atuin-vendor-18.23.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/atuin
SRC=$SRC_ROOT/atuin-18.23.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf atuin-18.23.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:
mkdir .kdos-vendor
tar xf $PORT_SRC/${name}-vendor-${version}.tar.xz -C .kdos-vendor \
--exclude=vendor/axoasset
export RUSTFLAGS="-C target-feature=-crt-static"
cargo build --release --frozen --offline --config .kdos-vendor/.cargo/config.toml \
--package atuin --no-default-features --features client,clipboard,pty-proxy
readelf -d target/release/atuin | grep -q 'NEEDED.*\[libsqlite3\.so\.0\]'
readelf -d target/release/atuin | grep -q 'NEEDED.*\[libzstd\.so\.1\]'
install -Dm755 target/release/atuin $PKG/usr/bin/atuin
The switches, and why each is set:
--exclude=vendor/axoasset— Leave the bundle’s copy of theaxoassetcrate out when unpacking. It is atuin’s own path crate, copied without a.cargo-checksum.json, and cargo refuses a directory source that holds a crate without one. The build takesaxoassetfrom the source tree’svendor/axoasset, which atuin’sCargo.tomlnames under[patch.crates-io].--config .kdos-vendor/.cargo/config.toml— Point cargo at the bundle’s configuration, which replaces crates.io with the bundle’svendor/directory. The bundle is unpacked into.kdos-vendorrather than the top of the tree because the tree already has avendor/of its own (see Notes), and cargo reads the relativedirectory = "vendor"against the directory that holds.cargo, which is.kdos-vendor.--package atuin— Build theatuinbinary crate of the workspace and no other member.--no-default-features— Turn off every default feature of theatuincrate:client,sync,clipboard,check-update,daemon,aiandpty-proxy.--features client,clipboard,pty-proxy— Turn three of them back on:clientis the local SQLite store, the search interface and the shell hooks;clipboardcopies a history entry out of the search interface through thearboardcrate;pty-proxyruns the shell inside a local pseudo-terminal so that the search can be drawn inline.sync,check-update,daemonandaistay off; in theatuincrate, they are the features that gate its network code.
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/atuin, 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 atuin-18.23.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/atuin, and runs the triggers its paths call for.
Contents
Installed programs: atuin.
Installed directories: /usr/share/licenses/atuin.
Notes
atuin’s source tree has a vendor/ directory of its own, holding axoasset as a [patch.crates-io] path crate and a copy of bash-preexec. That axoasset carries no .cargo-checksum.json, and a cargo directory source laid over the same vendor/ refuses the whole registry because of it. The bundle therefore goes beside the tree, in .kdos-vendor, and is named with --config (see Where the bundle goes).
The two readelf lines after cargo build stop the build unless the binary needs libsqlite3.so.0 and libzstd.so.1. The tree’s environment tells the libsqlite3-sys and zstd-sys crates to link the system libraries through pkg-config, and a crate that compiled its bundled copy instead would leave a private SQLite or zstd inside the binary, out of reach of those ports’ updates (see rust).
Feature selection stops at the atuin crate. The atuin-client library beneath it is still compiled with its own default features, among them sync, because other workspace crates take it with defaults on and cargo unions the features of one crate; that code is linked and never called by the commands built here.