Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 7 additions & 18 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

set -e

INSTALL_DIR="${INSTALL_DIR:-$HOME/.local/bin}"
INSTALL_DIR="${INSTALL_DIR:-/usr/local/bin}"
REPO="ververica/vvctl"
TEMP_DIR=$(mktemp -d)
VERSION_ARG="$1"
Expand Down Expand Up @@ -116,27 +116,16 @@ fi

# Install
chmod +x "${TEMP_DIR}/vvctl"
mkdir -p "$INSTALL_DIR"
echo "Installing to ${INSTALL_DIR}/vvctl..."
cp "${TEMP_DIR}/vvctl" "${INSTALL_DIR}/vvctl"

if [ -w "$INSTALL_DIR" ]; then
cp "${TEMP_DIR}/vvctl" "${INSTALL_DIR}/vvctl"
else
sudo cp "${TEMP_DIR}/vvctl" "${INSTALL_DIR}/vvctl"
Comment on lines +121 to +124
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Create INSTALL_DIR before copying binary

The install step now copies directly into INSTALL_DIR without ensuring the directory exists, so installs fail with No such file or directory when users set INSTALL_DIR to a new path (or on minimal systems where /usr/local/bin is absent). In those cases both branches fail (cp and sudo cp), which is a regression from the previous behavior that created the directory first.

Useful? React with 👍 / 👎.

fi

# Cleanup
rm -rf "$TEMP_DIR"

echo "vvctl installed successfully!"

# Check if INSTALL_DIR is in PATH
case ":$PATH:" in
*":${INSTALL_DIR}:"*) ;;
*)
echo ""
echo "WARNING: ${INSTALL_DIR} is not in your PATH."
echo "Add it by appending the following line to your shell profile (~/.bashrc, ~/.zshrc, etc.):"
echo ""
echo " export PATH=\"${INSTALL_DIR}:\$PATH\""
echo ""
echo "Then restart your shell or run: source ~/.bashrc (or ~/.zshrc)"
;;
esac

echo "Run 'vvctl --help' to get started"