-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·85 lines (75 loc) · 1.59 KB
/
install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/bin/bash
PROGNAME=$(basename $0)
queue_type=q4m
prefix=/usr/local/stf
usage() {
echo "Usage: $PROGNAME [OPTIONS]"
echo " Installer script for go-stf-server"
echo
echo "Options:"
echo " -h, --help"
echo " -q, --queue [ q4m | redo ] (default: $queue_type)"
echo " --prefix ARG (default: $prefix)"
echo
exit 1
}
for OPT in "$@"
do
case "$OPT" in
'-h'|'--help')
usage
exit 1
;;
'-q'|'--queue')
queue_type=$2
shift 2
;;
'--prefix')
prefix=$2
shift 2
;;
'--'|'-' )
shift 1
param+=( "$@" )
break
;;
-*)
echo "$PROGNAME: illegal option -- '$(echo $1 | sed 's/^-*//')'" 1>&2
exit 1
;;
*)
if [[ ! -z "$1" ]] && [[ ! "$1" =~ ^-+ ]]; then
#param=( ${param[@]} "$1" )
param+=( "$1" )
shift 1
fi
;;
esac
done
# Check we have hg
output=$(hg --version)
if [ "$?" != "0" ]; then
echo "hg is required to install go-stf-server's dependencies"
exit 1
fi
# Check we have git
output=$(git --version)
if [ "$?" != "0" ]; then
echo "git is required to install go-stf-server"
exit 1
fi
dir=$(mktemp -d -t go-stf-server)
if [ "$?" != "0" ]; then
echo "failed to create temporary directory"
exit 1
fi
export GOPATH=$dir
go get -tags $queue_type -v github.com/stf-storage/go-stf-server/...
CMDS="dispatcher storage stf-worker stf-worker-delete_object stf-worker-repair_object stf-worker-replicate_object stf-worker-storage_health"
for cmd in $CMDS
do
echo "building $cmd..."
go build -tags $queue_type -o $prefix/bin/$cmd github.com/stf-storage/go-stf-server/cli/$cmd
done
rm -rf $dir
echo "Installed go-stf-server (queue: $queue_type) in $prefix"