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

99.12. gocryptfs-2.6.1

An encrypted directory that syncs as ordinary files

Version 2.6.1, release 1
Shelf filesystem — Filesystem utilities, FUSE, and network or encrypted filesystems
Phase 41_system (System), 513 of 1047 in build order
Licence MIT
Homepage https://nuetzlich.net/gocryptfs/
Build time 0.1 SBU
Installed size 9.3 MiB in 5 files
Recipe ports/core/filesystem/gocryptfs/kpkgbuild

About

gocryptfs is an encrypted overlay filesystem: gocryptfs -init ~/vault.enc creates an encrypted directory, and gocryptfs ~/vault.enc ~/vault mounts its plaintext view through FUSE. Each file in the plaintext view is stored as one ciphertext file with an encrypted name, so the encrypted directory can be synced or backed up file by file, and only the files that changed are sent again. gocryptfs-xray inspects the ciphertext files and the master key. The mount goes through fusermount3, from fuse.

Why it is in KDOS

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

A container format is one enormous file that changes on every write, so syncing it resends the whole thing and two writers corrupt it. gocryptfs keeps a ciphertext file per plaintext file, which is why it is the one that works inside syncthing.

Sources

Dependencies

Depends on: go, fuse, openssl, lowdown.

Required by (1): plasma-vault.

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

What kpkg does

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

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/gocryptfs
echo '8b293c77703e9a45b629a47ce16aad701a9f2f53af5a8fb6200abe274f08051c  gocryptfs-2.6.1.tar.gz' | sha256sum -c -
echo 'b2daff09bb55aef307a29496f79d6a77bcb149b908a7e733465c498d61c069b4  gocryptfs-vendor-2.6.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/gocryptfs
SRC=$SRC_ROOT/gocryptfs-2.6.1
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf gocryptfs-2.6.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=1
mkdir -p out
go build -mod=vendor -ldflags "-s -w -X main.GitVersion=v$version -X main.GitVersionFuse=vendored -X main.BuildDate=offline" -o out/gocryptfs
go build -mod=vendor -ldflags "-s -w" -o out/gocryptfs-xray ./gocryptfs-xray
install -Dm755 out/gocryptfs       $PKG/usr/bin/gocryptfs
install -Dm755 out/gocryptfs-xray  $PKG/usr/bin/gocryptfs-xray
lowdown -s -Tman -o out/gocryptfs.1      Documentation/MANPAGE.md
lowdown -s -Tman -o out/gocryptfs-xray.1 Documentation/MANPAGE-XRAY.md
install -Dm644 out/gocryptfs.1      $PKG/usr/share/man/man1/gocryptfs.1
install -Dm644 out/gocryptfs-xray.1 $PKG/usr/share/man/man1/gocryptfs-xray.1

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

Contents

Installed programs: gocryptfs, gocryptfs-xray.

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

Short descriptions

gocryptfs create or mount an encrypted filesystem
gocryptfs-xray examine gocryptfs-related data

Notes

The binaries are built into out/, not the top of the tree: gocryptfs-xray is also the name of a package directory there, and go build -o gocryptfs-xray would write the program inside that directory instead.

The manual pages are written from upstream’s Markdown, Documentation/MANPAGE.md and MANPAGE-XRAY.md, with lowdown.

The Go modules, go-fuse among them, come from the vendor bundle, gocryptfs-vendor-<version>.tar.xz, made by go mod vendor and pinned by its own sha256 = line (see Vendoring).