Files
MusicPlayer/linux/package.sh
T
Sansan 74fc28614f
Build / test (pull_request) Successful in 23s
Build / build (pull_request) Skipped
New app icon, packaged with a menu entry for Linux
The icon is a plate wearing headphones with a red Nordic house cookie
on it. It replaces the default Godot icon, so the game window, Windows
and macOS builds use it.

Linux programs can't carry their own icon, so the build now also makes
MusicPlayer_<version>_linux.tar.gz with the game, the icon as a PNG, a
.desktop menu entry and install.sh, which installs them for the current
user. The bare Linux binary is still published.
2026-10-05 22:48:25 +02:00

36 lines
1.3 KiB
Bash
Executable File

#!/usr/bin/env bash
# Packages an exported Linux build with its icon, app menu entry and install script.
#
# Usage: linux/package.sh <exported binary> <version> <output dir>
# Creates <output dir>/MusicPlayer_<version>_linux.tar.gz. Godot is taken from $GODOT,
# or `godot` on PATH, to render the icon.
set -euo pipefail
if [[ $# -ne 3 ]]; then
echo "Usage: $0 <exported binary> <version> <output dir>" >&2
exit 1
fi
binary="$(cd "$(dirname "$1")" && pwd)/$(basename "$1")"
version="$2"
out_dir="$(mkdir -p "$3" && cd "$3" && pwd)"
linux_dir="$(cd "$(dirname "$0")" && pwd)"
project_dir="$(dirname "$linux_dir")"
godot_bin="${GODOT:-godot}"
staging="$(mktemp -d)"
trap 'rm -rf "$staging"' EXIT
package_dir="$staging/MusicPlayer"
mkdir -p "$package_dir"
install -m755 "$binary" "$package_dir/MusicPlayer.x86_64"
install -m755 "$linux_dir/install.sh" "$package_dir/install.sh"
install -m644 "$linux_dir/music-player-randomizer.desktop" "$package_dir/"
# Run outside the project so Godot only renders the icon
(cd "$staging" && "$godot_bin" --headless -s "$linux_dir/render_icon.gd" -- \
"$project_dir/icon.svg" "$package_dir/music-player-randomizer.png" 256)
archive="$out_dir/MusicPlayer_${version}_linux.tar.gz"
tar -czf "$archive" -C "$staging" MusicPlayer
echo "Created $archive"