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

293.2. android-file-transfer-4.5

An Android phone's storage in a window, as a FUSE directory (aft-mtp-mount) and in the aft-mtp-cli shell

Version 4.5, release 2
Shelf mobile — Phones, media players and cameras over USB or the network
Phase 44_apps (Applications), 296 of 422 in build order
Licence LGPL-2.1-or-later
Homepage https://whoozle.github.io/android-file-transfer-linux/
Build time 1.1 SBU
Installed size 2.5 MiB in 7 files
Recipe ports/core/mobile/android-file-transfer/kpkgbuild

About

Android File Transfer reaches a phone’s storage over MTP, the protocol an Android phone offers on USB. It speaks MTP itself through the kernel’s usbdevfs interface, without libmtp, and gives three ways in: aft-mtp-mount ~/Phone mounts the storage as a FUSE directory any file manager reads (fusermount3 -u ~/Phone takes it away), the android-file-transfer window browses and copies with no mount, and aft-mtp-cli is an interactive shell. libmtp’s own mtp-* tools address files only by numeric id.

Why it is in KDOS

The comment above it in script/phases/44_apps/packages.d/mobile.txt:

The phone's storage as a directory, aft-mtp-mount ~/Phone, or in the android-file-transfer window. libmtp alone offers only the mtp-* tools, which address files by numeric id.

Sources

Dependencies

Depends on: cmake, pkgconf, fuse, readline, file, libmtp, qt6-qtbase, qt6-qttools, qt6-qtwayland.

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 android-file-transfer'

What kpkg does

kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/mobile/android-file-transfer.

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/mobile/android-file-transfer
echo '0f366a8d659926d3859a8628d4f7592692389b060f67da9a936d19b252b42d96  android-file-transfer-4.5.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/android-file-transfer
SRC=$SRC_ROOT/android-file-transfer-4.5
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf android-file-transfer-4.5.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 -p build && cd build
cmake .. -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -DCMAKE_BUILD_TYPE=Release \
	-DCMAKE_INSTALL_PREFIX=/usr \
	-DBUILD_QT_UI=ON \
	-DDESIRED_QT_VERSION=6 \
	-DBUILD_FUSE=ON \
	-DBUILD_MTPZ=OFF \
	-DBUILD_PYTHON=OFF \
	-DBUILD_TAGLIB=OFF \
	-DBUILD_SHARED_LIB=OFF
make
make DESTDIR=$PKG install
rm "$PKG/usr/lib/libmtp-ng-static.a"
[ -x "$PKG/usr/bin/android-file-transfer" ] || {
	echo "android-file-transfer: the Qt window was not built" >&2
	exit 1
}

cat > "$PKG/usr/share/applications/android-file-transfer.desktop" <<'DESKTOP'
[Desktop Entry]
Type=Application
Name=Android File Transfer
GenericName=Phone File Transfer
Comment=Copy files to and from an Android phone or any MTP device
Exec=android-file-transfer
Icon=android-file-transfer
Terminal=false
StartupWMClass=io.github.whoozle.android-file-transfer
Categories=Qt;Utility;FileTools;
Keywords=android;phone;mtp;usb;transfer;tablet;
DESKTOP
chmod 644 "$PKG/usr/share/applications/android-file-transfer.desktop"

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/android-file-transfer, 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 android-file-transfer-4.5-2.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/android-file-transfer, and runs the triggers its paths call for.

Contents

Installed programs: aft-mtp-cli, aft-mtp-mount, android-file-transfer.

Installed directories: /usr/share/licenses/android-file-transfer.

Notes

libmtp is in depends for its udev rules, 69-libmtp.rules, which give the dialout group access to a phone’s USB device node; this program does not link it. libmagic, from file, gives an uploaded file its MIME type.

The desktop entry is KDOS’s own. Upstream’s has no StartupWMClass; the program sets the organisation domain whoozle.github.io and no desktop file name, so Qt makes its Wayland app id the reversed domain followed by the executable’s name, io.github.whoozle.android-file-transfer, and the entry names that. The application name the program also sets, aft-linux-qt, plays no part in it.