From 64f717ce77a997b215cbe606c74e18d247262602 Mon Sep 17 00:00:00 2001 From: Nicolas Devoir <2044638+Begi@users.noreply.github.com> Date: Tue, 10 May 2022 13:00:57 +0200 Subject: [PATCH 1/3] fix: sh if compare --- install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install b/install index 9aa25e3..f7d6f83 100755 --- a/install +++ b/install @@ -88,7 +88,7 @@ command -v curl >/dev/null 2>&1 || { logF "curl is required"; } # Set URI to download assetUri="${githubUrl}/${owner}/${repo}/releases/download/${version}/${fileName}" -if [[ "${version}" == "latest" ]]; then +if [ "${version}" = "latest" ]; then asset=$( curl -sSf ${githubUrl}/${owner}/${repo}/releases | From 784c2c9bb8258eb80c540b0f8b8ff104cca5a962 Mon Sep 17 00:00:00 2001 From: Nicolas Devoir <2044638+Begi@users.noreply.github.com> Date: Tue, 10 May 2022 15:26:47 +0200 Subject: [PATCH 2/3] fix install --- install | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/install b/install index f7d6f83..89c6b6f 100755 --- a/install +++ b/install @@ -4,6 +4,9 @@ # # $ sh -c "$(curl -L https://github.com/intercloud/gobinsec/releases/latest/download/install)" # +# or (if you don't have curl installed): +# +# $ sh -c "$(wget -O - https://github.com/intercloud/gobinsec/releases/latest/download/install)" set -e @@ -83,20 +86,18 @@ else executableFolder="/bin" fi -# check command availability -command -v curl >/dev/null 2>&1 || { logF "curl is required"; } +if command -v curl >/dev/null 2>&1; then + downloadCmd="curl -sS --fail --location --output " +elif command -v wget >/dev/null 2>&1; then + downloadCmd="wget --quiet --output-document=" +else + logF "curl or wget is required" +fi # Set URI to download assetUri="${githubUrl}/${owner}/${repo}/releases/download/${version}/${fileName}" if [ "${version}" = "latest" ]; then - - asset=$( - curl -sSf ${githubUrl}/${owner}/${repo}/releases | - grep -o "${owner}/${repo}/releases/download/.*/${fileName}" | - head -n 1 - ) - - assetUri="${githubUrl}/${asset}" + assetUri="${githubUrl}/${owner}/${repo}/releases/latest/download/${fileName}" fi downloadFolder="/tmp/${binary}" @@ -104,7 +105,7 @@ mkdir -p ${downloadFolder} downloadedFile="${downloadFolder}/${fileName}" log "[1/2] Download ${assetUri}" -curl -sS --fail --location --output "${downloadedFile}" "${assetUri}" +$downloadCmd"${downloadedFile}" "${assetUri}" log "[2/2] Install ${binary} to '${executableFolder}'" if [ -w "${directory}" ]; then From 0e3db96757060b1daead3788dade1382b70c94c1 Mon Sep 17 00:00:00 2001 From: Nicolas Devoir <2044638+Begi@users.noreply.github.com> Date: Tue, 10 May 2022 15:27:40 +0200 Subject: [PATCH 3/3] feat: add os arch --- .goreleaser.yaml | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 7da5d70..ae9a3b5 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -12,6 +12,27 @@ builds: - linux - windows - darwin + - aix + - dragonfly + - freebsd + - netbsd + - openbsd + - plan9 + - solaris + goarch: + - amd64 + - arm + - arm64 + - '386' + - wasm + - mips + - mips64 + - mips64le + - mipsle + - ppc64 + - ppc64le + - riscv64 + - s390x ldflags: - -X main.Version={{.Version}} -s -f @@ -42,7 +63,7 @@ brews: bin.install "gobinsec" # Archive all attachements archives: - - name_template: '{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}' + - name_template: '{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}' format_overrides: - goos: windows format: zip