diff --git a/rigforge.sh b/rigforge.sh index 64cd251..610b510 100755 --- a/rigforge.sh +++ b/rigforge.sh @@ -595,21 +595,14 @@ generate_xmrig_config() { HTTP_RESTRICTED="true" HTTP_HOST="0.0.0.0" - # macOS Specific Overrides + # macOS Specific Overrides (only the values that differ from the shared defaults above) if [ "$OS_TYPE" == "Darwin" ]; then - YIELD="false" - # Match the Linux dedicated-miner default (2). XMRig warns a priority above 2 can make the - # machine unresponsive, and macOS is a light-use/dev target — don't pin it to the most - # aggressive level here. - PRIORITY="2" ASM="true" WRMSR="false" RDMSR="false" HUGE_PAGES="false" MEMORY_POOL="false" ONE_GB_PAGES="false" - NUMA="true" - HTTP_RESTRICTED="true" HTTP_HOST="::" # Generate rx array [-1, -1, ...] based on core count @@ -899,7 +892,7 @@ configure_limits() { # removes it regardless, but only while it's still our symlink. link_cli() { [ "${ADD_TO_PATH:-false}" = "true" ] || return 0 - local target="$SCRIPT_DIR/rigforge.sh" link="$BIN_DIR/rigforge" ok=1 + local target="$SCRIPT_DIR/rigforge.sh" link="$BIN_DIR/rigforge" if [ ! -d "$BIN_DIR" ]; then warn "Skipped the 'rigforge' command — $BIN_DIR doesn't exist. Run it as './rigforge.sh' instead." return 0 @@ -916,8 +909,7 @@ link_cli() { local sudo_pfx="" [ -w "$BIN_DIR" ] || sudo_pfx="sudo" # shellcheck disable=SC2086 - $sudo_pfx rm -f "$link" 2>/dev/null && $sudo_pfx ln -s "$target" "$link" 2>/dev/null || ok=0 - if [ "$ok" = 1 ]; then + if $sudo_pfx rm -f "$link" 2>/dev/null && $sudo_pfx ln -s "$target" "$link" 2>/dev/null; then log "Installed the 'rigforge' command -> $link (try: 'sudo rigforge doctor' from anywhere)." else warn "Couldn't add the 'rigforge' command at $link (permissions?). Run it as './rigforge.sh' instead." diff --git a/util/proposed-grub.sh b/util/proposed-grub.sh index 3a02d6e..e4b12e8 100755 --- a/util/proposed-grub.sh +++ b/util/proposed-grub.sh @@ -28,8 +28,8 @@ HUGEPAGES_1G_NR="${HUGEPAGES_1G_NR:-/sys/kernel/mm/hugepages/hugepages-1048576kB # Extract L3 Cache size and normalize to Megabytes # Output format varies (e.g., "32M", "32768K"), so we strip non-numeric characters. -L3_RAW=$(lscpu | grep "L3 cache" | head -n 1 | awk '{print $3$4}') -L3_MB=$(echo "$L3_RAW" | sed 's/[^0-9]//g') +L3_RAW=$(lscpu | awk '/L3 cache/{print $3$4; exit}') +L3_MB="${L3_RAW//[!0-9]/}" # Convert Kilobytes to Megabytes if necessary if [[ "$L3_RAW" == *K* ]]; then @@ -40,7 +40,7 @@ if [[ -z "$L3_MB" ]]; then fi # Detect Physical CPU Sockets (for display / NUMA fallback). -SOCKETS=$(lscpu | grep "Socket(s):" | awk '{print $2}') +SOCKETS=$(lscpu | awk '/Socket\(s\):/{print $2; exit}') if [[ -z "$SOCKETS" ]]; then SOCKETS=1 fi @@ -86,7 +86,7 @@ if [ "$RUNTIME" -eq 1 ]; then # Check if 1GB pages are already allocated PAGES_1GB=0 if [ -f "$HUGEPAGES_1G_NR" ]; then - PAGES_1GB=$(cat "$HUGEPAGES_1G_NR" || echo 0) + PAGES_1GB=$(<"$HUGEPAGES_1G_NR") fi if [ "$PAGES_1GB" -gt 0 ]; then