diff --git a/build.sh b/build.sh index c107a4d..c3ea180 100755 --- a/build.sh +++ b/build.sh @@ -630,6 +630,24 @@ HDR # ── xmrig binary (from prebuilt-binaries/xmrig-hac/) ──────────────── local XMRIG_DIR="$SCRIPT_DIR/prebuilt-binaries/xmrig-hac" + # The published DRG-XMRig archives ship the binary inside a versioned subdir, not as a flat + # xmrig.exe. Extract it from the matching win-x64 zip if it isn't already staged — otherwise + # the embed below never fires (HAS_EMBEDDED_XMRIG stays undefined) and the wallet ships with + # no miner ("xmrig binary not found" at runtime). + if [[ ! -f "$XMRIG_DIR/xmrig.exe" ]]; then + local _xz; _xz=$(ls "$XMRIG_DIR"/drg-xmrig-*-win-x64.zip 2>/dev/null | head -1) + if [[ -n "$_xz" ]] && command -v unzip >/dev/null 2>&1; then + local _xtmp; _xtmp=$(mktemp -d) + # -j flattens the versioned subdir; check the file (not unzip's exit code, which is + # non-zero if a pattern matches nothing). + unzip -j -o "$_xz" '*xmrig.exe' -d "$_xtmp" >/dev/null 2>&1 || true + if [[ -f "$_xtmp/xmrig.exe" ]]; then + cp -f "$_xtmp/xmrig.exe" "$XMRIG_DIR/xmrig.exe" + info " Extracted xmrig.exe from $(basename "$_xz")" + fi + rm -rf "$_xtmp" + fi + fi if [[ -f "$XMRIG_DIR/xmrig.exe" ]]; then cp -f "$XMRIG_DIR/xmrig.exe" "$RES/xmrig.exe" info " Staged xmrig.exe ($(du -h "$XMRIG_DIR/xmrig.exe" | cut -f1))"