1
1
#! /bin/bash
2
2
3
+ set -e
4
+
3
5
HERE=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " > /dev/null 2>&1 && pwd) "
4
6
ROOT=$( cd $HERE /../.. && pwd)
5
7
READIES=$ROOT /opt/readies
6
8
. $READIES /shibumi/defs
7
9
8
- if [[ $1 == --help || $1 == help || $HELP == 1 ]]; then
10
+ if [[ " $1 " == " --help" || " $1 " == " help" || " $HELP " == " 1 " ]]; then
9
11
cat << -END
10
12
Obtain RedisGears module binaries
11
13
12
14
Install_RedisGears.sh [--help|help]
13
-
15
+
14
16
Argument variables:
15
17
GEARS_OSNICK=nick Get binaries for give osnick
16
18
GEARS_PATH=dir Get binaries from given Gears repo
@@ -22,47 +24,47 @@ if [[ $1 == --help || $1 == help || $HELP == 1 ]]; then
22
24
fi
23
25
24
26
OP=" "
25
- [[ $NOP == 1 ]] && OP=echo
27
+ [[ " $NOP " == " 1 " ]] && OP=echo
26
28
27
- os=$( $READIES /bin/platform --os)
28
- arch=$( $READIES /bin/platform --arch)
29
+ os=" $( $READIES /bin/platform --os) "
30
+ arch=" $( $READIES /bin/platform --arch) "
29
31
30
- if [[ ! -z $GEARS_PATH ]]; then
31
- platform=$( $READIES /bin/platform -t)
32
+ if [[ ! -z " $GEARS_PATH " ]]; then
33
+ platform=" $( $READIES /bin/platform -t) "
32
34
else
33
- if [[ $os != linux || $arch != x64 ]]; then
35
+ if [[ " $os " != " linux" || " $arch " != " x64" ]]; then
34
36
eprint " Cannot match binary artifacts - build RedisGears and set GEARS_PATH"
35
37
exit 1
36
38
fi
37
39
38
- dist=$( $READIES /bin/platform --dist)
39
- nick=$( $READIES /bin/platform --osnick)
40
+ dist=" $( $READIES /bin/platform --dist) "
41
+ nick=" $( $READIES /bin/platform --osnick) "
40
42
41
- if [[ $dist == ubuntu ]]; then
42
- if [[ $nick != bionic && $nick != xenial && $nick != trusty ]]; then
43
- nick=bionic
43
+ if [[ $dist == " ubuntu" ]]; then
44
+ if [[ $nick != " bionic" && $nick != " xenial" && $nick != " trusty" ]]; then
45
+ nick=" bionic"
44
46
fi
45
47
elif [[ $dist == debian ]]; then
46
48
nick=bionic
47
49
elif [[ $dist == centos || $dist == redhat || $dist == fedora ]]; then
48
50
nick=centos7
49
- elif [[ ! -z $GEARS_OSNICK ]]; then
50
- nick=" $GEARS_OSNICK "
51
+ elif [[ ! -z " $GEARS_OSNICK " ]]; then
52
+ nick=$GEARS_OSNICK
51
53
else
52
54
eprint " Cannot match binary artifacts - build RedisGears and set GEARS_PATH"
53
55
exit 1
54
56
fi
55
57
platform=" ${os} -${nick} -${arch} "
56
58
fi
57
59
58
- GEARS_S3_URL=http://redismodules.s3.amazonaws.com/redisgears/snapshots
59
- GEARS_MOD=redisgears.${platform} .master.zip
60
- GEARS_DEPS=redisgears-python.${platform} .master.tgz
60
+ GEARS_S3_URL=" http://redismodules.s3.amazonaws.com/redisgears/snapshots"
61
+ GEARS_MOD=" redisgears.${platform} .master.zip"
62
+ GEARS_DEPS=" redisgears-python.${platform} .master.tgz"
61
63
62
- FINAL_WORK_DIR=$ROOT /bin/$( $READIES /bin/platform -t) /RedisGears
64
+ FINAL_WORK_DIR=" $ROOT /bin/$( $READIES /bin/platform -t) /RedisGears"
63
65
64
66
if [[ -d $FINAL_WORK_DIR && -f $FINAL_WORK_DIR /redisgears.so ]]; then
65
- echo " RedisGears is in $FINAL_WORK_DIR "
67
+ echo " RedisGears is in ${ FINAL_WORK_DIR} "
66
68
exit 0
67
69
fi
68
70
@@ -72,20 +74,20 @@ WORK_DIR=$(mktemp -d ${FINAL_WORK_DIR}.XXXXXX)
72
74
$OP mkdir -p $WORK_DIR
73
75
74
76
if [[ -z $GEARS_PATH ]]; then
75
- F_GEARS_MOD=$WORK_DIR /$GEARS_MOD
77
+ F_GEARS_MOD=" $WORK_DIR /$GEARS_MOD "
76
78
if [[ ! -f $F_GEARS_MOD ]]; then
77
79
echo " Download RedisGears ..."
78
80
$OP wget -q -P $WORK_DIR $GEARS_S3_URL /$GEARS_MOD
79
81
fi
80
82
81
- F_GEARS_DEPS=$WORK_DIR /$GEARS_DEPS
83
+ F_GEARS_DEPS=" $WORK_DIR /$GEARS_DEPS "
82
84
if [[ ! -f $F_GEARS_DEPS ]]; then
83
85
echo " Download RedisGears deps ..."
84
86
$OP wget -q -P $WORK_DIR $GEARS_S3_URL /$GEARS_DEPS
85
87
fi
86
88
else
87
- F_GEARS_MOD=$ GEARS_PATH /artifacts/snapshot/$GEARS_MOD
88
- F_GEARS_DEPS=$ GEARS_PATH /artifacts/snapshot/$GEARS_DEPS
89
+ F_GEARS_MOD=" ${ GEARS_PATH} /artifacts/snapshot/${ GEARS_MOD} "
90
+ F_GEARS_DEPS=" ${ GEARS_PATH} /artifacts/snapshot/${ GEARS_DEPS} "
89
91
[[ ! -f $F_GEARS_MOD ]] && { eprint " $F_GEARS_MOD is missing" ; exit 1; }
90
92
[[ ! -f $F_GEARS_DEPS ]] && { eprint " $F_GEARS_DEPS is missing" ; exit 1; }
91
93
fi
0 commit comments