generated from brevdev/seed
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #213 from brevdev/restore-install-scripts
bin: restore functional install-latest scripts
- Loading branch information
Showing
2 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/usr/bin/env bash | ||
set -eo pipefail | ||
|
||
# Install the latest version of the Linux binary | ||
DOWNLOAD_URL="$(curl -s https://api.github.com/repos/brevdev/brev-cli/releases/latest | grep "browser_download_url.*linux.*amd64" | cut -d '"' -f 4)" | ||
|
||
# Create temporary directory and ensure cleanup | ||
TMP_DIR="$(mktemp -d)" | ||
trap 'rm -rf "${TMP_DIR}"' EXIT | ||
|
||
# Download the latest release | ||
curl -L "${DOWNLOAD_URL}" -o "${TMP_DIR}/$(basename "${DOWNLOAD_URL}")" | ||
|
||
# Find and extract the archive | ||
ARCHIVE_FILE="$(find "${TMP_DIR}" -name "brev*.tar.gz" -type f)" | ||
tar -xzf "${ARCHIVE_FILE}" -C "${TMP_DIR}" | ||
|
||
# Install the binary to system location | ||
sudo mv "${TMP_DIR}/brev" /usr/local/bin/brev | ||
sudo chmod +x /usr/local/bin/brev | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/env bash | ||
set -eo pipefail | ||
|
||
# Detect OS and architecture | ||
OS="$(uname -s | tr '[:upper:]' '[:lower:]')" | ||
ARCH="$(uname -m)" | ||
case "${ARCH}" in | ||
x86_64) ARCH="amd64" ;; | ||
aarch64) ARCH="arm64" ;; | ||
esac | ||
|
||
# Get the appropriate download URL for this platform | ||
DOWNLOAD_URL="$(curl -s https://api.github.com/repos/brevdev/brev-cli/releases/latest | grep "browser_download_url.*${OS}.*${ARCH}" | cut -d '"' -f 4)" | ||
|
||
# Verify we found a suitable release | ||
if [ -z "${DOWNLOAD_URL}" ]; then | ||
echo "Error: Could not find release for ${OS} ${ARCH}" >&2 | ||
exit 1 | ||
fi | ||
|
||
# Create temporary directory and ensure cleanup | ||
TMP_DIR="$(mktemp -d)" | ||
trap 'rm -rf "${TMP_DIR}"' EXIT | ||
|
||
# Download and extract the release | ||
curl -sL "${DOWNLOAD_URL}" -o "${TMP_DIR}/brev.tar.gz" | ||
tar -xzf "${TMP_DIR}/brev.tar.gz" -C "${TMP_DIR}" | ||
|
||
# Install the binary to system location | ||
sudo mv "${TMP_DIR}/brev" /usr/local/bin/brev | ||
sudo chmod +x /usr/local/bin/brev | ||
|
||
echo "Successfully installed brev CLI to /usr/local/bin/brev" |