From a74b20f278300583d2eff0b1c60f5509bb812ef8 Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Fri, 17 Jul 2015 17:26:33 -0600 Subject: [PATCH] .zip for Win/Mac, .tar.gz for Linux/BSD --- dist/automate.sh | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/dist/automate.sh b/dist/automate.sh index 4a91d611e..3cc8d41b2 100755 --- a/dist/automate.sh +++ b/dist/automate.sh @@ -19,28 +19,37 @@ ReleaseDir=$DistDir/release # Compile binaries mkdir -p $BuildDir cd $BuildDir -rm -f * +rm -f caddy* gox $Package # Zip them up with release notes and stuff mkdir -p $ReleaseDir cd $ReleaseDir -rm -f * +rm -f caddy* for f in $BuildDir/* do # Name .zip file same as binary, but strip .exe from end - zipname=$(basename ${f%".exe"}).zip + zipname=$(basename ${f%".exe"}) + if [[ $f == *"linux"* ]] || [[ $f == *"bsd"* ]]; then + zipname=${zipname}.tar.gz + else + zipname=${zipname}.zip + fi # Binary inside the zip file is simply the project name - bin=$BuildDir/$(basename $Package) - if [[ $f == *.exe ]] - then - bin=$bin.exe + binbase=$(basename $Package) + if [[ $f == *.exe ]]; then + binbase=$binbase.exe fi + bin=$BuildDir/$binbase mv $f $bin # Compress distributable - zip -j $zipname $bin $DistDir/CHANGES.txt $DistDir/LICENSES.txt $DistDir/README.txt + if [[ $zipname == *.zip ]]; then + zip -j $zipname $bin $DistDir/CHANGES.txt $DistDir/LICENSES.txt $DistDir/README.txt + else + tar -cvzf $zipname -C $BuildDir $binbase -C $DistDir CHANGES.txt LICENSES.txt README.txt + fi # Put binary filename back to original mv $bin $f