release: gz doesn't preserve permissions use tar.gz

And fix various other issues with release script.
This commit is contained in:
Harshavardhana 2016-03-21 15:47:43 -07:00
parent 1502e2f29f
commit 59ee5a547c
3 changed files with 27 additions and 14 deletions

View File

@ -73,7 +73,7 @@ getdeps: checks
@go get -u github.com/remyoudompheng/go-misc/deadcode && echo "Installed deadcode:"
@go get -u github.com/client9/misspell/cmd/misspell && echo "Installed misspell:"
verifiers: getdeps vet fmt lint cyclo spelling
verifiers: vet fmt lint cyclo spelling
vet:
@echo "Running $@:"
@ -137,7 +137,7 @@ pkg-list:
install: gomake-all
dockerimage: checkdocker verifiers $(UI_ASSETS)
dockerimage: checkdocker getdeps verifiers $(UI_ASSETS)
@echo "Building docker image:" minio:$(TAG)
@GO15VENDOREXPERIMENT=1 GOOS=linux GOARCH=amd64 go build --ldflags $(DOCKER_LDFLAGS) -o docker/minio.dockerimage
@cd docker; mkdir -p export; sudo docker build --rm --tag=minio/minio:$(TAG) .

View File

@ -26,10 +26,12 @@ _init() {
SUPPORTED_OSARCH='linux/386 linux/amd64 linux/arm windows/386 windows/amd64 darwin/amd64'
## System binaries
CP="/bin/cp"
SHASUM="/usr/bin/shasum"
GZIP="/usr/bin/gzip"
ZIP="/usr/bin/zip"
CP=`which cp`
SHASUM=`which shasum`
GZIP=`which gzip`
ZIP=`which zip`
SED=`which sed`
TAR=`which tar`
}
go_build() {
@ -47,25 +49,36 @@ go_build() {
# Release shasum name
release_shasum="$release_str/$os-$arch/$(basename $package).shasum"
# Release zip file.
release_real_zip="$release_str/$os-$arch/$(basename $package).zip"
release_real_gz="$release_str/$os-$arch/$(basename $package).gz"
release_real_zip="$(basename $package).zip"
release_real_tgz="$(basename $package).tgz"
# Go build to build the binary.
GOOS=$os GOARCH=$arch go build --ldflags "${LDFLAGS}" -o $release_bin
# Create copy
if [ $os == "windows" ]; then
$CP -p $release_bin ${release_real_bin}.exe
else
$CP -p $release_bin $release_real_bin
fi
# Calculate shasum
$SHASUM $release_bin > $release_shasum
shasum_str=$(${SHASUM} ${release_bin})
echo ${shasum_str} | $SED "s/$release_str\/$os-$arch\///g" > $release_shasum
# Create a compressed file.
if [ $os == "windows" ]; then
$ZIP -r $release_real_zip $release_real_bin
cd "$release_str/$os-$arch"
$ZIP -r $release_real_zip $(basename $package).exe
cd -
elif [ $os == "darwin" ]; then
$ZIP -r $release_real_zip $release_real_bin
cd "$release_str/$os-$arch"
$ZIP -r $release_real_zip $(basename $package)
cd -
elif [ $os == "linux" ]; then
$GZIP -c $release_real_bin > $release_real_gz
cd "$release_str/$os-$arch"
$TAR -czf $release_real_tgz $(basename $package)
cd -
else
echo "$os operating system is not supported."
exit 1

View File

@ -148,7 +148,7 @@ func getReleaseUpdate(updateURL string, noError bool) updateMessage {
downloadURL = newUpdateURLPrefix + "/minio.zip"
default:
// For all other operating systems.
downloadURL = newUpdateURLPrefix + "/minio.gz"
downloadURL = newUpdateURLPrefix + "/minio.tgz"
}
// Initialize update message.