From ca30fff45b8844c56ef62902a79df9865272cc34 Mon Sep 17 00:00:00 2001 From: mcarans Date: Fri, 7 Aug 2026 12:01:38 +1200 Subject: [PATCH 1/8] Move appimage tool downloading to install_packages_root like gitversion --- .github/workflows/build-all.yaml | 2 +- .github/workflows/test_builds.yaml | 6 +- ShellScripts/Linux/install_gitversion_fn.sh | 12 +- ShellScripts/Linux/install_packages_root.sh | 179 +++++++++--------- ShellScripts/common/download_fn.sh | 36 ++++ .../common/download_github_release_fn.sh | 19 +- installers/appimage/create_appimage_fn.sh | 32 +--- 7 files changed, 160 insertions(+), 126 deletions(-) create mode 100644 ShellScripts/common/download_fn.sh diff --git a/.github/workflows/build-all.yaml b/.github/workflows/build-all.yaml index 3a79ac3ef..384aa8e14 100644 --- a/.github/workflows/build-all.yaml +++ b/.github/workflows/build-all.yaml @@ -47,7 +47,7 @@ jobs: fetch-depth: 0 - name: Install packages run: | - ShellScripts/Linux/install_packages_root.sh + ShellScripts/Linux/install_packages_root.sh --core+appimage - name: Build GNUstep run: | ShellScripts/Linux/build_gnustep.sh system diff --git a/.github/workflows/test_builds.yaml b/.github/workflows/test_builds.yaml index 43bd7d77c..9f0621848 100644 --- a/.github/workflows/test_builds.yaml +++ b/.github/workflows/test_builds.yaml @@ -38,7 +38,7 @@ jobs: fetch-depth: 0 - name: Install packages run: | - ShellScripts/Linux/install_packages_root.sh + ShellScripts/Linux/install_packages_root.sh --core+appimage - name: Build GNUstep run: | ShellScripts/Linux/build_gnustep.sh system @@ -87,7 +87,7 @@ jobs: fetch-depth: 0 - name: Install packages run: | - ShellScripts/Linux/install_packages_root.sh + ShellScripts/Linux/install_packages_root.sh --core+appimage - name: Build GNUstep run: | ShellScripts/Linux/build_gnustep.sh system @@ -136,7 +136,7 @@ jobs: fetch-depth: 0 - name: Install packages run: | - ShellScripts/Linux/install_packages_root.sh + ShellScripts/Linux/install_packages_root.sh --core+appimage - name: Build GNUstep run: | ShellScripts/Linux/build_gnustep.sh system diff --git a/ShellScripts/Linux/install_gitversion_fn.sh b/ShellScripts/Linux/install_gitversion_fn.sh index 62d761cb2..e6b3a7268 100644 --- a/ShellScripts/Linux/install_gitversion_fn.sh +++ b/ShellScripts/Linux/install_gitversion_fn.sh @@ -13,10 +13,16 @@ install_gitversion() { source ../common/download_github_release_fn.sh local gitversion_tgz - download_github_release gitversion_tgz "GitTools" "GitVersion" "linux-x64" "$outputdir" - tar xfz ${gitversion_tgz} --directory "$outputdir" + download_github_release gitversion_tgz "GitTools" "GitVersion" "linux-x64" "$outputdir" || { popd > /dev/null; return 1; } + if ! tar xfz ${gitversion_tgz} --directory "$outputdir"; then + echo "❌ Could not unpack gitversion tgz!" >&2 + return 1 + fi chmod +x "$outputdir/gitversion" - mv "$outputdir/gitversion" /usr/local/bin/gitversion + if ! mv "$outputdir/gitversion" /usr/local/bin/gitversion; then + echo "❌ Could not move gitversion to /usr/local/bin!" >&2 + return 1 + fi rm -f ${gitversion_tgz} popd diff --git a/ShellScripts/Linux/install_packages_root.sh b/ShellScripts/Linux/install_packages_root.sh index 6f2274931..f541230fd 100755 --- a/ShellScripts/Linux/install_packages_root.sh +++ b/ShellScripts/Linux/install_packages_root.sh @@ -1,8 +1,6 @@ -#!/bin/bash +#!/bin/bash -e # This script must be run as root (for example with sudo). -set -e - run_script() { # If current user ID is NOT 0 (root) @@ -11,99 +9,108 @@ run_script() { return 1 fi - local script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd) - pushd "$script_dir" - - source install_gitversion_fn.sh - source install_package_fn.sh + # Initialize local flags with defaults + local INSTALL_CORE=true + local INSTALL_APPIMAGE=false + local INSTALL_FLATPAK=false + local SCRIPT_DIR + local pkgs + local pkg + local LIB_PARAM + local BIN + local LINTER_BIN + local EXCLUDE_LIST - if ! install_package procps; then - return 1 - fi - if ! install_package base-devel; then - return 1 - fi - if ! install_package clang; then - return 1 + # Parse Command Line Arguments + if [[ "$#" -gt 0 ]]; then + INSTALL_CORE=false fi - if ! install_package cmake; then - return 1 - fi - if ! install_package jq; then - return 1 - fi - if ! install_package meson; then - return 1 - fi - if ! install_package gnutls-dev; then - return 1 + + while [[ "$#" -gt 0 ]]; do + case $1 in + --appimage) INSTALL_APPIMAGE=true ;; + --flatpak) INSTALL_FLATPAK=true ;; + --core) INSTALL_CORE=true ;; + --core+appimage|--core-appimage) + INSTALL_CORE=true + INSTALL_APPIMAGE=true + ;; + --core+flatpak|--core-flatpak) + INSTALL_CORE=true + INSTALL_FLATPAK=true + ;; + --all) + INSTALL_CORE=true + INSTALL_APPIMAGE=true + INSTALL_FLATPAK=true + ;; + -h|--help) + echo "Usage: ./install_deps_root.sh [options]" + echo "Options:" + echo " --core Install only base build dependencies (default if no args)" + echo " --appimage Install only AppImage tools" + echo " --flatpak Install only Flatpak tools" + echo " --core+appimage Install base build dependencies + AppImage tools" + echo " --core+flatpak Install base build dependencies + Flatpak tools" + echo " --all Install everything" + exit 0 + ;; + *) echo "Unknown parameter: $1"; exit 1 ;; + esac + shift + done + + if [[ "$INSTALL_CORE" == false && "$INSTALL_APPIMAGE" == false && "$INSTALL_FLATPAK" == false ]]; then + INSTALL_CORE=true fi - # Check Python - if ! python3 --version >/dev/null 2>&1; then - if ! install_package python; then - return 1 + + local script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd) + pushd "$script_dir" > /dev/null + + source ./install_package_fn.sh + source ../common/download_fn.sh + source ./install_gitversion_fn.sh + + local outputdir="../../build" + mkdir -p "$outputdir" + + if [[ "$INSTALL_CORE" == true ]]; then # Core dependencies + echo "📦 Installing Core Build Dependencies..." + pkgs=( + procps base-devel clang cmake jq meson gnutls-dev icu-dev ffi-dev xslt-dev png-dev zlib-dev nspr-dev + espeak-ng-dev vorbis-dev openal-dev opengl-dev glu-dev sdl3 x11-dev + ) + for pkg in "${pkgs[@]}"; do + install_package "$pkg" + done + if ! python3 --version >/dev/null 2>&1; then # Check Python + install_package python fi - fi - if ! install_package icu-dev; then - return 1 - fi - if ! install_package ffi-dev; then - return 1 - fi - if ! install_package xslt-dev; then - return 1 - fi - if ! install_package png-dev; then - return 1 - fi - if ! install_package zlib-dev; then - return 1 - fi - if ! install_package nspr-dev; then - return 1 - fi - if ! install_package espeak-ng-dev; then - return 1 - fi - if [ ! -d /usr/share/espeak-ng-data ]; then - if [ ! -d /usr/local/share/espeak-ng-data ]; then - if [ ! -d /usr/lib/x86_64-linux-gnu/espeak-ng-data ]; then - echo "❌ espeak-ng-data not in /usr/share, /usr/local/share or /usr/lib/x86_64-linux-gnu!" - return 1 + install_gitversion "$outputdir" + if [ ! -d /usr/share/espeak-ng-data ]; then + if [ ! -d /usr/local/share/espeak-ng-data ]; then + if [ ! -d /usr/lib/x86_64-linux-gnu/espeak-ng-data ]; then + echo "❌ espeak-ng-data not in /usr/share, /usr/local/share or /usr/lib/x86_64-linux-gnu!" + return 1 + fi fi fi fi - if ! install_package vorbis-dev; then - return 1 - fi - if ! install_package openal-dev; then - return 1 - fi - if ! install_package opengl-dev; then - return 1 - fi - if ! install_package glu-dev; then - return 1 - fi - if ! install_package sdl3; then - return 1 - fi - if ! install_package x11-dev; then - return 1 - fi - # For building AppImage - if ! install_package appimage; then - return 1 + + if [[ "$INSTALL_APPIMAGE" == true ]]; then # For building AppImage + echo "📦 Installing AppImage Tools..." + install_package appimage + BIN="/usr/local/bin" + download "https://raw.githubusercontent.com/pkgforge-dev/Anylinux-AppImages/refs/heads/main/useful-tools/quick-sharun.sh" "$BIN" "+x" + download "https://raw.githubusercontent.com/AppImage/AppImages/master/appdir-lint.sh" "$BIN" "+x" + download "https://raw.githubusercontent.com/AppImage/AppImages/master/excludelist" "$BIN" + download "https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-$(uname -m).AppImage" "$BIN" "+x" fi - # For building Flatpak - if ! install_package flatpak; then - return 1 + + if [[ "$INSTALL_FLATPAK" == true ]]; then # For building Flatpak + install_package flatpak fi - # install gitversion - local outputdir="../../build" - mkdir -p "$outputdir" - install_gitversion "$outputdir" popd } diff --git a/ShellScripts/common/download_fn.sh b/ShellScripts/common/download_fn.sh new file mode 100644 index 000000000..0640839a9 --- /dev/null +++ b/ShellScripts/common/download_fn.sh @@ -0,0 +1,36 @@ +# Usage: download ["+x"] +download() { + local download_url="$1" + local outputdir="$2" + local make_exec="${3:-}" + + local filename=$(basename "${download_url}") + local dest="$outputdir/$filename" + # Determine if we need to download + local need_download=0 + if [[ "$make_exec" == "+x" ]]; then + [[ ! -x "$dest" ]] && need_download=1 + else + [[ ! -f "$dest" ]] && need_download=1 + fi + + # Download if missing/not executable + if [[ "$need_download" -eq 1 ]]; then + echo "📥 Downloading $filename..." + + # Ensure target directory exists + mkdir -p "$outputdir" + + # -f: fail on HTTP errors (e.g. 404) + # -sS: silent mode, but show error if it fails + # -L: follow redirects + if ! curl -fsSL -O --output-dir "${outputdir}" "$download_url"; then + echo "❌ Error downloading $filename from $download_url!" >&2 + return 1 + fi + + if [[ "$make_exec" == "+x" ]]; then + chmod +x "$dest" + fi + fi +} \ No newline at end of file diff --git a/ShellScripts/common/download_github_release_fn.sh b/ShellScripts/common/download_github_release_fn.sh index 7abe8c69f..026555153 100755 --- a/ShellScripts/common/download_github_release_fn.sh +++ b/ShellScripts/common/download_github_release_fn.sh @@ -9,13 +9,19 @@ download_github_release() { local repo="${owner}/${repository}" local api_url="https://api.github.com/repos/${repo}/releases/latest" - + + local script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd) + pushd "$script_dir" > /dev/null + + source ./download_fn.sh + echo "Fetching latest release info for ${repo}..." >&2 local release_json=$(curl -s "${api_url}") # Check if the repository was found/has releases if echo "${release_json}" | grep -q "Not Found"; then echo "❌ Repository not found or has no public releases at ${api_url}!" >&2 + popd return 1 fi @@ -30,14 +36,17 @@ download_github_release() { # Check if a URL was actually found if [[ -z "${download_url}" || "${download_url}" == "null" ]]; then echo "❌ Could not find a matching download URL!" >&2 + popd + return 1 + fi + + if ! download "${outputdir}" "${download_url}"; then + popd return 1 fi # Extract filename from the URL local filename=$(basename "${download_url}") - - echo "Downloading latest release: ${filename}..." >&2 - curl -L -O --output-dir "${outputdir}" "${download_url}" - _downloaded_file="${outputdir}/${filename}" + popd } \ No newline at end of file diff --git a/installers/appimage/create_appimage_fn.sh b/installers/appimage/create_appimage_fn.sh index d5ea52315..dad4a85ae 100755 --- a/installers/appimage/create_appimage_fn.sh +++ b/installers/appimage/create_appimage_fn.sh @@ -1,4 +1,4 @@ -#!/bin/bash -x +#!/bin/bash -ex # # Creates the appimage. @@ -9,7 +9,6 @@ create_appimage() { local script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd) pushd "$script_dir" source ../FreeDesktop/install_freedesktop_fn.sh - source ../../ShellScripts/Linux/os_detection.sh cd ../../build/appimage local arch=$(uname -m) @@ -22,13 +21,6 @@ create_appimage() { return 1 fi - local sharun_bin="./quick-sharun" - if [[ ! -x "$sharun_bin" ]]; then - echo "📥 quick-sharun not found or not executable. Downloading..." - curl -o "$sharun_bin" -L https://raw.githubusercontent.com/pkgforge-dev/Anylinux-AppImages/refs/heads/main/useful-tools/quick-sharun.sh || { echo "❌ Download failed" >&2; exit 1; } - chmod +x "$sharun_bin" - fi - local icon_filename="space.oolite.Oolite.png" local icon_subpath="icons/hicolor/256x256/apps/$icon_filename" local ICON="$appshr/$icon_subpath" @@ -51,34 +43,18 @@ create_appimage() { # install_metadatainfo_fn already put the files in the parameters below in the right place, # but no harm putting again here - if ! $sharun_bin "$appbin/oolite"; then + if ! quick-sharun.sh "$appbin/oolite"; then echo "❌ AppDir generation failed!" >&2 return 1 fi - local linter_bin="./appdir-lint.sh" - local exclude_list="./excludelist" - - if [[ ! -x "$linter_bin" ]] || [[ ! -f "$exclude_list" ]]; then - echo "📥 Downloading AppDir linter and excludelist..." - curl -o "$linter_bin" -L https://raw.githubusercontent.com/AppImage/AppImages/master/appdir-lint.sh || { echo "❌ Linter download failed" >&2; return 1; } - curl -o "$exclude_list" -L https://raw.githubusercontent.com/AppImage/AppImages/master/excludelist || { echo "❌ Excludelist download failed" >&2; return 1; } - chmod +x "$linter_bin" - fi - echo "🔍 Running AppDir linter..." - if ! "$linter_bin" "$APPDIR"; then + if ! appdir-lint.sh "$APPDIR"; then echo "❌ AppDir linting failed!" >&2 return 1 fi - appimagetool_bin="./appimagetool" - if [ ! -x "$appimagetool_bin" ]; then - echo "📥 appimagetool not found. Downloading..." - curl -o "$appimagetool_bin" -L https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-$arch.AppImage || { echo "❌ appimagetool download failed" >&2; return 1; } - chmod +x "$appimagetool_bin" - fi - + appimagetool_bin="appimagetool-$arch.AppImage" echo "Creating AppImage $OUTNAME..." if ! $appimagetool_bin "$APPDIR" "../$OUTNAME"; then echo "❌ AppImage creation failed!" >&2 From 8ede95d022b4bcc162a66a31a85b4b01eb856d62 Mon Sep 17 00:00:00 2001 From: mcarans Date: Fri, 7 Aug 2026 12:16:27 +1200 Subject: [PATCH 2/8] fix parameter order error --- ShellScripts/common/download_github_release_fn.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ShellScripts/common/download_github_release_fn.sh b/ShellScripts/common/download_github_release_fn.sh index 026555153..a07b0f6db 100755 --- a/ShellScripts/common/download_github_release_fn.sh +++ b/ShellScripts/common/download_github_release_fn.sh @@ -40,7 +40,7 @@ download_github_release() { return 1 fi - if ! download "${outputdir}" "${download_url}"; then + if ! download "${download_url}" "${outputdir}"; then popd return 1 fi From 079b94913541902131feda2a0f10edb8160b4931 Mon Sep 17 00:00:00 2001 From: mcarans Date: Fri, 7 Aug 2026 13:49:10 +1200 Subject: [PATCH 3/8] More logging --- ShellScripts/Linux/install_gitversion_fn.sh | 2 +- ShellScripts/Windows/install_deps.sh | 22 +++------------------ installers/appimage/create_appimage_fn.sh | 4 +++- 3 files changed, 7 insertions(+), 21 deletions(-) diff --git a/ShellScripts/Linux/install_gitversion_fn.sh b/ShellScripts/Linux/install_gitversion_fn.sh index e6b3a7268..3f7c5412f 100644 --- a/ShellScripts/Linux/install_gitversion_fn.sh +++ b/ShellScripts/Linux/install_gitversion_fn.sh @@ -13,7 +13,7 @@ install_gitversion() { source ../common/download_github_release_fn.sh local gitversion_tgz - download_github_release gitversion_tgz "GitTools" "GitVersion" "linux-x64" "$outputdir" || { popd > /dev/null; return 1; } + download_github_release gitversion_tgz "GitTools" "GitVersion" "linux-x64" "$outputdir" if ! tar xfz ${gitversion_tgz} --directory "$outputdir"; then echo "❌ Could not unpack gitversion tgz!" >&2 return 1 diff --git a/ShellScripts/Windows/install_deps.sh b/ShellScripts/Windows/install_deps.sh index f9cc4677b..b82a9aae2 100755 --- a/ShellScripts/Windows/install_deps.sh +++ b/ShellScripts/Windows/install_deps.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -e # No parameters: build clang only # One parameter gcc = build gcc only @@ -40,24 +40,8 @@ run_script() { local oolite_deps_url="https://api.github.com/repos/OoliteProject/oolite_windeps_build/releases/latest" pacman -Syu --noconfirm - pacman -S git --noconfirm - pacman -S dos2unix --noconfirm - pacman -S pactoys --noconfirm - pacboy -S binutils --noconfirm - pacboy -S jq --noconfirm - pacman -S unzip --noconfirm - pacboy -S python-pip --noconfirm - pacboy -S meson --noconfirm - pacboy -S ninja --noconfirm - pacboy -S nsis --noconfirm - pacboy -S libpng --noconfirm - pacboy -S openal --noconfirm - pacboy -S libvorbis --noconfirm - pacboy -S pcaudiolib --noconfirm - pacboy -S espeak-ng --noconfirm - pacboy -S mesa --noconfirm - pacboy -S sdl3 --noconfirm - + pacman -S --noconfirm dos2unix git pactoys unzip + pacboy -S --noconfirm binutils espeak-ng jq libpng libvorbis mesa meson ninja nsis openal pcaudiolib python-pip sdl3 mkdir -p ../../build/packages cd ../../build # install gitversion diff --git a/installers/appimage/create_appimage_fn.sh b/installers/appimage/create_appimage_fn.sh index dad4a85ae..21d1097b6 100755 --- a/installers/appimage/create_appimage_fn.sh +++ b/installers/appimage/create_appimage_fn.sh @@ -1,4 +1,6 @@ -#!/bin/bash -ex +#!/bin/bash +set -x + # # Creates the appimage. From e6086c137ac87076f72b722acb466aa9a93d1f4a Mon Sep 17 00:00:00 2001 From: mcarans Date: Fri, 7 Aug 2026 14:40:40 +1200 Subject: [PATCH 4/8] More logging --- installers/appimage/create_appimage_fn.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/installers/appimage/create_appimage_fn.sh b/installers/appimage/create_appimage_fn.sh index 21d1097b6..fb886778d 100755 --- a/installers/appimage/create_appimage_fn.sh +++ b/installers/appimage/create_appimage_fn.sh @@ -1,5 +1,4 @@ #!/bin/bash -set -x # # Creates the appimage. @@ -51,7 +50,7 @@ create_appimage() { fi echo "🔍 Running AppDir linter..." - if ! appdir-lint.sh "$APPDIR"; then + if ! bash -x "$(command -v appdir-lint.sh)" "$APPDIR"; then echo "❌ AppDir linting failed!" >&2 return 1 fi From 39fcfc7f8739b7ea587c18c2ddf6cfcf8b71d4f7 Mon Sep 17 00:00:00 2001 From: mcarans Date: Fri, 7 Aug 2026 15:00:38 +1200 Subject: [PATCH 5/8] Add missing package for Ubuntu --- ShellScripts/Linux/install_package_fn.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ShellScripts/Linux/install_package_fn.sh b/ShellScripts/Linux/install_package_fn.sh index 389da4f15..0f2fb6b7c 100644 --- a/ShellScripts/Linux/install_package_fn.sh +++ b/ShellScripts/Linux/install_package_fn.sh @@ -144,7 +144,7 @@ install_package() { "appimage") case "$CURRENT_DISTRO" in - debian) pkg_name="file fuse3 patchelf" ;; + debian) pkg_name="file fuse3 patchelf desktop-file-utils" ;; redhat) pkg_name="file fuse3 desktop-file-utils patchelf which zsync" ;; arch) pkg_name="file fuse3 desktop-file-utils patchelf zsync" ;; esac ;; From 1e80099c32d027a874fd23a3c2d42b9cf08dc5d9 Mon Sep 17 00:00:00 2001 From: mcarans Date: Fri, 7 Aug 2026 15:42:01 +1200 Subject: [PATCH 6/8] Fix GITHUB_TOKEN --- .github/workflows/build-all.yaml | 18 +++------ .github/workflows/test_builds.yaml | 24 ++++-------- installers/flatpak/create_flatpak_fn.sh | 50 ++++++++++++------------- 3 files changed, 39 insertions(+), 53 deletions(-) diff --git a/.github/workflows/build-all.yaml b/.github/workflows/build-all.yaml index 384aa8e14..308190754 100644 --- a/.github/workflows/build-all.yaml +++ b/.github/workflows/build-all.yaml @@ -37,10 +37,8 @@ jobs: # This must run before the checkout action if the action tries to do git commands mkdir -p "$GITHUB_WORKSPACE" git config --global --add safe.directory "$GITHUB_WORKSPACE" - cat << EOF >> ~/.curlrc - header = "Authorization: Bearer $GITHUB_TOKEN" - header = "Accept: application/vnd.github+json" - EOF + echo 'header = "Authorization: Bearer '$GITHUB_TOKEN'"' >> ~/.curlrc + echo 'header = "Accept: application/vnd.github+json"' >> ~/.curlrc - name: Checkout Oolite uses: actions/checkout@v6 with: @@ -83,10 +81,8 @@ jobs: # This must run before the checkout action if the action tries to do git commands mkdir -p "$GITHUB_WORKSPACE" git config --global --add safe.directory "$GITHUB_WORKSPACE" - cat << EOF >> ~/.curlrc - header = "Authorization: Bearer $GITHUB_TOKEN" - header = "Accept: application/vnd.github+json" - EOF + echo 'header = "Authorization: Bearer '$GITHUB_TOKEN'"' >> ~/.curlrc + echo 'header = "Accept: application/vnd.github+json"' >> ~/.curlrc - name: Checkout Oolite uses: actions/checkout@v6 with: @@ -137,10 +133,8 @@ jobs: msystem: UCRT64 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - cat << EOF > ~/.curlrc - header = "Authorization: Bearer $GITHUB_TOKEN" - header = "Accept: application/vnd.github+json" - EOF + echo 'header = "Authorization: Bearer '$GITHUB_TOKEN'"' >> ~/.curlrc + echo 'header = "Accept: application/vnd.github+json"' >> ~/.curlrc cp ~/.curlrc /c/Users/runneradmin/.curlrc 2>/dev/null || true ShellScripts/Windows/install_deps.sh clang - name: Build Oolite diff --git a/.github/workflows/test_builds.yaml b/.github/workflows/test_builds.yaml index 9f0621848..2d2bff7a2 100644 --- a/.github/workflows/test_builds.yaml +++ b/.github/workflows/test_builds.yaml @@ -29,10 +29,8 @@ jobs: # This must run before the checkout action if the action tries to do git commands mkdir -p "$GITHUB_WORKSPACE" git config --global --add safe.directory "$GITHUB_WORKSPACE" - cat << EOF >> ~/.curlrc - header = "Authorization: Bearer $GITHUB_TOKEN" - header = "Accept: application/vnd.github+json" - EOF + echo 'header = "Authorization: Bearer '$GITHUB_TOKEN'"' >> ~/.curlrc + echo 'header = "Accept: application/vnd.github+json"' >> ~/.curlrc - uses: actions/checkout@v6 with: fetch-depth: 0 @@ -78,10 +76,8 @@ jobs: # This must run before the checkout action if the action tries to do git commands mkdir -p "$GITHUB_WORKSPACE" git config --global --add safe.directory "$GITHUB_WORKSPACE" - cat << EOF >> ~/.curlrc - header = "Authorization: Bearer $GITHUB_TOKEN" - header = "Accept: application/vnd.github+json" - EOF + echo 'header = "Authorization: Bearer '$GITHUB_TOKEN'"' >> ~/.curlrc + echo 'header = "Accept: application/vnd.github+json"' >> ~/.curlrc - uses: actions/checkout@v6 with: fetch-depth: 0 @@ -127,10 +123,8 @@ jobs: # This must run before the checkout action if the action tries to do git commands mkdir -p "$GITHUB_WORKSPACE" git config --global --add safe.directory "$GITHUB_WORKSPACE" - cat << EOF >> ~/.curlrc - header = "Authorization: Bearer $GITHUB_TOKEN" - header = "Accept: application/vnd.github+json" - EOF + echo 'header = "Authorization: Bearer '$GITHUB_TOKEN'"' >> ~/.curlrc + echo 'header = "Accept: application/vnd.github+json"' >> ~/.curlrc - uses: actions/checkout@v6 with: fetch-depth: 0 @@ -182,10 +176,8 @@ jobs: msystem: UCRT64 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - cat << EOF > ~/.curlrc - header = "Authorization: Bearer $GITHUB_TOKEN" - header = "Accept: application/vnd.github+json" - EOF + echo 'header = "Authorization: Bearer '$GITHUB_TOKEN'"' >> ~/.curlrc + echo 'header = "Accept: application/vnd.github+json"' >> ~/.curlrc cp ~/.curlrc /c/Users/runneradmin/.curlrc 2>/dev/null || true ShellScripts/Windows/install_deps.sh clang diff --git a/installers/flatpak/create_flatpak_fn.sh b/installers/flatpak/create_flatpak_fn.sh index c9f1bd68c..bd8c0fc4a 100755 --- a/installers/flatpak/create_flatpak_fn.sh +++ b/installers/flatpak/create_flatpak_fn.sh @@ -30,31 +30,31 @@ create_flatpak() { fi tail -n 12 $manifest -# local lint_exceptions=$(mktemp /tmp/oolite-lint-XXXXXX.json) -# cat < "$lint_exceptions" -#{ -# "space.oolite.Oolite": [ -# "finish-args-has-dev-input" -# ] -#} -#EOF -# trap 'rm -f "$lint_exceptions"' RETURN EXIT -# if command -v flatpak-builder-lint >/dev/null 2>&1; then # check manifest -# if ! flatpak-builder-lint manifest "$manifest" --exceptions --user-exceptions="$lint_exceptions"; then -# echo "❌ Flatpak manifest lint failed!" >&2 -# cat "$manifest" -# echo "❌ Flatpak manifest lint failed!" >&2 -# return 1 -# fi -# else -# echo "Native linter not found. Falling back to Flatpak container..." -# if ! flatpak run --filesystem="$lint_exceptions" --command=flatpak-builder-lint org.flatpak.Builder manifest "$manifest" --exceptions --user-exceptions="$lint_exceptions"; then -# echo "❌ Flatpak manifest lint failed!" >&2 -# return 1 -# fi -# fi -# rm -f "$lint_exceptions" # Clean up -# trap - RETURN EXIT + local lint_exceptions=$(mktemp /tmp/oolite-lint-XXXXXX.json) + cat < "$lint_exceptions" +{ + "space.oolite.Oolite": [ + "finish-args-has-dev-input" + ] +} +EOF + trap 'rm -f "$lint_exceptions"' RETURN EXIT + if command -v flatpak-builder-lint >/dev/null 2>&1; then # check manifest + if ! flatpak-builder-lint manifest "$manifest" --exceptions --user-exceptions="$lint_exceptions"; then + echo "❌ Flatpak manifest lint failed!" >&2 + cat "$manifest" + echo "❌ Flatpak manifest lint failed!" >&2 + return 1 + fi + else + echo "Native linter not found. Falling back to Flatpak container..." + if ! flatpak run --filesystem="$lint_exceptions" --command=flatpak-builder-lint org.flatpak.Builder manifest "$manifest" --exceptions --user-exceptions="$lint_exceptions"; then + echo "❌ Flatpak manifest lint failed!" >&2 + return 1 + fi + fi + rm -f "$lint_exceptions" # Clean up + trap - RETURN EXIT echo "Creating Flatpak..." if ! flatpak remote-add \ From ed9eec9e3fa3385b9a9b0075c793022cfa0f25e1 Mon Sep 17 00:00:00 2001 From: mcarans Date: Fri, 7 Aug 2026 15:58:26 +1200 Subject: [PATCH 7/8] No pushd popd --- ShellScripts/Linux/install_gitversion_fn.sh | 6 +----- ShellScripts/common/download_github_release_fn.sh | 8 +------- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/ShellScripts/Linux/install_gitversion_fn.sh b/ShellScripts/Linux/install_gitversion_fn.sh index 3f7c5412f..fe7c84613 100644 --- a/ShellScripts/Linux/install_gitversion_fn.sh +++ b/ShellScripts/Linux/install_gitversion_fn.sh @@ -8,9 +8,7 @@ install_gitversion() { fi local script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd) - pushd "$script_dir" - - source ../common/download_github_release_fn.sh + source "$script_dir/../common/download_github_release_fn.sh" local gitversion_tgz download_github_release gitversion_tgz "GitTools" "GitVersion" "linux-x64" "$outputdir" @@ -24,6 +22,4 @@ install_gitversion() { return 1 fi rm -f ${gitversion_tgz} - - popd } \ No newline at end of file diff --git a/ShellScripts/common/download_github_release_fn.sh b/ShellScripts/common/download_github_release_fn.sh index a07b0f6db..aac91fd74 100755 --- a/ShellScripts/common/download_github_release_fn.sh +++ b/ShellScripts/common/download_github_release_fn.sh @@ -11,9 +11,7 @@ download_github_release() { local api_url="https://api.github.com/repos/${repo}/releases/latest" local script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd) - pushd "$script_dir" > /dev/null - - source ./download_fn.sh + source "$script_dir/download_fn.sh" echo "Fetching latest release info for ${repo}..." >&2 local release_json=$(curl -s "${api_url}") @@ -21,7 +19,6 @@ download_github_release() { # Check if the repository was found/has releases if echo "${release_json}" | grep -q "Not Found"; then echo "❌ Repository not found or has no public releases at ${api_url}!" >&2 - popd return 1 fi @@ -36,17 +33,14 @@ download_github_release() { # Check if a URL was actually found if [[ -z "${download_url}" || "${download_url}" == "null" ]]; then echo "❌ Could not find a matching download URL!" >&2 - popd return 1 fi if ! download "${download_url}" "${outputdir}"; then - popd return 1 fi # Extract filename from the URL local filename=$(basename "${download_url}") _downloaded_file="${outputdir}/${filename}" - popd } \ No newline at end of file From d2bd7f4b32bcb36a0caf9b40eaa42b93d48a00ae Mon Sep 17 00:00:00 2001 From: mcarans Date: Fri, 7 Aug 2026 16:17:20 +1200 Subject: [PATCH 8/8] Fix Windows? --- ShellScripts/Windows/install_deps.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ShellScripts/Windows/install_deps.sh b/ShellScripts/Windows/install_deps.sh index b82a9aae2..ca387406d 100755 --- a/ShellScripts/Windows/install_deps.sh +++ b/ShellScripts/Windows/install_deps.sh @@ -33,10 +33,9 @@ install() { run_script() { local script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd) + source "$script_dir/../common/download_github_release_fn.sh" pushd "$script_dir" - source ../common/download_github_release_fn.sh - local oolite_deps_url="https://api.github.com/repos/OoliteProject/oolite_windeps_build/releases/latest" pacman -Syu --noconfirm