Skip to content

Commit cc1d46d

Browse files
fix(installer): install exe basename on Windows POSIX shells
1 parent 08c489e commit cc1d46d

1 file changed

Lines changed: 19 additions & 9 deletions

File tree

install.sh

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,10 @@ case "${OS}-${ARCH}" in
302302
mingw*-amd64|msys*-amd64|cygwin*-amd64) TARGET="windows-amd64"; EXT="zip" ;;
303303
*) :;;
304304
esac
305+
INSTALL_BASENAME="cass"
306+
if [ "$TARGET" = "windows-amd64" ]; then
307+
INSTALL_BASENAME="cass.exe"
308+
fi
305309

306310
# Prefer prebuilt artifact when we know the target or the caller supplied a direct URL.
307311
TAR=""
@@ -371,13 +375,19 @@ if [ "$FROM_SOURCE" -eq 1 ]; then
371375
ensure_rust
372376
git clone --depth 1 --branch "$VERSION" "https://github.com/${OWNER}/${REPO}.git" "$TMP/src"
373377
(cd "$TMP/src" && cargo build --release)
374-
BIN="$TMP/src/target/release/cass"
378+
BIN="$TMP/src/target/release/$INSTALL_BASENAME"
379+
if [ ! -x "$BIN" ]; then
380+
BIN="$TMP/src/target/release/cass"
381+
fi
382+
if [ ! -x "$BIN" ]; then
383+
BIN="$TMP/src/target/release/cass.exe"
384+
fi
375385
[ -x "$BIN" ] || { err "Build failed"; exit 1; }
376-
install -m 0755 "$BIN" "$DEST"
377-
ok "Installed to $DEST/cass (source build)"
386+
install -m 0755 "$BIN" "$DEST/$INSTALL_BASENAME"
387+
ok "Installed to $DEST/$INSTALL_BASENAME (source build)"
378388
maybe_add_path
379-
if [ "$VERIFY" -eq 1 ]; then "$DEST/cass" --version || true; ok "Self-test complete"; fi
380-
if [ "$QUICKSTART" -eq 1 ]; then info "Running index --full (quickstart)"; "$DEST/cass" index --full || warn "index --full failed"; fi
389+
if [ "$VERIFY" -eq 1 ]; then "$DEST/$INSTALL_BASENAME" --version || true; ok "Self-test complete"; fi
390+
if [ "$QUICKSTART" -eq 1 ]; then info "Running index --full (quickstart)"; "$DEST/$INSTALL_BASENAME" index --full || warn "index --full failed"; fi
381391
ok "Done. Run: cass"
382392
exit 0
383393
fi
@@ -454,18 +464,18 @@ if [ ! -x "$BIN" ]; then
454464
fi
455465

456466
[ -x "$BIN" ] || { err "Binary not found in tar"; exit 1; }
457-
install -m 0755 "$BIN" "$DEST/cass"
458-
ok "Installed to $DEST/cass"
467+
install -m 0755 "$BIN" "$DEST/$INSTALL_BASENAME"
468+
ok "Installed to $DEST/$INSTALL_BASENAME"
459469
maybe_add_path
460470

461471
if [ "$VERIFY" -eq 1 ]; then
462-
"$DEST/cass" --version || true
472+
"$DEST/$INSTALL_BASENAME" --version || true
463473
ok "Self-test complete"
464474
fi
465475

466476
if [ "$QUICKSTART" -eq 1 ]; then
467477
info "Running index --full (quickstart)"
468-
"$DEST/cass" index --full || warn "index --full failed"
478+
"$DEST/$INSTALL_BASENAME" index --full || warn "index --full failed"
469479
fi
470480

471481
ok "Done. Run: cass"

0 commit comments

Comments
 (0)