Skip to content
Open
Show file tree
Hide file tree
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
11 changes: 5 additions & 6 deletions src/bat/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ REPO_OWNER="sharkdp"
REPO_NAME="bat"
BINARY_NAME="bat"
BAT_VERSION="${VERSION:-"latest"}"
GITHUB_API_REPO_URL="https://api.github.com/repos/${REPO_OWNER}/${REPO_NAME}/releases"

set -e

if [ "$(id -u)" -ne 0 ]; then
Expand All @@ -28,12 +26,13 @@ check_packages() {
fi
}

# Make sure we have curl and jq
check_packages curl jq ca-certificates
# Make sure we have curl
check_packages curl ca-certificates

# Function to get the latest version from GitHub API
# Function to get the latest version by following the GitHub releases redirect
get_latest_version() {
curl -s "${GITHUB_API_REPO_URL}/latest" | jq -r ".tag_name"
curl -sI "https://github.com/$REPO_OWNER/$REPO_NAME/releases/latest" \
| grep -i '^location:' | sed 's|.*/tag/||;s/\r//'
}

# Check if a version is passed as an argument
Expand Down
11 changes: 5 additions & 6 deletions src/ccc/install.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ REPO_OWNER="jsburckhardt"
REPO_NAME="co-config"
BINARY_NAME="ccc"
CCC_VERSION="${VERSION:-"latest"}"
GITHUB_API_REPO_URL="https://api.github.com/repos/${REPO_OWNER}/${REPO_NAME}/releases"

set -e

if [ "$(id -u)" -ne 0 ]; then
Expand All @@ -28,12 +26,13 @@ check_packages() {
fi
}

# Make sure we have curl and jq
check_packages curl jq ca-certificates tar
# Make sure we have curl
check_packages curl ca-certificates tar

# Function to get the latest version from GitHub API
# Function to get the latest version by following the GitHub releases redirect
get_latest_version() {
curl -s "${GITHUB_API_REPO_URL}/latest" | jq -r ".tag_name"
curl -sI "https://github.com/$REPO_OWNER/$REPO_NAME/releases/latest" \
| grep -i '^location:' | sed 's|.*/tag/||;s/\r//'
}

# Check if a version is passed as an argument
Expand Down
28 changes: 9 additions & 19 deletions src/copa/install.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/usr/bin/env bash

COPA_VERSION="${VERSION:-"latest"}"
GITHUB_API_REPO_URL="https://api.github.com/repos/project-copacetic/copacetic/releases"
REPO_OWNER="project-copacetic"
REPO_NAME="copacetic"
URL_RELEASES="https://github.com/project-copacetic/copacetic/releases"

set -e
Expand Down Expand Up @@ -46,26 +47,15 @@ check_packages() {
fi
}

# Figure out correct version of a three part version number is not passed
validate_version_exists() {
local variable_name=$1
local requested_version=$2
if [ "${requested_version}" = "latest" ]; then requested_version=$(curl -sL ${GITHUB_API_REPO_URL}/latest | jq -r ".tag_name"); fi
local version_list
version_list=$(curl -sL ${GITHUB_API_REPO_URL} | jq -r ".[].tag_name")
if [ -z "${variable_name}" ] || ! echo "${version_list}" | grep "${requested_version}" >/dev/null 2>&1; then
echo -e "Invalid ${variable_name} value: ${requested_version}\nValid values:\n${version_list}" >&2
exit 1
fi
echo "${variable_name}=${requested_version}"
}

# make sure we have curl
check_packages curl tar jq ca-certificates
check_packages curl tar ca-certificates

# make sure version is available
if [ "${COPA_VERSION}" = "latest" ]; then COPA_VERSION=$(curl -sL ${GITHUB_API_REPO_URL}/latest | jq -r ".tag_name"); fi
validate_version_exists COPA_VERSION "${COPA_VERSION}"
# get latest version via redirect if not specified
if [ "${COPA_VERSION}" = "latest" ]; then
COPA_VERSION=$(curl -sI "https://github.com/$REPO_OWNER/$REPO_NAME/releases/latest" \
| grep -i '^location:' | sed 's|.*/tag/||;s/\r//')
echo "No version provided or 'latest' specified, installing the latest version: $COPA_VERSION"
fi

# create COPA_VERSION_NUMBER (remove v from version COPA_VERSION if it has it)
COPA_VERSION_NUMBER=$(echo "${COPA_VERSION}" | sed 's/v//g')
Expand Down
19 changes: 2 additions & 17 deletions src/crane/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,26 +44,11 @@ check_packages() {
fi
}

