fix: install.sh shows build errors instead of failing silently

cargo build --quiet swallowed compiler errors, and the subshell (...)
didn't reliably propagate exit codes across bash versions. The script
continued past a failed build, then ls/cp failed on the missing binary.

Now: removed --quiet so errors are visible, explicit exit-code check
with common-cause hints (build-essential, libc6-dev), and a secondary
check that the binary actually exists before attempting to install it.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Taylor Eernisse
2026-02-09 23:49:45 -05:00
parent e5b18b17ff
commit 23d4d59c71

View File

@@ -31,12 +31,26 @@ echo "[ok] jq found"
# ── Build release binary ─────────────────────────────────────────────
echo ""
echo "Building release binary..."
(cd "$SCRIPT_DIR" && cargo build --release --quiet)
echo "[ok] Built: $(ls -lh "$SCRIPT_DIR/target/release/$BINARY_NAME" | awk '{print $5}')"
if ! (cd "$SCRIPT_DIR" && cargo build --release); then
echo ""
echo "ERROR: cargo build failed. Check the output above for details."
echo " Common causes:"
echo " - Missing C compiler: sudo apt install build-essential (Debian/Ubuntu)"
echo " - Missing libc headers: sudo apt install libc6-dev"
exit 1
fi
BINARY="$SCRIPT_DIR/target/release/$BINARY_NAME"
if [[ ! -f "$BINARY" ]]; then
echo "ERROR: Build succeeded but binary not found at $BINARY"
echo " Check: ls $SCRIPT_DIR/target/release/"
exit 1
fi
echo "[ok] Built: $(ls -lh "$BINARY" | awk '{print $5}')"
# ── Install binary ───────────────────────────────────────────────────
mkdir -p "$INSTALL_DIR"
cp "$SCRIPT_DIR/target/release/$BINARY_NAME" "$INSTALL_DIR/$BINARY_NAME"
cp "$BINARY" "$INSTALL_DIR/$BINARY_NAME"
chmod +x "$INSTALL_DIR/$BINARY_NAME"
echo "[ok] Installed to $INSTALL_DIR/$BINARY_NAME"