diff --git a/SHA256SUMS b/SHA256SUMS index 4ce46ad..5ccb1ed 100644 --- a/SHA256SUMS +++ b/SHA256SUMS @@ -1,2 +1,2 @@ 05e4977d541b2ef07c757acca912b7b58b379fb425eceb3a1f53c829a78a4aa4 docker2aci.sh -54cf7735ce36c401e8bb728aaf75ec64d50c89e737fa33a6a017d087990c0d91 golang.sh +159cebe6207975d84c8013ebc154819ca59802dec42c7b44c65be5ec0e56e8d2 golang.sh diff --git a/golang.sh b/golang.sh index 2cb54dd..c1ba2b8 100755 --- a/golang.sh +++ b/golang.sh @@ -4,11 +4,6 @@ set -euo pipefail curl -sL https://raw.githubusercontent.com/Luzifer/github-publish/master/SHA256SUMS | grep "golang.sh" | sha256sum -c || exit 2 -(which zip 2>&1 1>/dev/null) || { - (which apk 2>&1 1>/dev/null) && apk add --update gawk zip - (which apt-get 2>&1 1>/dev/null) && apt-get update && apt-get install -y zip -} - function log() { echo "${@}" >&2 } @@ -21,6 +16,15 @@ function substep() { log "======> $@..." } +required_tools=(go sha256sum tar zip) + +for tool in "${required_tools[@]}"; do + (command -v apk 2>&1 1>/dev/null) || { + log "Missing tool '${tool}'" + exit 1 + } +done + VERSION=$(git describe --tags --always || echo "dev") PWD=$(pwd) godir=${PWD/${GOPATH}\/src\//} @@ -77,8 +81,9 @@ for package in "${PACKAGES[@]}"; do export GOOS=${osarch%%/*} export GOARCH=${osarch##*/} - [[ ${GOOS} == "windows" ]] && suffix=".exe" || suffix="" - outfile="${BUILD_DIR}/${package##*/}_${GOOS}_${GOARCH}${suffix}" + [[ $GOOS == "windows" ]] && suffix=".exe" || suffix="" + [[ $package == '.' ]] && bname="${PWD##*/}" || bname="${package##*/}" + outfile="${BUILD_DIR}/${bname}_${GOOS}_${GOARCH}${suffix}" substep "Build for ${osarch} into ${outfile}"