109.4. rclone-1.75.1
Syncs files between local disks and remote storage, and verifies copies with rclone check
| Version | 1.75.1, release 1 |
| Shelf | transfer — File transfer, synchronisation, backup and BitTorrent |
| Phase | 41_system (System), 979 of 1047 in build order |
| Licence | MIT |
| Homepage | https://rclone.org/ |
| Build time | 2.0 SBU |
| Installed size | 92.2 MiB in 6 files |
| Recipe | ports/core/transfer/rclone/kpkgbuild |
About
rclone copies and synchronises files between local directories and remote storage. KDOS carries it above all for rclone check, which compares two directory trees by content and reports every file that differs or is missing, so it answers whether a copy to a second disk is complete. deja-dup also runs it to reach its cloud locations. rclone mount serves a tree through FUSE, running fuse’s setuid fusermount3, so fuse is in depends.
Why it is in KDOS
The comment above restic and rclone in script/phases/41_system/packages.d/transfer.txt:
A backup tool is one static binary or it is not a backup tool: the repository has to restore from a machine that is NOT this one.
rclone checkis the only thing here that compares two trees by content and says what differs.
Sources
rclone-1.75.1.tar.gz(16.0 MiB)
sha256fcc9351ab3976c73b4824cf7919f98f911f2442a606e2910fc2bd562111da220
upstream: https://github.com/rclone/rclone/archive/refs/tags/v1.75.1.tar.gz
archive copy: sources-4/transfer--rclone-1.75.1.tar.gzrclone-vendor-1.75.1.tar.xz(9.9 MiB)
sha256de35ac0ae09dbf992286c0e4c2b9d2f9f2b7c944cd67296cb6a8ab3f790f5042
a vendor bundle: the dependencies upstream’s own tool would download, packed once
archive copy: sources-4/transfer--rclone-vendor-1.75.1.tar.xz
Dependencies
Required by (1): deja-dup.
Patches
build.sh applies these; kpkg applies nothing by itself.
no-embedded-gui.patch— Removes thecmd/guiimport fromcmd/all/all.go, sorclone guiis not compiled in. That command embedscmd/gui/dist.zip, a prebuilt web bundle this tree does not build, and has no build tag to leave it out.rclone rcd --rc-web-guiis unaffected: it fetches its interface at run time and embeds nothing.
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 rclone'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/transfer/rclone.
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/transfer/rclone
echo 'fcc9351ab3976c73b4824cf7919f98f911f2442a606e2910fc2bd562111da220 rclone-1.75.1.tar.gz' | sha256sum -c -
echo 'de35ac0ae09dbf992286c0e4c2b9d2f9f2b7c944cd67296cb6a8ab3f790f5042 rclone-vendor-1.75.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/rclone
SRC=$SRC_ROOT/rclone-1.75.1
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf rclone-1.75.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
patch -p1 -i "$PORT_SRC/no-embedded-gui.patch"
export CGO_ENABLED=0
go build -mod=vendor -tags noselfupdate \
-ldflags "-s -w -X github.com/rclone/rclone/fs.Version=v$version" -o rclone
install -Dm755 rclone $PKG/usr/bin/rclone
install -Dm644 rclone.1 $PKG/usr/share/man/man1/rclone.1
./rclone completion bash - > rclone.bash
./rclone completion zsh - > _rclone
./rclone completion fish - > rclone.fish
install -Dm644 rclone.bash $PKG/usr/share/bash-completion/completions/rclone
install -Dm644 _rclone $PKG/usr/share/zsh/site-functions/_rclone
install -Dm644 rclone.fish $PKG/usr/share/fish/vendor_completions.d/rclone.fish
The switches, and why each is set:
-tags noselfupdate— Build without theselfupdatecommand, which downloads a release binary and writes it over the running one; here that file is/usr/bin/rclone, which belongs to the package.-X github.com/rclone/rclone/fs.Version=v$version— Set the version stringrclone versionprints. Without it rclone reports the tag compiled into the source with a-DEVsuffix,v<version>-DEV.CGO_ENABLED=0— Build without cgo, the tree’s usual setting for a Go port; the mount is rclone’s pure-Go FUSE client.
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/rclone, 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 rclone-1.75.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/rclone, and runs the triggers its paths call for.
Contents
Installed programs: rclone.
Installed directories: /usr/share/licenses/rclone.
Short descriptions
rclone |
manage files on cloud storage |
Notes
The modules come from the vendor bundle, rclone-vendor-<version>.tar.xz, made by ports/fetch with go mod vendor; build.sh unpacks it before applying the patch and builds with -mod=vendor (see Vendoring). The completions are generated by the binary just built, so they list the commands it has.