1
1
Fork 0

Optional Sudo

This commit is contained in:
colin 2024-06-11 14:37:23 +00:00
parent 74fb660a18
commit 339ed5ddd3
1 changed files with 9 additions and 2 deletions

View File

@ -31,7 +31,14 @@ fi
BINARY_URL="${BASE_URL}/${binaries[$KEY]}"
echo "Downloading and installing $BINARY_NAME from $BINARY_URL..."
sudo curl -sSL "$BINARY_URL" -o "${INSTALL_DIR}/${BINARY_NAME}"
sudo chmod +x "${INSTALL_DIR}/${BINARY_NAME}"
# Check if we have write permission to the install directory
if [ -w "${INSTALL_DIR}" ]; then
curl -sSL "$BINARY_URL" -o "${INSTALL_DIR}/${BINARY_NAME}"
chmod +x "${INSTALL_DIR}/${BINARY_NAME}"
else
sudo curl -sSL "$BINARY_URL" -o "${INSTALL_DIR}/${BINARY_NAME}"
sudo chmod +x "${INSTALL_DIR}/${BINARY_NAME}"
fi
echo "Installed $BINARY_NAME to $INSTALL_DIR"