From c7385b3681248d5935743c007d17fda724cc142f Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Sun, 30 Oct 2016 16:10:40 +0100 Subject: [PATCH] build.bash: abort if we hit a known-bad go-fuse version Also, standardize to "if [[ ]] ; then" style. --- build.bash | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/build.bash b/build.bash index 4090c71..c8f6111 100755 --- a/build.bash +++ b/build.bash @@ -11,13 +11,21 @@ GOPATH2=$(echo $GOPATH | cut -f1 -d:) GITVERSION=$(git describe --tags --dirty) # go-fuse version according to git +# Note: git in CentOS 7 does not have "git -C" yet. That's why we use +# plain "cd" in a subshell. GITVERSIONFUSE=$( cd $GOPATH2/src/github.com/hanwen/go-fuse SHORT=$(git rev-parse --short HEAD) + if [[ $SHORT == 5e829bc ]] ; then + echo "Error: The version $SHORT of the go-fuse library has a known crasher that" >&2 + echo "has been fixed by https://github.com/hanwen/go-fuse/pull/131 . Please upgrade." >&2 + exit 1 + fi + # Check if the tree is dirty, adapted from # http://stackoverflow.com/a/2659808/1380267 - if ! git diff-index --quiet HEAD; then + if ! git diff-index --quiet HEAD ; then echo $SHORT-dirty else echo $SHORT @@ -33,8 +41,7 @@ go version > /dev/null # "go version go1.6.2 linux/amd64" -> "1.6" V=$(go version | cut -d" " -f3 | cut -c3-5) -if [ $V == "1.3" -o $V == "1.4" ] -then +if [[ $V == "1.3" || $V == "1.4" ]] ; then go build -ldflags="-X main.GitVersion $GITVERSION -X main.GitVersionFuse $GITVERSIONFUSE -X main.BuildTime $BUILDTIME" $@ else # Go 1.5 wants an "=" here