- packaging/stockfish.sh fetches the pinned official universal build (SHA-256 checked) for Linux and Windows and the source archive for the release. - deb/rpm/Arch, AppImage, Flatpak, tarball and Windows zip ship it unmodified (AppImage: added after linuxdeploy, packed with appimagetool). - The app resolves the built-in engine at run time (EngineConfig::builtin), adds it on first start (or a system stockfish), and offers engines found on the computer in Settings > Engines. - install.sh installs Stockfish into ~/.local/lib/chesspenguin. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
51 lines
2 KiB
Bash
Executable file
51 lines
2 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# Installs ChessPenguin for the current user (~/.local), or removes it with --uninstall.
|
|
# Stockfish is downloaded into ~/.local/lib/chesspenguin once (skip with --no-stockfish).
|
|
set -euo pipefail
|
|
|
|
app_id="io.github.vrubelroman.chessPenguin"
|
|
root="$(cd "$(dirname "$0")/.." && pwd)"
|
|
bin_dir="${HOME}/.local/bin"
|
|
lib_dir="${HOME}/.local/lib/chesspenguin"
|
|
data_dir="${XDG_DATA_HOME:-${HOME}/.local/share}"
|
|
apps_dir="${data_dir}/applications"
|
|
icons_dir="${data_dir}/icons/hicolor"
|
|
sizes=(16 24 32 48 64 128 256 512)
|
|
|
|
refresh_caches() {
|
|
command -v update-desktop-database >/dev/null && update-desktop-database -q "${apps_dir}" || true
|
|
command -v gtk-update-icon-cache >/dev/null && gtk-update-icon-cache -q -t "${icons_dir}" || true
|
|
}
|
|
|
|
remove_files() {
|
|
# Current names and the pre-rename development build (chessbase-linux).
|
|
for name in "${app_id}" chessbase-linux; do
|
|
rm -f "${apps_dir}/${name}.desktop"
|
|
for s in "${sizes[@]}"; do rm -f "${icons_dir}/${s}x${s}/apps/${name}.png"; done
|
|
done
|
|
rm -f "${bin_dir}/chesspenguin" "${bin_dir}/chessbase-linux"
|
|
}
|
|
|
|
if [[ "${1:-}" == "--uninstall" ]]; then
|
|
remove_files
|
|
rm -rf "${lib_dir}"
|
|
refresh_caches
|
|
echo "ChessPenguin removed (settings in ~/.config/chesspenguin are kept)."
|
|
exit 0
|
|
fi
|
|
|
|
cargo="${CARGO:-$(command -v cargo || echo "${HOME}/.cargo/bin/cargo")}"
|
|
"${cargo}" build --release -p chesspenguin --manifest-path "${root}/Cargo.toml"
|
|
|
|
remove_files
|
|
install -Dm755 "${root}/target/release/chesspenguin" "${bin_dir}/chesspenguin"
|
|
install -Dm644 "${root}/packaging/${app_id}.desktop" "${apps_dir}/${app_id}.desktop"
|
|
for s in "${sizes[@]}"; do
|
|
install -Dm644 "${root}/packaging/icons/hicolor/${s}x${s}/apps/${app_id}.png" \
|
|
"${icons_dir}/${s}x${s}/apps/${app_id}.png"
|
|
done
|
|
if [[ "${1:-}" != "--no-stockfish" && ! -x "${lib_dir}/stockfish" ]]; then
|
|
"${root}/packaging/stockfish.sh" linux "${lib_dir}"
|
|
fi
|
|
refresh_caches
|
|
echo "Installed: ${bin_dir}/chesspenguin (launcher entry «ChessPenguin»)."
|