blob: b248c5c7350989087952c9a389f628c8b185f23f (
plain)
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
|
#!/bin/bash
#------------------------------------------------------------------
# Copyright (c) 2006-2011 Gluster, Inc. <http://www.gluster.com>
# This file is part of Gluster Management Console.
#
# Gluster Management Console is free software; you can redistribute
# it and/or modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation; either
# version 3 of the License, or (at your option) any later version.
#
# Gluster Management Console is distributed in the hope that it
# will be useful, but WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see
# <http://www.gnu.org/licenses/>.
#------------------------------------------------------------------
set -e
GMC_TARGET_URL='git@github.com:gluster/gmc-target.git'
BUCKMINSTER_URL=http://download.eclipse.org/tools/buckminster/headless-3.7/
BUCKMINSTER_PRODUCT_NAME=org.eclipse.buckminster.cmdline.product
GMC_WEBSTART_PROJECT=org.gluster.storage.management.console.feature.webstart
GMC_CORE_PROJECT=org.gluster.storage.management.core
GMG_PROJECT=org.gluster.storage.management.gateway
# Get the director that can be used to install headless buckminster
get_director()
{
mkdir -p ${TOOLS_DIR}
cd ${TOOLS_DIR}
echo "Downloading buckminster director..."
wget -c http://ftp.daum.net/eclipse//tools/buckminster/products/director_latest.zip
if ! unzip -tqq director_latest.zip; then
rm -f director_latest.zip
wget http://ftp.daum.net/eclipse//tools/buckminster/products/director_latest.zip
fi
unzip -q director_latest.zip
cd -
}
install_buckminster()
{
mkdir -p ${BUCKMINSTER_HOME}
echo "Installing buckminster..."
cd ${TOOLS_DIR}/director
./director -r ${BUCKMINSTER_URL} -d ${BUCKMINSTER_HOME} -p Buckminster -i ${BUCKMINSTER_PRODUCT_NAME}
echo "Setting up buckminster..."
cd ${BUCKMINSTER_HOME}
echo " => core"
./buckminster install ${BUCKMINSTER_URL} org.eclipse.buckminster.core.headless.feature
echo " => pde"
./buckminster install ${BUCKMINSTER_URL} org.eclipse.buckminster.pde.headless.feature
echo " => git"
./buckminster install ${BUCKMINSTER_URL} org.eclipse.buckminster.git.headless.feature
echo " => emma"
./buckminster install ${BUCKMINSTER_URL} org.eclipse.buckminster.emma.headless.feature
cd -
}
# Create keystore for jar signing (self signed)
setup_keys()
{
mkdir -p ${KEYS_DIR}
cd ${KEYS_DIR}
keytool -genkeypair -keystore gluster.keystore -storepass gluster -alias gluster -keyalg RSA << EOF
Gluster Temp Build
Gluster
Gluster
Dummy
Dummy
US
yes
EOF
keytool -selfcert -alias gluster -keystore gluster.keystore << EOF
gluster
EOF
cd -
}
configure_workspace()
{
echo "Configuring the workspace..."
rm -rf ${WORKSPACE_DIR}
mkdir -p ${WORKSPACE_DIR}
cd ${WORKSPACE_DIR}
for f in $src_dir/*; do
ln -s $f
done
if [ ! -e gmc-target ]; then
ln -s $gmc_target_dir gmc-target
fi
echo "Importing target platform..."
${BUCKMINSTER_HOME}/buckminster importtarget -data ${WORKSPACE_DIR} --active gmc-target/org.gluster.storage.management.console.target/gmc.target
cd -
}
build_gmc()
{
os=${1}
ws=${2}
arch=${3}
cd ${WORKSPACE_DIR}
DIST_DIR=${DIST_BASE}/gmc/${os}.${ws}.${arch}
if [ ! -d ${DIST_DIR} ]; then
mkdir -p ${DIST_DIR}
fi
echo "Importing component query for glustermc..."
${BUCKMINSTER_HOME}/buckminster import -data ${WORKSPACE_DIR} build/org.gluster.storage.management.console.feature.webstart.cquery
echo "Building GMC for [${os}.${ws}.${arch}]"
${BUCKMINSTER_HOME}/buckminster perform -Dbuckminster.output.root=${DIST_DIR} -data ${WORKSPACE_DIR} -Dtarget.os=${os} -Dtarget.ws=${ws} -Dtarget.arch=${arch} -Dcbi.include.source=false --properties ${PROPERTIES_FILE} ${GMC_WEBSTART_PROJECT}#create.eclipse.jnlp.product
${BUCKMINSTER_HOME}/buckminster perform -Dbuckminster.output.root=${DIST_DIR} -data ${WORKSPACE_DIR} --properties ${PROPERTIES_FILE} ${GMC_WEBSTART_PROJECT}#copy.root.files
# buckminster signs the jars using eclipse certificate - hence unsign and sign them again
echo "Signing product jars..."
${BUCKMINSTER_HOME}/buckminster perform -data ${WORKSPACE_DIR} -Dbuckminster.output.root=${DIST_DIR} --properties ${PROPERTIES_FILE} ${GMC_WEBSTART_PROJECT}#unsign.jars
${BUCKMINSTER_HOME}/buckminster perform -data ${WORKSPACE_DIR} -Dbuckminster.output.root=${DIST_DIR} -Djar.signing.keystore=${KEYS_DIR}/gluster.keystore --properties ${PROPERTIES_FILE} ${GMC_WEBSTART_PROJECT}#sign.jars
}
build_gmg()
{
cd ${WORKSPACE_DIR}
export DIST_DIR=${DIST_BASE}/gmg
if [ ! -d ${DIST_DIR} ]; then
mkdir -p ${DIST_DIR}
fi
echo "Importing component query for glustermg..."
${BUCKMINSTER_HOME}/buckminster import -data ${WORKSPACE_DIR} build/org.gluster.storage.management.core.cquery
${BUCKMINSTER_HOME}/buckminster import -data ${WORKSPACE_DIR} build/org.gluster.storage.management.gateway.cquery
echo "Building CORE..."
${BUCKMINSTER_HOME}/buckminster perform -Dbuckminster.output.root=${DIST_DIR} -data ${WORKSPACE_DIR} -Dcbi.include.source=false --properties ${PROPERTIES_FILE} ${GMC_CORE_PROJECT}#bundle.jar
echo "Building Gateway..."
${BUCKMINSTER_HOME}/buckminster perform -Dbuckminster.output.root=${DIST_DIR} -data ${WORKSPACE_DIR} -Dcbi.include.source=false --properties ${PROPERTIES_FILE} ${GMG_PROJECT}#archive
echo "Packaging Gateway..."
${SCRIPT_DIR}/package-gateway.sh ${DIST_DIR} ${DIST_BASE}/gmc
}
package_backend()
{
cd ${WORKSPACE_DIR}
echo "Packaging backend scripts"
export DIST_DIR=${DIST_BASE}/gmg-backend
if [ ! -d ${DIST_DIR} ]; then
mkdir -p ${DIST_DIR}
fi
${SCRIPT_DIR}/package-backend.sh ${DIST_DIR}
}
build_gmc_all()
{
build_gmc linux gtk x86
build_gmc linux gtk x86_64
build_gmc win32 win32 x86
build_gmc win32 win32 x86_64
build_gmc macosx cocoa x86
build_gmc macosx cocoa x86_64
}
build()
{
export VERSION=1.0.0
build_gmc_all
build_gmg
package_backend
}
#-----------------------------------
# Main Action Body
#-----------------------------------
ME=$(basename $0)
function show_help()
{
cat <<EOF
Usage: $ME [-f] [-h] [GMC-TARGET-DIR]
Build Gluster Management Console from source.
General:
-f Force build
Miscellaneous:
-h display this help and exit
Example:
$ME gmc-build
$ME gmc-build ~/gmc-target
EOF
}
function main()
{
# Parse command line arguments.
while getopts :fh OPT; do
case "$OPT" in
h)
show_help
exit 0
;;
f)
force=yes
;;
\?)
# getopts issues an error message
echo "Invalid option: -$OPTARG"
show_help
exit 1
;;
:)
echo "Option -$OPTARG requires an argument."
show_help
exit 1
;;
esac
done
# Remove the switches we parsed above.
shift `expr $OPTIND - 1`
# We want only one non-option argument.
if [ $# -gt 1 ]; then
show_help
exit 1
fi
gmc_target_dir=$1
src_dir=$(dirname $(dirname $(readlink -e $0)))
build_dir=$PWD/.gmc-build
if [ -z "$gmc_target_dir" ]; then
gmc_target_dir=$PWD/gmc-target
if [ ! -e "$gmc_target_dir" ]; then
git clone $GMC_TARGET_URL $gmc_target_dir
fi
fi
if [ "$force" = "yes" ]; then
rm -fr $build_dir
fi
TOOLS_DIR=${build_dir}/tools
DIST_BASE=${build_dir}/dist
KEYS_DIR=${TOOLS_DIR}/keys
BUCKMINSTER_HOME=${TOOLS_DIR}/buckminster
WORKSPACE_DIR=${BUCKMINSTER_HOME}/workspace
PROPERTIES_FILE=${WORKSPACE_DIR}/build/glustermc_build.properties
SCRIPT_DIR=$src_dir/build
if [ ! -e $build_dir ]; then
mkdir -p $build_dir
if [ ! -e ${TOOLS_DIR} ]; then
get_director
fi
if [ ! -e ${BUCKMINSTER_HOME} ]; then
install_buckminster
fi
if [ ! -e ${KEYS_DIR} ]; then
setup_keys
fi
fi
configure_workspace
build
mv ${DIST_BASE}/gmg/gmg-installer-*.tar.gz ${DIST_BASE}/gmg-backend/gmg-backend-installer-*.tar.gz .
}
main "$@";
|