Release packaging: tar.gz, AppImage, Arch package (tunal-bin), installer.sh

tools/package.sh builds dist/ offline; packaging/arch-bin/PKGBUILD is the release package next to the
build-from-checkout packaging/arch/; installer.sh installs the tar.gz or AppImage per user or system-wide
with a checksum and glibc check; README install section and 0.1.0 release notes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
astar76 2026-11-26 14:27:09 -06:00
commit 5bfd102491
7 changed files with 362 additions and 1 deletions

1
.gitignore vendored
View file

@ -3,3 +3,4 @@ target/
packaging/arch/src/
packaging/arch/pkg/
*.pkg.tar.zst
/dist/

View file

@ -12,7 +12,25 @@ cargo run -p tunal
Needs a recent stable Rust toolchain.
## Install
## Install a release
Downloads are on the [Releases page](https://archlinux.tail7c4f5e.ts.net/git/astar76/Tunal/releases): Linux x86_64 only. The binaries are built on Arch Linux and need
**glibc 2.43 or newer**, so they run on Arch and other up-to-date rolling distributions; older distributions
(Debian, Ubuntu LTS, Fedora releases with an older glibc) cannot run them and should build from source.
- **Arch Linux:** `sudo pacman -U Tunal-0.1.0-arch-x86_64.pkg.tar.zst` (package `tunal-bin`; remove it with
`sudo pacman -R tunal-bin`).
- **Installer (any distribution):** put `installer.sh` next to the downloaded tar.gz or AppImage and
`SHA256SUMS-0.1.0`, then run `sh installer.sh` (your home, `~/.local`, no root) or `sh installer.sh --system`
(`/usr/local`, sudo only for the copy). It checks the checksum and refuses, in plain words, when glibc is too old.
`sh installer.sh --uninstall` removes it; add `--purge` to delete settings and data too.
- **tar.gz:** unpack it, then `./install.sh` inside the folder (same options as `installer.sh`) and later
`./uninstall.sh` (`--purge` for settings and data).
- **AppImage:** `chmod +x Tunal-0.1.0-x86_64.AppImage` and run it. System libraries are not bundled.
The release packages put the polkit policy in `share/polkit-1/actions/`; polkit only reads it under `/usr`, so the full administrator prompt works with the Arch package, while `~/.local` and `/usr/local` installs show the generic prompt.
## Install from source
Pick one. Each builds in release mode, and running it again updates Tunal.

22
docs/releases/0.1.0.md Normal file
View file

@ -0,0 +1,22 @@
# Tunal 0.1.0
First release. Linux x86_64, glibc 2.43 or newer (Arch and other up-to-date rolling distributions).
## Files
- `Tunal-0.1.0-x86_64.AppImage`
- `Tunal-0.1.0-Linux-x86_64.tar.gz` (install.sh and uninstall.sh for your home folder)
- `Tunal-0.1.0-arch-x86_64.pkg.tar.zst` (Arch package `tunal-bin`: `sudo pacman -U Tunal-0.1.0-arch-x86_64.pkg.tar.zst`)
- `SHA256SUMS-0.1.0`
`installer.sh` from the repository installs the tar.gz or AppImage into `~/.local` or `/usr/local` and removes it again.
## What is in it
A file manager with Material You styling: tabs, split view, places, file operations with trash, folder metadata, sudo
elevation, thumbnails, a music tag editor, a quick audio player, USB drives, iOS and Android devices, and SFTP.
See FEATURES.md for the state of each feature.
## Known gaps
- Needs glibc 2.43 or newer; older distributions must build from source.
- The window has no Wayland app ID, so docks and taskbars may not match it to its icon and launcher.
- The full administrator prompt needs the polkit policy under `/usr` (the Arch package); other installs get the generic prompt.
- Packages were smoke-tested on Arch (a hidden session, start and close); the Arch package was not installed with pacman in tests.

156
installer.sh Executable file
View file

@ -0,0 +1,156 @@
#!/bin/sh
# Tunal installer. Installs from a release tar.gz or AppImage, or removes an install.
# installer.sh [--user|--system] [--prefix DIR] [--url URL] [FILE]
# installer.sh --uninstall [--purge] [--user|--system] [--prefix DIR]
# --user (default): ~/.local, no root. --system: /usr/local, sudo only for the copy.
# Without FILE it uses the unpacked release folder it sits in, or Tunal-*-Linux-x86_64.tar.gz or
# Tunal-*-x86_64.AppImage next to it. SHA256SUMS-<version> beside the file is checked when present.
# --purge also deletes settings and data (~/.config/tunal: settings, bookmarks and SSH known hosts). DESTDIR=dir stages under dir (no sudo).
# Needs glibc 2.43 or newer.
set -eu
app=tunal main=tunal need=2.43
mode=install scope=user purge=0 prefix= url= file=
while [ $# -gt 0 ]; do
case $1 in
--user) scope=user ;;
--system) scope=system ;;
--prefix) [ $# -ge 2 ] || { echo "--prefix needs a folder." >&2; exit 2; }; prefix=$2; shift ;;
--url) [ $# -ge 2 ] || { echo "--url needs an address." >&2; exit 2; }; url=$2; shift ;;
--uninstall) mode=uninstall ;;
--purge) purge=1 ;;
-h|--help) sed -n '2,9p' "$0" | sed 's/^# \{0,1\}//'; exit 0 ;;
-*) echo "Unknown option: $1 (see --help)." >&2; exit 2 ;;
*) file=$1 ;;
esac
shift
done
[ "$purge" = 0 ] || [ "$mode" = uninstall ] || { echo "--purge only goes with --uninstall." >&2; exit 2; }
if [ -z "$prefix" ]; then
if [ "$scope" = system ]; then prefix=/usr/local; else prefix=$HOME/.local; fi
fi
case $prefix in /*) ;; *) echo "--prefix must be an absolute path." >&2; exit 2 ;; esac
prefix=${prefix%/}
destdir=${DESTDIR:-}
root=$destdir$prefix
list=$root/lib/$app/files
sudo=
if [ -z "$destdir" ] && [ "$(id -u)" != 0 ]; then
d=$root; while [ ! -e "$d" ]; do d=$(dirname "$d"); done
[ -w "$d" ] || sudo=sudo
fi
refresh() {
[ -z "$destdir" ] || return 0
command -v update-desktop-database >/dev/null 2>&1 && $sudo update-desktop-database -q "$root/share/applications" 2>/dev/null || true
[ -f "$root/share/icons/hicolor/index.theme" ] && command -v gtk-update-icon-cache >/dev/null 2>&1 \
&& $sudo gtk-update-icon-cache -q -t -f "$root/share/icons/hicolor" 2>/dev/null || true
}
# Removes the files the last install listed, then the folders that became empty.
remove_listed() {
[ -f "$list" ] || return 0
while IFS= read -r f; do
[ -n "$f" ] || continue
$sudo rm -f "$root/$f"
d=$(dirname "$f")
while [ "$d" != . ] && $sudo rmdir "$root/$d" 2>/dev/null; do d=$(dirname "$d"); done
done < "$list"
$sudo rm -f "$list"
$sudo rmdir "$root/lib/$app" "$root/lib" 2>/dev/null || true
}
if [ "$mode" = uninstall ]; then
if [ ! -f "$list" ]; then
echo "Tunal is not installed in $prefix (no $list)." >&2
[ "$purge" = 1 ] || exit 1
else
remove_listed
refresh
echo "Tunal removed from $prefix."
fi
if [ "$purge" = 1 ]; then
rm -rf "${XDG_CONFIG_HOME:-$HOME/.config}/tunal"
echo "Settings and data removed (~/.config/tunal: settings, bookmarks and SSH known hosts)."
else
echo "Settings and data are kept (--purge deletes them)."
fi
exit 0
fi
# glibc check (TUNAL_GLIBC overrides the detected version, for tests)
have=${TUNAL_GLIBC:-$(getconf GNU_LIBC_VERSION 2>/dev/null | sed 's/^glibc //')}
if [ -z "$have" ]; then
echo "Tunal needs glibc $need or newer, and this system does not report a glibc (musl?). Nothing was installed." >&2; exit 1
fi
if [ "$(printf '%s\n%s\n' "$need" "$have" | sort -V | head -n 1)" != "$need" ]; then
echo "Tunal needs glibc $need or newer, and this system has glibc $have. Nothing was installed." >&2; exit 1
fi
here=$(cd "$(dirname "$0")" && pwd)
tmp=$(mktemp -d); trap 'rm -rf "$tmp"' EXIT INT TERM
if [ -n "$url" ]; then
file=$tmp/$(basename "${url%%\?*}")
if command -v curl >/dev/null 2>&1; then curl -fL -o "$file" -- "$url"
elif command -v wget >/dev/null 2>&1; then wget -O "$file" -- "$url"
else echo "Neither curl nor wget is installed, so $url cannot be fetched." >&2; exit 1; fi
fi
src=
if [ -z "$file" ]; then
if [ -f "$here/bin/$main" ]; then src=$here
else
for f in "$here"/Tunal-*-Linux-x86_64.tar.gz "$here"/Tunal-*-x86_64.AppImage; do
[ -f "$f" ] && { file=$f; break; }
done
fi
fi
if [ -z "$src" ]; then
[ -n "$file" ] && [ -f "$file" ] || { echo "No Tunal tar.gz or AppImage was given or found next to the installer." >&2; exit 1; }
dir=$(dirname "$file"); name=$(basename "$file")
for s in "$dir"/SHA256SUMS-*; do
[ -f "$s" ] || continue
line=$(grep -F " $name" "$s" | head -n 1 || true)
[ -n "$line" ] || continue
[ "${line%% *}" = "$(sha256sum "$file" | cut -d' ' -f1)" ] \
|| { echo "The checksum of $name does not match $(basename "$s"). Nothing was installed." >&2; exit 1; }
echo "Checksum ok."
done
mkdir "$tmp/x"
case $name in
*.tar.gz)
tar -xzf "$file" -C "$tmp/x"
src=$(find "$tmp/x" -maxdepth 1 -mindepth 1 -type d | head -n 1)
[ -n "$src" ] && [ -f "$src/bin/$main" ] || { echo "$name has no bin/$main, so it is not a Tunal release." >&2; exit 1; } ;;
*.AppImage)
cp "$file" "$tmp/app"; chmod 755 "$tmp/app"
(cd "$tmp/x" && "$tmp/app" --appimage-extract >/dev/null 2>&1) || true
[ -d "$tmp/x/squashfs-root/usr/share" ] || { echo "Could not read the contents of $name. Nothing was installed." >&2; exit 1; }
src=$tmp/src; mkdir -p "$src/bin"
mv "$tmp/app" "$src/bin/$main"
mv "$tmp/x/squashfs-root/usr/share" "$src/share" ;;
*) echo "Unknown file type: $name (need .tar.gz or .AppImage)." >&2; exit 1 ;;
esac
fi
# Stage with launchers pointing at this prefix, then copy and list every file for --uninstall.
st=$tmp/stage
mkdir -p "$st"
for d in bin lib share; do [ ! -d "$src/$d" ] || cp -R "$src/$d" "$st/$d"; done
for d in "$st"/share/applications/*.desktop; do
[ -f "$d" ] || continue
for b in "$st"/bin/*; do
b=$(basename "$b")
sed -i -e "s#^Exec=$b\( \|\$\)#Exec=$prefix/bin/$b\1#" -e "s#^TryExec=$b\$#TryExec=$prefix/bin/$b#" "$d"
done
done
chmod 755 "$st"/bin/*
(cd "$st" && find . \( -type f -o -type l \) | sed 's|^\./||' | sort) > "$tmp/files"
mkdir -p "$st/lib/$app"; echo "lib/$app/files" >> "$tmp/files"; cp "$tmp/files" "$st/lib/$app/files"
remove_listed
$sudo mkdir -p "$root"
$sudo cp -R "$st/." "$root/"
refresh
echo "Tunal installed in $prefix/bin/$main"
case ":$PATH:" in *":$prefix/bin:"*) ;; *) echo "Note: $prefix/bin is not on your PATH." ;; esac

View file

@ -0,0 +1,39 @@
pkgbase = tunal-bin
pkgdesc = File manager with Material You styling, music tags, devices and SFTP
pkgver = 0.1.0
pkgrel = 1
url = https://archlinux.tail7c4f5e.ts.net/git/astar76/Tunal
arch = x86_64
license = GPL-3.0-or-later
license = Apache-2.0
depends = glibc>=2.43
depends = gcc-libs
depends = alsa-lib
depends = fontconfig
depends = libglvnd
depends = wayland
depends = libxkbcommon
depends = libxkbcommon-x11
depends = libx11
depends = libxcb
depends = libxcursor
depends = libxi
depends = libxrender
depends = xdg-utils
depends = hicolor-icon-theme
optdepends = polkit: administrator file operations
optdepends = xdg-desktop-portal: accent colour, dark mode and file pickers
optdepends = ffmpeg: video thumbnails
optdepends = 7zip: 7z and most other archives
optdepends = libarchive: tar archives
optdepends = zip: zip archives
optdepends = udisks2: USB drives and other disks
optdepends = usbmuxd: iOS devices
provides = tunal
conflicts = tunal
options = !strip
options = !debug
source = Tunal-0.1.0-Linux-x86_64.tar.gz::https://archlinux.tail7c4f5e.ts.net/git/astar76/Tunal/releases/download/v0.1.0/Tunal-0.1.0-Linux-x86_64.tar.gz
sha256sums = 67f85852d52f5b1ddce1206ef03aa8a056d7f2b01837a2d1f944453e900c1e8f
pkgname = tunal-bin

View file

@ -0,0 +1,37 @@
# Maintainer: astar76
# Built by tools/package.sh from the release tar.gz (TARBALL=file://… for an offline build); it keeps pkgver,
# sha256sums and the glibc floor current.
pkgname=tunal-bin
pkgver=0.1.0
pkgrel=1
pkgdesc='File manager with Material You styling, music tags, devices and SFTP'
arch=('x86_64')
url='https://archlinux.tail7c4f5e.ts.net/git/astar76/Tunal'
license=('GPL-3.0-or-later' 'Apache-2.0')
# Linked: libc, libm, libgcc_s, libasound, libfontconfig. dlopened (strings of the binary): libEGL/libGL (libglvnd), libwayland-client/-egl, libxkbcommon(-x11), libX11, libX11-xcb, libxcb, libXcursor, libXi, libXrender. Runs xdg-open.
depends=('glibc>=2.43' 'gcc-libs' 'alsa-lib' 'fontconfig' 'libglvnd' 'wayland' 'libxkbcommon' 'libxkbcommon-x11' 'libx11' 'libxcb' 'libxcursor' 'libxi' 'libxrender' 'xdg-utils' 'hicolor-icon-theme')
optdepends=(
'polkit: administrator file operations'
'xdg-desktop-portal: accent colour, dark mode and file pickers'
'ffmpeg: video thumbnails'
'7zip: 7z and most other archives'
'libarchive: tar archives'
'zip: zip archives'
'udisks2: USB drives and other disks'
'usbmuxd: iOS devices'
)
provides=('tunal')
conflicts=('tunal')
options=('!strip' '!debug')
source=("Tunal-$pkgver-Linux-x86_64.tar.gz::${TARBALL:-$url/releases/download/v$pkgver/Tunal-$pkgver-Linux-x86_64.tar.gz}")
sha256sums=('67f85852d52f5b1ddce1206ef03aa8a056d7f2b01837a2d1f944453e900c1e8f')
package() {
cd "$srcdir/tunal-$pkgver"
install -d "$pkgdir/usr"
for d in bin lib share; do [ ! -d "$d" ] || cp -R "$d" "$pkgdir/usr/"; done
if [ -d "$pkgdir/usr/share/licenses/tunal" ] && [ "$pkgname" != tunal ]; then
mv "$pkgdir/usr/share/licenses/tunal" "$pkgdir/usr/share/licenses/$pkgname"
fi
install -Dm644 README.md "$pkgdir/usr/share/doc/$pkgname/README.md"
}

88
tools/package.sh Executable file
View file

@ -0,0 +1,88 @@
#!/bin/bash
# Tunal release packages. Run: tools/package.sh (see the common part below for what it makes)
# packaging/arch/ stays the build-from-this-checkout PKGBUILD; packaging/arch-bin/ is the release package (tunal-bin).
set -euo pipefail
root=$(cd "$(dirname "$0")/.." && pwd)
APP=tunal NAME=Tunal DESKTOP=tunal.desktop PKGDIR=packaging/arch-bin
BINS=(tunal)
ver=$(sed -n 's/^version = "\(.*\)"/\1/p' "$root/Cargo.toml" | head -n 1)
build() { nice cargo build --release --locked -q -j 2 -p tunal; }
# share/ as it lands under the prefix. The polkit policy only works under /usr (the Arch package).
stage() {
local s=$1
install -Dm644 assets/tunal.desktop "$s/applications/tunal.desktop"
install -Dm644 assets/tunal.svg "$s/icons/hicolor/scalable/apps/tunal.svg"
install -Dm644 assets/tunal.png "$s/icons/hicolor/256x256/apps/tunal.png"
install -Dm644 assets/polkit/org.tunal.Tunal.elevated-helper.policy "$s/polkit-1/actions/org.tunal.Tunal.elevated-helper.policy"
install -Dm644 assets/fonts/LICENSE "$s/licenses/tunal/fonts-LICENSE"
}
# ---------------------------------------------------------------- common part (same in every project)
# Builds into dist/: $NAME-<v>-Linux-x86_64.tar.gz (install.sh, uninstall.sh), $NAME-<v>-x86_64.AppImage (GUI only),
# $NAME-<v>-arch-x86_64.pkg.tar.zst (makepkg from that tar.gz, offline) and SHA256SUMS-<v>.
# It also writes the tar.gz checksum and version into $PKGDIR/PKGBUILD and .SRCINFO, and the glibc floor read
# from the binary into installer.sh and the PKGBUILD. Nothing is downloaded: appimagetool comes from
# ~/Projects/Mulberry/dist and runs extracted (no FUSE, no runtime fetch). Never writes to releases/.
# SKIP_BUILD=1 packages the existing build. CARGO_TARGET_DIR is honoured.
cd "$root"; PKGDIR=${PKGDIR:-packaging/arch}
[ "${SKIP_BUILD:-}" = 1 ] || build
rel=${CARGO_TARGET_DIR:-$root/target}/release
out=$root/dist
work=$(mktemp -d); trap 'rm -rf "$work"' EXIT
export SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH:-$(git log -1 --format=%ct 2>/dev/null || date +%s)}
# glibc floor: the newest GLIBC_x.y symbol version any shipped binary (or EXTRA_ELF library) needs.
glibc=$(for b in "${BINS[@]}" ${EXTRA_ELF[@]+"${EXTRA_ELF[@]}"}; do objdump -T "$rel/$b"; done | grep -o 'GLIBC_[0-9.]*' | sed 's/GLIBC_//' | sort -uV | tail -n 1)
[ -n "$glibc" ] || { echo "could not read the glibc version from the binary" >&2; exit 1; }
sed -i "s/^app=$APP main=\([^ ]*\) need=.*/app=$APP main=\1 need=$glibc/; s/glibc [0-9.]* or newer\./glibc $glibc or newer./" installer.sh
sed -i "s/'glibc>=[0-9.]*'/'glibc>=$glibc'/" $PKGDIR/PKGBUILD
# tar.gz: bin/ and share/ laid out like a prefix, so installer.sh and the PKGBUILD just copy them.
rm -rf "$out"; mkdir -p "$out"
t=$work/$APP-$ver
mkdir -p "$t/bin" "$t/share" # stage may add $t/lib too
for b in "${BINS[@]}"; do install -m755 "$rel/$b" "$t/bin/$b"; done
stage "$t/share"
install -m755 installer.sh "$t/install.sh"
printf '#!/bin/sh\n# Removes %s installed by install.sh. --purge also deletes settings and data; --system or --prefix DIR as for install.sh.\nexec sh "$(dirname "$0")/install.sh" --uninstall "$@"\n' "$NAME" > "$t/uninstall.sh"
chmod 755 "$t/uninstall.sh"
cp README.md "$t/"
find "$t" -exec touch -h -d "@$SOURCE_DATE_EPOCH" {} +
tgz=$NAME-$ver-Linux-x86_64.tar.gz
tar -C "$work" --sort=name --owner=0 --group=0 --numeric-owner -cf - "$APP-$ver" | gzip -n -9 > "$out/$tgz"
# AppImage (GUI apps): the same tree under usr/, desktop file and icon at the top.
if [ -n "${DESKTOP:-}" ]; then
a=$work/AppDir
mkdir -p "$a/usr"
cp -R "$t/bin" "$t/share" "$a/usr/"; [ ! -d "$t/lib" ] || cp -R "$t/lib" "$a/usr/"
cp "$a/usr/share/applications/$DESKTOP" "$a/"
icon=$(sed -n 's/^Icon=//p' "$a/$DESKTOP" | head -n 1)
for ext in svg png; do
f=$(find "$a/usr/share/icons" -name "$icon.$ext" | sort -V | tail -n 1)
[ -n "$f" ] && { cp "$f" "$a/$icon.$ext"; break; }
done
cat > "$a/AppRun" <<RUN
#!/bin/sh
here=\$(dirname "\$(readlink -f "\$0")")
exec "\$here/usr/bin/${BINS[0]}" "\$@"
RUN
chmod +x "$a/AppRun"
if declare -F appdir_hook >/dev/null; then appdir_hook "$a"; fi # project extras (bundled libraries)
cp ~/Projects/Mulberry/dist/appimagetool "$work/appimagetool"
(cd "$work" && ./appimagetool --appimage-extract >/dev/null)
ARCH=x86_64 "$work/squashfs-root/AppRun" --no-appstream "$a" "$out/$NAME-$ver-x86_64.AppImage" >"$work/ait.log" 2>&1 \
|| { tail -20 "$work/ait.log"; exit 1; }
fi
# Arch package from the local tar.gz; the repo's PKGBUILD gets this version and checksum.
sum=$(sha256sum "$out/$tgz" | cut -d' ' -f1)
sed -i "s/^pkgver=.*/pkgver=$ver/; s/^sha256sums=.*/sha256sums=('$sum')/" $PKGDIR/PKGBUILD
mkdir "$work/arch"; cp $PKGDIR/PKGBUILD "$work/arch/"
(cd "$work/arch" && makepkg --printsrcinfo > "$root/$PKGDIR/.SRCINFO")
(cd "$work/arch" && TARBALL="file://$out/$tgz" makepkg -f -C --nodeps --noconfirm >"$work/makepkg.log" 2>&1) \
|| { tail -20 "$work/makepkg.log"; exit 1; }
cp "$work"/arch/"$APP"-bin-"$ver"-*-x86_64.pkg.tar.zst "$out/$NAME-$ver-arch-x86_64.pkg.tar.zst"
(cd "$out" && sha256sum "$NAME-$ver"-* > "SHA256SUMS-$ver")
echo "glibc floor: $glibc"
ls -l "$out"