#!/bin/bash # Download pre-compiled aarch64 libretro cores and package them as a tarball. set -e outdir="${1:-./artifacts}" cores_dir="$(mktemp -d)" trap 'rm -rf "$cores_dir"' 0 script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" base_url="https://raw.githubusercontent.com/christianhaitian/retroarch-cores/master/aarch64" target_dir="$cores_dir/home/emulation/.config/retroarch/cores" mkdir -p "$target_dir" while IFS= read -r core; do [ -z "$core" ] && continue [[ "$core" =~ ^# ]] && continue echo "Downloading $core..." if wget -q "$base_url/${core}.zip" -O "/tmp/${core}.zip" 2>/dev/null; then unzip -o -q "/tmp/${core}.zip" -d "$target_dir/" rm -f "/tmp/${core}.zip" else echo "Warning: Failed to download $core, skipping" fi done < "$script_dir/core-list.txt" tar cf "$outdir/cores.tar" -C "$cores_dir" . echo "Cores tarball created at $outdir/cores.tar"