# Figure out correct version of a three part version number is not passed
validate_version_exists() {
local variable_name=$1
local requested_version=$2
if [ "${requested_version}" = "latest" ]; then requested_version=$(curl -sL https://api.github.com/repos/google/go-containerregistry/releases/latest | jq -r ".tag_name"); fi
local version_list
version_list=$(curl -sL https://api.github.com/repos/google/go-containerregistry/releases | jq -r ".[].tag_name")
if [ -z "${variable_name}" ] || ! echo "${version_list}" | grep "${requested_version}" >/dev/null 2>&1; then
echo -e "Invalid ${variable_name} value: ${requested_version}\nValid values:\n${version_list}" >&2
exit 1
fi
echo "${variable_name}=${requested_version}"
}

# make sure we have curl
check_packages curl tar jq ca-certificates
check_packages curl tar ca-certificates

# make sure version is available
if [ "${CRANE_VERSION}" = "latest" ]; then CRANE_VERSION=$(curl -sL https://api.github.com/repos/google/go-containerregistry/releases/latest | jq -r ".tag_name"); fi
validate_version_exists CRANE_VERSION "${CRANE_VERSION}"
if [ "${CRANE_VERSION}" = "latest" ]; then CRANE_VERSION=$(curl -sI "https://github.com/google/go-containerregistry/releases/latest" | grep -i '^location:' | sed 's|.*/tag/||;s/\r//'); fi

# download and install binary
CRANE_FILENAME=go-containerregistry_${OS}_${ARCH}.tar.gz
Expand Down
28 changes: 9 additions & 19 deletions src/cyclonedx/install.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/usr/bin/env bash

CYCLONEDX_VERSION="${VERSION:-"latest"}"
GITHUB_API_REPO_URL="https://api.github.com/repos/CycloneDX/cyclonedx-cli/releases"
REPO_OWNER="CycloneDX"
REPO_NAME="cyclonedx-cli"
URL_RELEASES="https://github.com/CycloneDX/cyclonedx-cli/releases"

set -e
Expand Down Expand Up @@ -47,26 +48,15 @@ check_packages() {
fi
}

# Figure out correct version of a three part version number is not passed
validate_version_exists() {
local variable_name=$1
local requested_version=$2
if [ "${requested_version}" = "latest" ]; then requested_version=$(curl -sL ${GITHUB_API_REPO_URL}/latest | jq -r ".tag_name"); fi
local version_list
version_list=$(curl -sL ${GITHUB_API_REPO_URL} | jq -r ".[].tag_name")
if [ -z "${variable_name}" ] || ! echo "${version_list}" | grep "${requested_version}" >/dev/null 2>&1; then
echo -e "Invalid ${variable_name} value: ${requested_version}\nValid values:\n${version_list}" >&2
exit 1
fi
echo "${variable_name}=${requested_version}"
}

# make sure we have curl
check_packages curl tar jq ca-certificates libicu-dev
check_packages curl tar ca-certificates libicu-dev

# make sure version is available
if [ "${CYCLONEDX_VERSION}" = "latest" ]; then CYCLONEDX_VERSION=$(curl -sL ${GITHUB_API_REPO_URL}/latest | jq -r ".tag_name"); fi
validate_version_exists CYCLONEDX_VERSION "${CYCLONEDX_VERSION}"
# get latest version via redirect if not specified
if [ "${CYCLONEDX_VERSION}" = "latest" ]; then
CYCLONEDX_VERSION=$(curl -sI "https://github.com/$REPO_OWNER/$REPO_NAME/releases/latest" \
| grep -i '^location:' | sed 's|.*/tag/||;s/\r//')
echo "No version provided or 'latest' specified, installing the latest version: $CYCLONEDX_VERSION"
fi

# download and install binary
CYCLONEDX_FILENAME=cyclonedx-${OS}-${ARCH}
Expand Down
11 changes: 5 additions & 6 deletions src/fd/install.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ REPO_OWNER="sharkdp"
REPO_NAME="fd"
BINARY_NAME="fd"
FD_VERSION="${VERSION:-"latest"}"
GITHUB_API_REPO_URL="https://api.github.com/repos/${REPO_OWNER}/${REPO_NAME}/releases"

set -e

if [ "$(id -u)" -ne 0 ]; then
Expand All @@ -28,12 +26,13 @@ check_packages() {
fi
}

# Make sure we have curl and jq
check_packages curl jq ca-certificates
# Make sure we have curl
check_packages curl ca-certificates

# Function to get the latest version from GitHub API
# Function to get the latest version by following the GitHub releases redirect
get_latest_version() {
curl -s "${GITHUB_API_REPO_URL}/latest" | jq -r ".tag_name"
curl -sI "https://github.com/$REPO_OWNER/$REPO_NAME/releases/latest" \
| grep -i '^location:' | sed 's|.*/tag/||;s/\r//'
}

# Check if a version is passed as an argument
Expand Down
19 changes: 2 additions & 17 deletions src/flux/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,26 +35,11 @@ check_packages() {
fi
}

# Figure out correct version of a three part version number is not passed
validate_version_exists() {
local variable_name=$1
local requested_version=$2
if [ "${requested_version}" = "latest" ]; then requested_version=$(curl -sL https://api.github.com/repos/fluxcd/flux2/releases/latest | jq -r ".tag_name"); fi
local version_list
version_list=$(curl -sL https://api.github.com/repos/fluxcd/flux2/releases | jq -r ".[].tag_name")
if [ -z "${variable_name}" ] || ! echo "${version_list}" | grep "${requested_version}" >/dev/null 2>&1; then
echo -e "Invalid ${variable_name} value: ${requested_version}\nValid values:\n${version_list}" >&2
exit 1
fi
echo "${variable_name}=${requested_version}"
}

# make sure we have curl
check_packages curl tar jq ca-certificates
check_packages curl tar ca-certificates

# make sure version is available
if [ "${FLUX2_VERSION}" = "latest" ]; then FLUX2_VERSION=$(curl -sL https://api.github.com/repos/fluxcd/flux2/releases/latest | jq -r ".tag_name"); fi
validate_version_exists FLUX2_VERSION "${FLUX2_VERSION}"
if [ "${FLUX2_VERSION}" = "latest" ]; then FLUX2_VERSION=$(curl -sI "https://github.com/fluxcd/flux2/releases/latest" | grep -i '^location:' | sed 's|.*/tag/||;s/\r//'); fi

# download and install binary
FLUX2_FILENAME=flux_${FLUX2_VERSION:1}_linux_${architecture}.tar.gz
Expand Down
11 changes: 5 additions & 6 deletions src/fx/install.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ REPO_OWNER="antonmedv"
REPO_NAME="fx"
BINARY_NAME="fx"
FX_VERSION="${VERSION:-"latest"}"
GITHUB_API_REPO_URL="https://api.github.com/repos/${REPO_OWNER}/${REPO_NAME}/releases"

set -e

if [ "$(id -u)" -ne 0 ]; then
Expand All @@ -28,12 +26,13 @@ check_packages() {
fi
}

# Make sure we have curl and jq
check_packages curl jq ca-certificates
# Make sure we have curl
check_packages curl ca-certificates

# Function to get the latest version from GitHub API
# Function to get the latest version by following the GitHub releases redirect
get_latest_version() {
curl -s "${GITHUB_API_REPO_URL}/latest" | jq -r ".tag_name"
curl -sI "https://github.com/$REPO_OWNER/$REPO_NAME/releases/latest" \
| grep -i '^location:' | sed 's|.*/tag/||;s/\r//'
}

# Check if a version is passed as an argument
Expand Down
11 changes: 5 additions & 6 deletions src/fzf/install.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ REPO_OWNER="junegunn"
REPO_NAME="fzf"
BINARY_NAME="fzf"
FZF_VERSION="${VERSION:-"latest"}"
GITHUB_API_REPO_URL="https://api.github.com/repos/${REPO_OWNER}/${REPO_NAME}/releases"

set -e

if [ "$(id -u)" -ne 0 ]; then
Expand All @@ -28,12 +26,13 @@ check_packages() {
fi
}

# Make sure we have curl and jq
check_packages curl jq ca-certificates
# Make sure we have curl
check_packages curl ca-certificates

# Function to get the latest version from GitHub API
# Function to get the latest version by following the GitHub releases redirect
get_latest_version() {
curl -s "${GITHUB_API_REPO_URL}/latest" | jq -r ".tag_name"
curl -sI "https://github.com/$REPO_OWNER/$REPO_NAME/releases/latest" \
| grep -i '^location:' | sed 's|.*/tag/||;s/\r//'
}

# Check if a version is passed as an argument
Expand Down
6 changes: 3 additions & 3 deletions src/gic/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ check_packages() {
# make sure we have packages
check_packages curl tar jq ca-certificates

# Function to get the latest version from GitHub API
# Function to get the latest version by following the GitHub releases redirect
get_latest_version() {
LATEST_URL="https://api.github.com/repos/$REPO_OWNER/$REPO_NAME/releases/latest"
curl -s "$LATEST_URL" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/'
curl -sI "https://github.com/$REPO_OWNER/$REPO_NAME/releases/latest" \
| grep -i '^location:' | sed 's|.*/tag/||;s/\r//'
}

# Check if a version is provided via environment variable or passed as an argument
Expand Down
28 changes: 9 additions & 19 deletions src/gitleaks/install.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/usr/bin/env bash

GITLEAKS_VERSION="${VERSION:-"latest"}"
GITHUB_API_REPO_URL="https://api.github.com/repos/gitleaks/gitleaks/releases"
REPO_OWNER="gitleaks"
REPO_NAME="gitleaks"
URL_RELEASES="https://github.com/gitleaks/gitleaks/releases"

set -e
Expand Down Expand Up @@ -46,26 +47,15 @@ check_packages() {
fi
}

# Figure out correct version of a three part version number is not passed
validate_version_exists() {
local variable_name=$1
local requested_version=$2
if [ "${requested_version}" = "latest" ]; then requested_version=$(curl -sL ${GITHUB_API_REPO_URL}/latest | jq -r ".tag_name"); fi
local version_list
version_list=$(curl -sL ${GITHUB_API_REPO_URL} | jq -r ".[].tag_name")
if [ -z "${variable_name}" ] || ! echo "${version_list}" | grep "${requested_version}" >/dev/null 2>&1; then
echo -e "Invalid ${variable_name} value: ${requested_version}\nValid values:\n${version_list}" >&2
exit 1
fi
echo "${variable_name}=${requested_version}"
}

# make sure we have curl
check_packages curl tar jq ca-certificates
check_packages curl tar ca-certificates

# make sure version is available
if [ "${GITLEAKS_VERSION}" = "latest" ]; then GITLEAKS_VERSION=$(curl -sL ${GITHUB_API_REPO_URL}/latest | jq -r ".tag_name"); fi
validate_version_exists GITLEAKS_VERSION "${GITLEAKS_VERSION}"
# get latest version via redirect if not specified
if [ "${GITLEAKS_VERSION}" = "latest" ]; then
GITLEAKS_VERSION=$(curl -sI "https://github.com/$REPO_OWNER/$REPO_NAME/releases/latest" \
| grep -i '^location:' | sed 's|.*/tag/||;s/\r//')
echo "No version provided or 'latest' specified, installing the latest version: $GITLEAKS_VERSION"
fi

# download and install binary
GITLEAKS_FILENAME=gitleaks_${GITLEAKS_VERSION#v}_${OS}_${architecture}.tar.gz
Expand Down
11 changes: 5 additions & 6 deletions src/glow/install.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ REPO_OWNER="charmbracelet"
REPO_NAME="glow"
BINARY_NAME="glow"
GLOW_VERSION="${VERSION:-"latest"}"
GITHUB_API_REPO_URL="https://api.github.com/repos/${REPO_OWNER}/${REPO_NAME}/releases"

set -e

if [ "$(id -u)" -ne 0 ]; then
Expand All @@ -28,12 +26,13 @@ check_packages() {
fi
}

# Make sure we have curl and jq
check_packages curl jq ca-certificates
# Make sure we have curl
check_packages curl ca-certificates

# Function to get the latest version from GitHub API
# Function to get the latest version by following the GitHub releases redirect
get_latest_version() {
curl -s "${GITHUB_API_REPO_URL}/latest" | jq -r ".tag_name"
curl -sI "https://github.com/$REPO_OWNER/$REPO_NAME/releases/latest" \
| grep -i '^location:' | sed 's|.*/tag/||;s/\r//'
}

# Check if a version is passed as an argument
Expand Down
11 changes: 5 additions & 6 deletions src/hurl/install.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ REPO_OWNER="Orange-OpenSource"
REPO_NAME="hurl"
BINARY_NAME="hurl"
HURL_VERSION="${VERSION:-"latest"}"
GITHUB_API_REPO_URL="https://api.github.com/repos/${REPO_OWNER}/${REPO_NAME}/releases"

set -e

if [ "$(id -u)" -ne 0 ]; then
Expand All @@ -28,8 +26,8 @@ check_packages() {
fi
}

# Make sure we have curl and jq
check_packages curl jq ca-certificates
# Make sure we have curl
check_packages curl ca-certificates

# Install libxml2 runtime dependency
# On newer Ubuntu (25.04+), the package is libxml2-16 and provides libxml2.so.16
Expand All @@ -49,9 +47,10 @@ else
fi
fi

# Function to get the latest version from GitHub API
# Function to get the latest version by following the GitHub releases redirect
get_latest_version() {
curl -s "${GITHUB_API_REPO_URL}/latest" | jq -r ".tag_name"
curl -sI "https://github.com/$REPO_OWNER/$REPO_NAME/releases/latest" \
| grep -i '^location:' | sed 's|.*/tag/||;s/\r//'
}

# Check if a version is passed as an argument
Expand Down
Loading