chore: add client option to install script (#9962)

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: DmitriyLewen <91113035+DmitriyLewen@users.noreply.github.com>
This commit is contained in:
Owen Rumney
2025-12-19 09:49:08 +00:00
committed by GitHub
parent 87772521b6
commit 75c4dc0f45

View File

@@ -8,8 +8,9 @@ usage() {
cat <<EOF
$this: download go binaries for aquasecurity/trivy
Usage: $this [-b] bindir [-d] [tag]
Usage: $this [-b] bindir [-c] client [-d] [tag]
-b sets bindir or installation directory, Defaults to ./bin
-c sets client identifier for download tracking (letters, digits, and '-' characters are allowed), Defaults to install-script
-d turns on debug logging
-x turns on verbose logging
[tag] is a tag from
@@ -28,9 +29,18 @@ parse_args() {
# over-ridden by flag below
BINDIR=${BINDIR:-./bin}
while getopts "b:dh?x" arg; do
CLIENT=${CLIENT:-install-script}
while getopts "b:c:dh?x" arg; do
case "$arg" in
b) BINDIR="$OPTARG" ;;
c)
if printf '%s' "$OPTARG" | grep -Eq '^[A-Za-z0-9-]+$'; then
CLIENT="$OPTARG"
else
log_crit "invalid client identifier '${OPTARG}'; allowed characters are: letters, digits, and '-'"
exit 1
fi
;;
d) log_set_priority 10 ;;
h | \?) usage "$0" ;;
x) set -x ;;
@@ -379,7 +389,7 @@ log_info "found version: ${VERSION} for ${TAG}/${OS}/${ARCH}"
NAME=${PROJECT_NAME}_${VERSION}_${OS}-${ARCH}
TARBALL=${NAME}.${FORMAT}
TARBALL_URL="${GET_DOWNLOAD}?os=${OS}&arch=${ARCH}&version=${VERSION}&type=${FORMAT}&client=install-script"
TARBALL_URL="${GET_DOWNLOAD}?os=${OS}&arch=${ARCH}&version=${VERSION}&type=${FORMAT}&client=${CLIENT}"
CHECKSUM=${PROJECT_NAME}_${VERSION}_checksums.txt
CHECKSUM_URL=${GITHUB_DOWNLOAD}/${TAG}/${CHECKSUM}