@@ -7,28 +7,38 @@ CONFIG="${1:-$DIR/config/c2pool_mainnet.yaml}"
77EXPLORER_PORT=9090
88WEB_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
1121if [ -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 "
1424fi
1525
16- echo " === c2pool v0.1.1-alpha ==="
26+ echo " === $( basename " $BIN " ) ==="
1727echo " Config: $CONFIG "
1828echo " Web: http://0.0.0.0:${WEB_PORT} "
1929echo " Explorer: http://0.0.0.0:${EXPLORER_PORT} "
2030echo " "
2131
2232# Start c2pool with bundled libs
2333export 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" &
2535C2POOL_PID=$!
2636
2737# Wait for the explorer API to be ready (callbacks wired after full init)
2838echo " Waiting for c2pool to initialize..."
2939for 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