This repository has been archived by the owner on Sep 23, 2020. It is now read-only.
/
dist.sh
124 lines (103 loc) · 3 KB
/
dist.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#!/bin/bash -x
THISDIR="`dirname $0`"
if [ ! -f $THISDIR/environment.sh ]; then
echo "Failure, cannot find environment definitions"
exit 1
fi
source $THISDIR/environment.sh
if [ ! -f $CLCLBUILDER_TARBALL_DEST ]; then
if [ ! -f $CLCLBUILDER_TARBALL_DEST2 ]; then
echo "Cannot find the wscore binary tarball. Did you download it? See README file."
exit 1
else
CLCLBUILDER_TARBALL_DEST="$CLCLBUILDER_TARBALL_DEST2"
fi
fi
CHECKSUM=`openssl md5 $CLCLBUILDER_TARBALL_DEST | awk '{print $2}'`
if [ $? -ne 0 ]; then
echo "Checksum failed"
exit 1
fi
# remember, two spaces between checksum value and filename in expected output:
if [ "$CHECKSUM" != "$CLCLBUILDER_WSCORE_MD5SUM" ]; then
echo "Checksum comparison failed"
exit 1
fi
echo "Checksum succeeds on $CLCLBUILDER_TARBALL_DEST"
if [ -e $CLCLBUILDER_DIST_DIRECTORY ]; then
echo "Deleting dist directory: $CLCLBUILDER_DIST_DIRECTORY"
rm -rf $CLCLBUILDER_DIST_DIRECTORY
if [ $? -ne 0 ]; then
echo "Deleting dist directory failed"
exit 1
fi
fi
mkdir $CLCLBUILDER_DIST_DIRECTORY
if [ $? -ne 0 ]; then
echo "Creating new dist directory failed"
exit 1
fi
echo "Created new dist directory: $CLCLBUILDER_DIST_DIRECTORY"
if [ ! -d $CLCLBUILDER_SRC_DIRECTORY ]; then
echo "Cannot find cloud client source directory? $CLCLBUILDER_SRC_DIRECTORY"
exit 1
fi
cp -a $CLCLBUILDER_SRC_DIRECTORY/* $CLCLBUILDER_DIST_DIRECTORY/
if [ $? -ne 0 ]; then
echo "cp -a failed, exiting"
exit 1
fi
mkdir $CLCLBUILDER_DIST_DIRECTORY/history
if [ $? -ne 0 ]; then
echo "could not created empty history dir inside dist dir, exiting"
exit 1
fi
chmod +x $CLCLBUILDER_DIST_DIRECTORY/bin/*
if [ $? -ne 0 ]; then
echo "could not chmod +x the scripts in dist dir, exiting"
exit 1
fi
# do not proceed if directory exists
if [ -e $GLOBUS_LOCATION ]; then
echo "Failure, target GLOBUS_LOCATION directory exists? $GLOBUS_LOCATION"
exit 1
fi
if [ -d $CLCLBUILDER_WSCORE_DIRNAME ]; then
echo "Failure, target of the wscore tarball expansion exists? $CLCLBUILDER_WSCORE_DIRNAME"
exit 1
fi
tar xzf $CLCLBUILDER_TARBALL_DEST -C $CLCLBUILDER_BASEDIR
if [ $? -ne 0 ]; then
echo ""
echo "wscore tar expansion failed, exiting"
exit 1
fi
mv $CLCLBUILDER_BASEDIR/$CLCLBUILDER_WSCORE_DIRNAME $GLOBUS_LOCATION
if [ $? -ne 0 ]; then
echo "Creating new embedded globus directory (via mv) failed"
exit 1
fi
echo "Prepared dist directory, building Java parts of the cloud client into it now:"
if [ ! -f $NIMBUS_CLIENT_INSTALL_SCRIPT ]; then
echo "Cannot find Nimbus build and install script? $NIMBUS_CLIENT_INSTALL_SCRIPT"
exit 1
fi
/bin/bash $NIMBUS_CLIENT_INSTALL_SCRIPT
if [ $? -ne 0 ]; then
echo ""
echo "Client build failed, exiting"
exit 1
fi
echo ""
echo "Creating dist tar.gz: $CLCLBUILDER_BASEDIR/$CLCLBUILDER_DIST_TARNAME"
echo ""
cd $CLCLBUILDER_BASEDIR
tar czf $CLCLBUILDER_DIST_TARNAME $CLCLBUILDER_RELEASE_NAME
RESULT=$?
if [ $RESULT -ne 0 ]; then
echo ""
echo "Tarball creation failed"
else
echo "Done."
fi
exit $RESULT