@@ -11,6 +11,7 @@ $this: download go binaries for aquasecurity/trivy
1111Usage: $this [-b] bindir [-d] [tag]
1212 -b sets bindir or installation directory, Defaults to ./bin
1313 -d turns on debug logging
14+ -x turns on verbose logging
1415 [tag] is a tag from
1516 https://github.com/aquasecurity/trivy/releases
1617 If tag is missing, then the latest will be used.
@@ -51,42 +52,14 @@ execute() {
5152 srcdir=" ${tmpdir} "
5253 (cd " ${tmpdir} " && untar " ${TARBALL} " )
5354 test ! -d " ${BINDIR} " && install -d " ${BINDIR} "
54- for binexe in $BINARIES ; do
55- if [ " $OS " = " windows" ]; then
56- binexe=" ${binexe} .exe"
57- fi
58- install " ${srcdir} /${binexe} " " ${BINDIR} /"
59- log_info " installed ${BINDIR} /${binexe} "
60- done
55+ binexe=" trivy"
56+ if [ " $OS " = " windows" ]; then
57+ binexe=" ${binexe} .exe"
58+ fi
59+ install " ${srcdir} /${binexe} " " ${BINDIR} /"
60+ log_info " installed ${BINDIR} /${binexe} "
6161 rm -rf " ${tmpdir} "
6262}
63- get_binaries () {
64- case " $PLATFORM " in
65- darwin/386) BINARIES=" trivy" ;;
66- darwin/amd64) BINARIES=" trivy" ;;
67- darwin/arm64) BINARIES=" trivy" ;;
68- darwin/armv7) BINARIES=" trivy" ;;
69- freebsd/386) BINARIES=" trivy" ;;
70- freebsd/amd64) BINARIES=" trivy" ;;
71- freebsd/arm64) BINARIES=" trivy" ;;
72- freebsd/armv7) BINARIES=" trivy" ;;
73- linux/386) BINARIES=" trivy" ;;
74- linux/amd64) BINARIES=" trivy" ;;
75- linux/ppc64le) BINARIES=" trivy" ;;
76- linux/arm64) BINARIES=" trivy" ;;
77- linux/armv7) BINARIES=" trivy" ;;
78- linux/s390x) BINARIES=" trivy" ;;
79- openbsd/386) BINARIES=" trivy" ;;
80- openbsd/amd64) BINARIES=" trivy" ;;
81- openbsd/arm64) BINARIES=" trivy" ;;
82- openbsd/armv7) BINARIES=" trivy" ;;
83- windows/amd64) BINARIES=" trivy" ;;
84- * )
85- log_crit " platform $PLATFORM is not supported. Make sure this script is up-to-date and file request at https://github.com/${PREFIX} /issues/new"
86- exit 1
87- ;;
88- esac
89- }
9063tag_to_version () {
9164 if [ -z " ${TAG} " ]; then
9265 log_info " checking GitHub for latest tag"
@@ -137,12 +110,6 @@ adjust_arch() {
137110 arm64) ARCH=ARM64 ;;
138111 ppc64le) ARCH=PPC64LE ;;
139112 s390x) ARCH=s390x ;;
140- darwin) ARCH=macOS ;;
141- dragonfly) ARCH=DragonFlyBSD ;;
142- freebsd) ARCH=FreeBSD ;;
143- linux) ARCH=Linux ;;
144- netbsd) ARCH=NetBSD ;;
145- openbsd) ARCH=OpenBSD ;;
146113 esac
147114 true
148115}
382349PROJECT_NAME=" trivy"
383350OWNER=aquasecurity
384351REPO=" trivy"
385- BINARY=trivy
386352FORMAT=tar.gz
387353OS=$( uname_os)
388354ARCH=$( uname_arch)
@@ -392,16 +358,15 @@ PREFIX="$OWNER/$REPO"
392358log_prefix () {
393359 echo " $PREFIX "
394360}
395- PLATFORM= " ${OS} / ${ARCH} "
361+
396362GITHUB_DOWNLOAD=https://github.com/${OWNER} /${REPO} /releases/download
363+ GET_DOWNLOAD=https://get.trivy.dev/trivy
397364
398365uname_os_check " $OS "
399366uname_arch_check " $ARCH "
400367
401368parse_args " $@ "
402369
403- get_binaries
404-
405370tag_to_version
406371
407372adjust_format
@@ -414,7 +379,7 @@ log_info "found version: ${VERSION} for ${TAG}/${OS}/${ARCH}"
414379
415380NAME=${PROJECT_NAME} _${VERSION} _${OS} -${ARCH}
416381TARBALL=${NAME} .${FORMAT}
417- TARBALL_URL=${GITHUB_DOWNLOAD} / ${TAG} / ${TARBALL}
382+ TARBALL_URL=" ${GET_DOWNLOAD} ?os= ${OS} &arch= ${ARCH} &version= ${VERSION} &type= ${FORMAT} &client=install-script "
418383CHECKSUM=${PROJECT_NAME} _${VERSION} _checksums.txt
419384CHECKSUM_URL=${GITHUB_DOWNLOAD} /${TAG} /${CHECKSUM}
420385
0 commit comments