mirror of
https://github.com/Rockbox/rockbox.git
synced 2026-10-10 08:03:04 -04:00
hiby: r1_patcher: add macOS support
Change-Id: If9f11fc7fbac87275325f0f892c2546184714d0b
This commit is contained in:
parent
fd8d6f10a1
commit
842492d77b
1 changed files with 27 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue