move gopath check to separate script and use realpath for symlink handling
License: MIT Signed-off-by: Jeromy <jeromyj@gmail.com>
Jeromy committed
Feb 23, 2016 at 22:26 UTC
65519a0367c333c50b8808ed57504b3aad17b6f5
2 files changed
+21
-1
Makefile
+1
-1
@@ -29,7 +29,7 @@ gxgo_upgrade:
29
go get -u github.com/whyrusleeping/gx-go
30
31
path_check:
32
- test "$(shell pwd)" = "$(GOPATH)/src/github.com/ipfs/go-ipfs" || (echo "go-ipfs must be built from within your \$$GOPATH directory." && false)
32
+ @bin/check_go_path
33
34
gx_check:
35
@bin/check_gx_program "gx" "0.3" 'Upgrade or install gx using your package manager or run `make gx_upgrade`'
bin/check_go_path
new
+20
@@ -0,0 +1,20 @@
1
+#!/bin/sh
2
+
3
+if [ -z "$GOPATH" ]; then
4
+ echo "GOPATH not set, you must have go configured properly to install ipfs"
5
+ exit 1
6
+fi
7
+
8
+if ! type -f realpath > /dev/null; then
9
+ echo "program 'realpath' not found, it is required for this check"
10
+ exit 1
11
+fi
12
+
13
+PWD=$(pwd)
14
+REALPWD=$(realpath "$PWD")
15
+EXPECTED="$GOPATH/src/github.com/ipfs/go-ipfs"
16
+
17
+if [ "$REALPWD" != "$EXPECTED" ]; then
18
+ echo "go-ipfs must be built from within your \$GOPATH directory."
19
+ exit 1
20
+fi