Visual Studio Code, rebuilt in Rust
Rust
#!/bin/bash
# Makes an AppImage of a port/tools/package-linux folder, which is its AppDir as it is: the .desktop file and its icon
# at the top, AppRun a link to the binary (added in the image only, the folder stays the archive's). The folder goes in
# a squashfs behind AppImage's static type 2 runtime, which mounts it with FUSE and starts AppRun; it needs no libfuse
# on the user's system, only fusermount or fusermount3. It bundles no library: the system libraries are the archive's
# (port/notes.md milestone 23).
# Usage: port/tools/linux/appimage <folder> <executable> <file.AppImage>, on the folder's arch (package-linux runs it).
# Needs mksquashfs (squashfs-tools) and curl.
set -euo pipefail
dir=$1 executable=$2 out=$3
# AppImage/type2-runtime release 20251108, pinned by its SHA-256.
arch=$(uname -m)
case $arch in
x86_64) sum=2fca8b443c92510f1483a883f60061ad09b46b978b2631c807cd873a47ec260d ;;
aarch64) sum=00cbdfcf917cc6c0ff6d3347d59e0ca1f7f45a6df1a428a0d6d8a78664d87444 ;;
*) echo "appimage: no AppImage runtime for $arch" >&2; exit 1 ;;
esac
[[ -x $dir/$executable ]] || { echo "appimage: no executable $dir/$executable" >&2; exit 1; }
runtime=$(mktemp)
trap 'rm -f "$runtime" "$out.squashfs"' EXIT
curl -fsSL -o "$runtime" "https://github.com/AppImage/type2-runtime/releases/download/20251108/runtime-$arch"
echo "$sum $runtime" | sha256sum -c --quiet -
mksquashfs "$dir" "$out.squashfs" -root-owned -noappend -comp zstd -quiet -no-progress -p "AppRun s 755 0 0 $executable"
cat "$runtime" "$out.squashfs" >"$out"
chmod 755 "$out"