Skip to content
This repository was archived by the owner on Nov 26, 2024. It is now read-only.
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
23 changes: 22 additions & 1 deletion .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
25 changes: 13 additions & 12 deletions install
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -83,28 +86,26 @@ 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}"
if [ "${version}" = "latest" ]; then
assetUri="${githubUrl}/${owner}/${repo}/releases/latest/download/${fileName}"
fi

downloadFolder="/tmp/${binary}"
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
Expand Down