hiby: r1_patcher: add macOS support
rockbox-gerrit-noreply--- via rockbox-cvs <[email protected]>
| Newsgroups | gmane.comp.systems.archos.rockbox.cvs |
|---|---|
| Message-ID | <[email protected]> |
commit 842492d77bacf5755aca14f2fa00fe8690b09cc0 Author: Roman Artiukhin <[email protected]> Date: Mon Aug 10 20:51:48 2026 +0300 hiby: r1_patcher: add macOS support Change-Id: If9f11fc7fbac87275325f0f892c2546184714d0b diff --git a/tools/r1_patcher/r1_patcher.sh b/tools/r1_patcher/r1_patcher.sh index b82a80457d..e70e9b20a9 100755 --- a/tools/r1_patcher/r1_patcher.sh +++ b/tools/r1_patcher/r1_patcher.sh @@ -1,7 +1,10 @@ #!/bin/bash -#Prerequisites: -#sudo apt update && sudo apt install -y p7zip-full squashfs-tools genisoimage coreutils +# Linux Prerequisites: +# sudo apt update && sudo apt install -y p7zip-full squashfs-tools genisoimage coreutils +# +# macOS Prerequisites: +# brew install p7zip squashfs cdrtools coreutils # Fail fast on any error, undefined variable, or failed pipeline set -euo pipefail @@ -9,6 +12,28 @@ set -euo pipefail # Report errors with line number and the failing command trap 'echo "ERROR at line ${LINENO}: ${BASH_COMMAND}" >&2' ERR +# ============================================================================== +# macOS Compatibility Shim +# Map missing/incompatible GNU tools to their Homebrew equivalents via functions +# ============================================================================== +if [[ "$OSTYPE" == "darwin"* ]]; then + realpath() { grealpath "$@"; } + stat() { gstat "$@"; } + split() { gsplit "$@"; } + md5sum() { gmd5sum "$@"; } + genisoimage() { mkisofs "$@"; } + + # Quick sanity check for macOS users + for cmd in grealpath gstat gsplit gmd5sum mkisofs 7z unsquashfs mksquashfs; do + if ! command -v "$cmd" &> /dev/null; then + echo "ERROR: Missing macOS dependency for '$cmd'." >&2 + echo "Please run: brew install p7zip squashfs cdrtools coreutils" >&2 + exit 1 + fi + done +fi +# ============================================================================== + usage() { echo 'Usage:' >&2 echo ' ./r1_patcher.sh r1.upt bootloader.r1' >&2 -- rockbox-cvs mailing list [email protected] https://lists.haxx.se/mailman/listinfo/rockbox-cvs