Fixed install.sh optionalized sudo
ci/woodpecker/push/woodpecker Pipeline failed Details

This commit is contained in:
Colin 2024-06-11 10:37:57 -04:00
parent 962f474cdb
commit 864e451773
1 changed files with 9 additions and 2 deletions

View File

@ -31,7 +31,14 @@ fi
BINARY_URL="${BASE_URL}/${binaries[$KEY]}" BINARY_URL="${BASE_URL}/${binaries[$KEY]}"
echo "Downloading and installing $BINARY_NAME from $BINARY_URL..." 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" echo "Installed $BINARY_NAME to $INSTALL_DIR"