Skip to content

Commit 1c54e63

Browse files
authored
Merge pull request #684 from frstrtr/ci-steward/launcher-binary-autodetect
packaging: auto-detect per-coin binary in bundled launchers
2 parents 82287b6 + cc4c87c commit 1c54e63

2 files changed

Lines changed: 29 additions & 7 deletions

File tree

start.bat

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,28 @@
11
@echo off
2-
setlocal
2+
setlocal enabledelayedexpansion
33
set DIR=%~dp0
44
set CONFIG=%1
55
if "%CONFIG%"=="" set CONFIG=%DIR%config\c2pool_mainnet.yaml
66

7-
echo === c2pool ===
7+
:: Locate the packaged coin binary. release.yml packages it per-coin as
8+
:: c2pool-<coin>.exe, so resolve by glob rather than a hard-coded name;
9+
:: fall back to a plain c2pool.exe for source builds.
10+
set BIN=
11+
for %%f in ("%DIR%c2pool-*.exe") do set BIN=%%f
12+
if "!BIN!"=="" if exist "%DIR%c2pool.exe" set BIN=%DIR%c2pool.exe
13+
if "!BIN!"=="" (
14+
echo ERROR: no c2pool binary found in %DIR%
15+
exit /b 1
16+
)
17+
for %%f in ("!BIN!") do set BINNAME=%%~nxf
18+
19+
echo === !BINNAME! ===
820
echo Config: %CONFIG%
921
echo Web: http://0.0.0.0:8080
1022
echo Explorer: http://0.0.0.0:9090
1123

1224
:: Start c2pool
13-
start /B "" "%DIR%c2pool.exe" --config "%CONFIG%" --dashboard-dir "%DIR%web-static"
25+
start /B "" "!BIN!" --config "%CONFIG%" --dashboard-dir "%DIR%web-static"
1426

1527
:: Wait for API
1628
:wait_loop

start.sh

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,38 @@ CONFIG="${1:-$DIR/config/c2pool_mainnet.yaml}"
77
EXPLORER_PORT=9090
88
WEB_PORT=8080
99

10+
# Locate the packaged coin binary. release.yml packages it per-coin as
11+
# c2pool-<coin> (c2pool-ltc, c2pool-btc, ...), so resolve by glob rather
12+
# than a hard-coded name; fall back to a plain c2pool for source builds.
13+
BIN=$(find "$DIR" -maxdepth 1 -type f -name "c2pool-*" -perm -u+x 2>/dev/null | head -1)
14+
[ -z "$BIN" ] && [ -x "$DIR/c2pool" ] && BIN="$DIR/c2pool"
15+
if [ -z "$BIN" ]; then
16+
echo "ERROR: no c2pool binary found in $DIR" >&2
17+
exit 1
18+
fi
19+
1020
# Parse web_port from config if present
1121
if [ -f "$CONFIG" ]; then
12-
WP=$(grep -E "^web_port:" "$CONFIG" 2>/dev/null | awk '{print $2}')
22+
WP=$(grep -E "^web_port:" "$CONFIG" 2>/dev/null | awk "{print \$2}")
1323
[ -n "$WP" ] && WEB_PORT="$WP"
1424
fi
1525

16-
echo "=== c2pool v0.1.1-alpha ==="
26+
echo "=== $(basename "$BIN") ==="
1727
echo "Config: $CONFIG"
1828
echo "Web: http://0.0.0.0:${WEB_PORT}"
1929
echo "Explorer: http://0.0.0.0:${EXPLORER_PORT}"
2030
echo ""
2131

2232
# Start c2pool with bundled libs
2333
export LD_LIBRARY_PATH="$DIR/lib:${LD_LIBRARY_PATH:-}"
24-
"$DIR/c2pool" --config "$CONFIG" --dashboard-dir "$DIR/web-static" &
34+
"$BIN" --config "$CONFIG" --dashboard-dir "$DIR/web-static" &
2535
C2POOL_PID=$!
2636

2737
# Wait for the explorer API to be ready (callbacks wired after full init)
2838
echo "Waiting for c2pool to initialize..."
2939
for i in $(seq 1 120); do
3040
RESP=$(curl -s "http://127.0.0.1:${WEB_PORT}/api/explorer/getblockchaininfo" 2>/dev/null || true)
31-
if echo "$RESP" | grep -q '"blocks"'; then
41+
if echo "$RESP" | grep -q "\"blocks\""; then
3242
echo "c2pool explorer API ready."
3343
break
3444
fi

0 commit comments

Comments
 (0)