fix(installer): macOS support — bash 3.2 compat + correct miner paths#8005
fix(installer): macOS support — bash 3.2 compat + correct miner paths#8005rebel117 wants to merge 2 commits into
Conversation
The one-line installer crashed on macOS for two reasons: 1. The MULT_TABLE associative array (declare -A) is a bash 4+ feature. macOS ships bash 3.2, so the script died immediately with "sparc: unbound variable". Replaced with a plain case-based arch_multiplier() function that returns the same values. 2. The miner download URLs were hard-coded to miners/linux/, which 404s on macOS since the macOS miner lives under miners/macos/. Now the OS is detected at the top and the correct per-OS subdir and filename are used (rustchain_mac_miner_v2.5.py for Darwin, rustchain_linux_miner.py otherwise). Also: the macOS miner imports the sibling color_logs module, so that is now fetched for Darwin installs; miner_crypto.py (Linux-only, optional attestation signing) is skipped on macOS rather than failing the install. Service ExecStart and launchd plist paths updated to use the real filename. Fixes Scottcjn#7975
|
Welcome to RustChain! Thanks for your first pull request. Before we review, please make sure:
Bounty tiers: Micro (1-10 RTC) | Standard (20-50) | Major (75-100) | Critical (100-150) A maintainer will review your PR soon. Thanks for contributing! |
|
Good news first: this touches only
These tests protect the |
- Restore literal MINER_URL=".../miners/linux/rustchain_linux_miner.py"
on Linux so test_scripts_installer_uses_existing_linux_miner_paths passes
- Always run download_file ${MINER_CRYPTO_URL} on Linux and keep the
[ ! -s .../miner_crypto.py ] empty-file guard so
test_scripts_installer_fails_on_http_download_errors passes again
- macOS keeps the conditional color_logs + no-miner_crypto path
|
Good catches, both. Fixed in 3ebbdc1:
macOS still gets the |
Fixes #7975.
The one-line installer (
scripts/install.sh) crashes immediately on macOS. Two root causes, both fixed here.What was broken
1.
declare -Ais a bash 4+ feature; macOS ships bash 3.2Run this on any stock Mac and you get
bash: line 60: sparc: unbound variable— the script never gets past the constants block.2. Miner URLs hard-coded to
miners/linux/(404 on macOS)MINER_URL="${REPO_RAW}/miners/linux/rustchain_linux_miner.py"The actual macOS miner lives under
miners/macos/rustchain_mac_miner_v2.5.py, so even after fixing #1 the download step would 404. Verified against the raw URLs:miners/linux/rustchain_linux_miner.py→ 200 (Linux only)miners/macos/rustchain_mac_miner_v2.5.py→ 200miners/macos/fingerprint_checks.py→ 200The fix
case-basedarch_multiplier()helper. Same values, works on bash 3.2 through 5.x.uname -s) and pick the right subdir + filename:miners/macos/rustchain_mac_miner_v2.5.pyfor Darwin,miners/linux/rustchain_linux_miner.pyotherwise.color_logsmodule, so that is now fetched for Darwin installs.miner_crypto.pyis only shipped for Linux (optional attestation signing); on macOS it is skipped instead of failing the install.ExecStart(systemd) and the launchd plist to reference the real downloaded filename.Verification
bash -n scripts/install.shpasses (no syntax errors).arch_multiplier/get_multiplierunit-checked for all 13 arch values — output matches the old table exactly, including the0.0005fallback for ARM/aarch64 and1.0default.declare -A,${var,,},mapfile/readarrayall zero occurrences).raw.githubusercontent.com— Linux paths stay 200, macOS paths now 200 (were 404).