-
Notifications
You must be signed in to change notification settings - Fork 86
/
zimbra-store.sh
executable file
·372 lines (312 loc) · 23.7 KB
/
zimbra-store.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
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
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
#!/bin/bash
#
# ***** BEGIN LICENSE BLOCK *****
# Zimbra Collaboration Suite Server
# Copyright (C) 2009, 2010, 2011, 2013, 2014, 2015, 2016 Synacor, Inc.
#
# This program 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,
# version 2 of the License.
#
# This program 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 <https://www.gnu.org/licenses/>.
# ***** END LICENSE BLOCK *****
# Shell script to create zimbra store package
set -e
#-------------------- Configuration ---------------------------
currentScript=`basename $0 | cut -d "." -f 1` # zimbra-store
currentPackage=`echo ${currentScript}build | cut -d "-" -f 2` # storebuild
#-------------------- Build Package ---------------------------
main()
{
echo -e "\tCreate package directories" >> ${buildLogFile}
mkdir -p ${repoDir}/zm-build/${currentPackage}/etc/sudoers.d
mkdir -p ${repoDir}/zm-build/${currentPackage}/opt/zimbra/bin
mkdir -p ${repoDir}/zm-build/${currentPackage}/opt/zimbra/conf/templates
echo -e "\tCopy package files" >> ${buildLogFile}
echo -e "\tCopy etc files" >> ${buildLogFile}
cp ${repoDir}/zm-build/rpmconf/Env/sudoers.d/02_${currentScript} ${repoDir}/zm-build/${currentPackage}/etc/sudoers.d/02_${currentScript}
echo -e "\tCopy bin files of /opt/zimbra/" >> ${buildLogFile}
if [ "${buildType}" == "NETWORK" ]
then
cp -f ${repoDir}/zm-hsm/src/bin/zmhsm ${repoDir}/zm-build/${currentPackage}/opt/zimbra/bin/zmhsm
cp -f ${repoDir}/zm-hsm/src/bin/zmschedulesmpolicy ${repoDir}/zm-build/${currentPackage}/opt/zimbra/bin/zmschedulesmpolicy
cp -f ${repoDir}/zm-archive-utils/src/bin/zmarchiveconfig ${repoDir}/zm-build/${currentPackage}/opt/zimbra/bin/zmarchiveconfig
cp -f ${repoDir}/zm-archive-utils/src/bin/zmarchivesearch ${repoDir}/zm-build/${currentPackage}/opt/zimbra/bin/zmarchivesearch
cp -f ${repoDir}/zm-sync-tools/src/bin/zmsyncreverseproxy ${repoDir}/zm-build/${currentPackage}/opt/zimbra/bin/zmsyncreverseproxy
cp -f ${repoDir}/zm-sync-store/src/bin/zmdevicesstats ${repoDir}/zm-build/${currentPackage}/opt/zimbra/bin/zmdevicesstats
cp -f ${repoDir}/zm-sync-store/src/bin/zmgdcutil ${repoDir}/zm-build/${currentPackage}/opt/zimbra/bin/zmgdcutil
cp -f ${repoDir}/zm-sync-store/src/bin/zmmdmmailschedule ${repoDir}/zm-build/${currentPackage}/opt/zimbra/bin/zmmdmmailschedule
fi
cp -f ${repoDir}/zm-migration-tools/zmztozmig.conf ${repoDir}/zm-build/${currentPackage}/opt/zimbra/conf/zmztozmig.conf
cp -f ${repoDir}/zm-mailbox/store-conf/conf/owasp_policy.xml ${repoDir}/zm-build/${currentPackage}/opt/zimbra/conf/owasp_policy.xml
cp -f ${repoDir}/zm-mailbox/store-conf/conf/antisamy.xml ${repoDir}/zm-build/${currentPackage}/opt/zimbra/conf/antisamy.xml
cp -f ${repoDir}/zm-mailbox/store-conf/conf/custom-mimetypes.xml ${repoDir}/zm-build/${currentPackage}/opt/zimbra/conf/custom-mimetypes.xml
echo -e "\tCopy extensions-extra files of /opt/zimbra/" >> ${buildLogFile}
mkdir -p ${repoDir}/zm-build/${currentPackage}/opt/zimbra/extensions-extra/openidconsumer
cp -rf ${repoDir}/zm-openid-consumer-store/build/dist/. ${repoDir}/zm-build/${currentPackage}/opt/zimbra/extensions-extra/openidconsumer
rm -rf ${repoDir}/zm-build/${currentPackage}/opt/zimbra/extensions-extra/openidconsumer/extensions-extra
if [ "${buildType}" == "NETWORK" ]
then
echo -e "\tCopy extensions-network-extra files of /op/zimbra/" >> ${buildLogFile}
mkdir -p ${repoDir}/zm-build/${currentPackage}/opt/zimbra/extensions-network-extra
cp -rf ${repoDir}/zm-saml-consumer-store/build/dist/saml ${repoDir}/zm-build/${currentPackage}/opt/zimbra/extensions-network-extra/
fi
echo -e "\tCopy lib files of /opt/zimbra/" >> ${buildLogFile}
echo -e "\t\tCopy ext files of /opt/zimbra/lib/" >> ${buildLogFile}
mkdir -p ${repoDir}/zm-build/${currentPackage}/opt/zimbra/lib/jars
mkdir -p ${repoDir}/zm-build/${currentPackage}/opt/zimbra/libexec
mkdir -p ${repoDir}/zm-build/${currentPackage}/opt/zimbra/lib/ext/mitel
mkdir -p ${repoDir}/zm-build/${currentPackage}/opt/zimbra/lib/ext/clamscanner
mkdir -p ${repoDir}/zm-build/${currentPackage}/opt/zimbra/lib/ext/twofactorauth
mkdir -p ${repoDir}/zm-build/${currentPackage}/opt/zimbra/lib/ext/nginx-lookup
mkdir -p ${repoDir}/zm-build/${currentPackage}/opt/zimbra/lib/ext/openidconsumer
mkdir -p ${repoDir}/zm-build/${currentPackage}/opt/zimbra/lib/ext/zimbra-license
mkdir -p ${repoDir}/zm-build/${currentPackage}/opt/zimbra/lib/ext/zimbra-freebusy
mkdir -p ${repoDir}/zm-build/${currentPackage}/opt/zimbra/lib/ext/zimbraadminversioncheck
mkdir -p ${repoDir}/zm-build/${currentPackage}/opt/zimbra/lib/ext/zimbraldaputils
mkdir -p ${repoDir}/zm-build/${currentPackage}/opt/zimbra/lib/ext/zm-oauth-social
mkdir -p ${repoDir}/zm-build/${currentPackage}/opt/zimbra/lib/ext/zm-gql
mkdir -p ${repoDir}/zm-build/${currentPackage}/opt/zimbra/lib/ext-common
if [ "${buildType}" == "NETWORK" ]
then
mkdir -p ${repoDir}/zm-build/${currentPackage}/opt/zimbra/lib/ext/backup
mkdir -p ${repoDir}/zm-build/${currentPackage}/opt/zimbra/lib/ext/zimbra-archive
mkdir -p ${repoDir}/zm-build/${currentPackage}/opt/zimbra/lib/ext/voice
mkdir -p ${repoDir}/zm-build/${currentPackage}/opt/zimbra/lib/ext/mitel
mkdir -p ${repoDir}/zm-build/${currentPackage}/opt/zimbra/lib/ext/cisco
mkdir -p ${repoDir}/zm-build/${currentPackage}/opt/zimbra/lib/ext/zimbrasync
mkdir -p ${repoDir}/zm-build/${currentPackage}/opt/zimbra/lib/ext/network
mkdir -p ${repoDir}/zm-build/${currentPackage}/opt/zimbra/lib/ext/com_zimbra_oo
mkdir -p ${repoDir}/zm-build/${currentPackage}/opt/zimbra/lib/ext/convertd
mkdir -p ${repoDir}/zm-build/${currentPackage}/opt/zimbra/lib/ext/zimbrahsm
mkdir -p ${repoDir}/zm-build/${currentPackage}/opt/zimbra/lib/ext/smime
mkdir -p ${repoDir}/zm-build/${currentPackage}/opt/zimbra/lib/ext/zm-doc-server-ext
cp -f ${repoDir}/zm-backup-store/build/dist/zm-backup-store.jar ${repoDir}/zm-build/${currentPackage}/opt/zimbra/lib/ext/backup/zimbrabackup.jar
cp -f ${repoDir}/zm-archive-store/build/dist/*.jar ${repoDir}/zm-build/${currentPackage}/opt/zimbra/lib/ext/zimbra-archive/zimbra-archive.jar
cp -rf ${repoDir}/zm-voice-store/build/dist/zm-voice-store.jar ${repoDir}/zm-build/${currentPackage}/opt/zimbra/lib/ext/voice/zimbravoice.jar
cp -rf ${repoDir}/zm-voice-mitel-store/build/dist/zm-voice-mitel-store.jar ${repoDir}/zm-build/${currentPackage}/opt/zimbra/lib/ext/mitel
cp -rf ${repoDir}/zm-voice-cisco-store/build/dist/zm-voice-cisco-store.jar ${repoDir}/zm-build/${currentPackage}/opt/zimbra/lib/ext/cisco
cp -rf ${repoDir}/zm-sync-common/build/dist/*.jar ${repoDir}/zm-build/${currentPackage}/opt/zimbra/lib/ext/zimbrasync
cp -rf ${repoDir}/zm-sync-store/build/dist/*.jar ${repoDir}/zm-build/${currentPackage}/opt/zimbra/lib/ext/zimbrasync
cp -rf ${repoDir}/zm-sync-tools/build/dist/*.jar ${repoDir}/zm-build/${currentPackage}/opt/zimbra/lib/ext/zimbrasync
cp -f ${repoDir}/zm-openoffice-store/build/dist/*.jar ${repoDir}/zm-build/${currentPackage}/opt/zimbra/lib/ext/com_zimbra_oo
mv ${repoDir}/zm-build/${currentPackage}/opt/zimbra/lib/ext/com_zimbra_oo/zm-openoffice-store.jar ${repoDir}/zm-build/${currentPackage}/opt/zimbra/lib/ext/com_zimbra_oo/com_zimbra_oo.jar
cp -rf ${repoDir}/zm-convertd-store/build/dist/*jar ${repoDir}/zm-build/${currentPackage}/opt/zimbra/lib/ext/convertd
cp -f ${repoDir}/zm-twofactorauth-store/build/dist/zm-twofactorauth-store*.jar ${repoDir}/zm-build/${currentPackage}/opt/zimbra/lib/ext/twofactorauth/zimbratwofactorauth.jar
cp -f ${repoDir}/zm-hsm-store/build/zimbrahsm.jar ${repoDir}/zm-build/${currentPackage}/opt/zimbra/lib/ext/zimbrahsm/zimbrahsm.jar
cp -f ${repoDir}/zm-store-managers/build/zm-store-managers*.jar ${repoDir}/zm-build/${currentPackage}/opt/zimbra/lib/ext/zimbrahsm/zm-store-managers.jar
cp -f ${repoDir}/zm-freebusy-provider-store/build/zimbra-freebusyprovider.jar ${repoDir}/zm-build/${currentPackage}/opt/zimbra/lib/ext/zimbra-freebusy/zimbra-freebusyprovider.jar
cp -rf ${repoDir}/zm-smime-store/build/dist/*.jar ${repoDir}/zm-build/${currentPackage}/opt/zimbra/lib/ext/smime
cp -f ${repoDir}/zm-network-gql/build/dist/zm-network-gql*.jar ${repoDir}/zm-build/${currentPackage}/opt/zimbra/lib/ext/zm-gql/zmnetworkgql.jar
cp -f ${repoDir}/zm-zcs-lib/build/dist/tika-app-1.24.1.jar ${repoDir}/zm-build/${currentPackage}/opt/zimbra/lib/ext/convertd/
cp -rf ${repoDir}/zm-doc-server-ext/build/dist/*.jar ${repoDir}/zm-build/${currentPackage}/opt/zimbra/lib/ext/zm-doc-server-ext
fi
cp -f ${repoDir}/zm-clam-scanner-store/build/dist/zm-clam-scanner-store*.jar ${repoDir}/zm-build/${currentPackage}/opt/zimbra/lib/ext/clamscanner/clamscanner.jar
cp -f ${repoDir}/zm-nginx-lookup-store/build/dist/zm-nginx-lookup-store*.jar ${repoDir}/zm-build/${currentPackage}/opt/zimbra/lib/ext/nginx-lookup/nginx-lookup.jar
cp -f ${repoDir}/zm-openid-consumer-store/build/dist/guice*.jar ${repoDir}/zm-build/${currentPackage}/opt/zimbra/lib/ext/openidconsumer/
cp -f ${repoDir}/zm-versioncheck-store/build/zm-versioncheck-store*.jar ${repoDir}/zm-build/${currentPackage}/opt/zimbra/lib/ext/zimbraadminversioncheck/zimbraadminversioncheck.jar
cp -f ${repoDir}/zm-ldap-utils-store/build/zm-ldap-utils-*.jar ${repoDir}/zm-build/${currentPackage}/opt/zimbra/lib/ext/zimbraldaputils/zimbraldaputils.jar
cp -f ${repoDir}/zm-oauth-social/build/dist/zm-oauth-social.jar ${repoDir}/zm-build/${currentPackage}/opt/zimbra/lib/ext/zm-oauth-social/zmoauthsocial.jar
cp -f ${repoDir}/zm-oauth-social/build/dist/zm-oauth-social-common.jar ${repoDir}/zm-build/${currentPackage}/opt/zimbra/lib/ext-common/zm-oauth-social-common.jar
cp -f ${repoDir}/zm-zcs-lib/build/dist/java-jwt-3.2.0.jar ${repoDir}/zm-build/${currentPackage}/opt/zimbra/lib/ext/zm-oauth-social/
cp -f ${repoDir}/zm-gql/build/dist/zm-gql*.jar ${repoDir}/zm-build/${currentPackage}/opt/zimbra/lib/ext/zm-gql/zmgql.jar
#-------------------- Get wars content (service.war, zimbra.war and zimbraAdmin.war) ---------------------------
echo "\t\t++++++++++ service.war content ++++++++++" >> ${buildLogFile}
mkdir -p ${repoDir}/zm-build/${currentPackage}/opt/zimbra/jetty_base/
mkdir -p ${repoDir}/zm-build/${currentPackage}/opt/zimbra/jetty_base/webapps/service/WEB-INF/lib
cp ${repoDir}/zm-zimlets/conf/zimbra.tld ${repoDir}/zm-build/${currentPackage}/opt/zimbra/jetty_base/webapps/service/WEB-INF
cp ${repoDir}/zm-taglib/build/zm-taglib*.jar ${repoDir}/zm-build/${currentPackage}/opt/zimbra/jetty_base/webapps/service/WEB-INF/lib
cp ${repoDir}/zm-zimlets/build/dist/zimlettaglib.jar ${repoDir}/zm-build/${currentPackage}/opt/zimbra/jetty_base/webapps/service/WEB-INF/lib
mkdir -p ${repoDir}/zm-build/${currentPackage}/opt/zimbra/jetty_base/webapps/zimbra
if [ "${buildType}" == "NETWORK" ]
then
echo "\t\t***** css, public and t content *****" >> ${buildLogFile}
mkdir -p ${repoDir}/zm-build/${currentPackage}/opt/zimbra/jetty_base/webapps/zimbra/css
mkdir -p ${repoDir}/zm-build/${currentPackage}/opt/zimbra/jetty_base/webapps/zimbra/public
fi
echo "\t\t***** portals example content *****" >> ${buildLogFile}
mkdir -p ${repoDir}/zm-build/${currentPackage}/opt/zimbra/jetty_base/webapps/zimbra/portals/example
cp -rf ${repoDir}/zm-webclient-portal-example/example ${repoDir}/zm-build/${currentPackage}/opt/zimbra/jetty_base/webapps/zimbra/portals
echo "\t\t***** robots.txt content *****" >> ${buildLogFile}
cp -f ${repoDir}/zm-aspell/conf/robots.txt ${repoDir}/zm-build/${currentPackage}/opt/zimbra/jetty_base/webapps/zimbra/robots.txt
echo "\t\t***** downloads content *****" >> ${buildLogFile}
downloadsDir=${repoDir}/zm-build/${currentPackage}/opt/zimbra/jetty_base/webapps/zimbra/downloads
mkdir -p ${downloadsDir}
cp -rf ${repoDir}/zm-downloads/. ${downloadsDir}
if [ "${buildType}" == "NETWORK" ]
then
set -e
cd ${downloadsDir}
# wget -r -nd --no-parent --reject-regex="/backup/" --reject "index.*" http://${zimbraThirdPartyServer}/ZimbraThirdParty/zco-migration-builds/current/
# zimbraThirdPartyServer Could be S3 bucket name.
rclone copy -v ${zimbraThirdPartyServer}/ZimbraThirdParty/zco-migration-builds/current/ ./
fi
echo "\t\t***** help content *****" >> ${buildLogFile}
rsync -a ${repoDir}/zm-admin-help-common/WebRoot/help ${repoDir}/zm-build/${currentPackage}/opt/zimbra/jetty_base/webapps/zimbraAdmin/
if [ "${buildType}" == "NETWORK" ]
then
rsync -a ${repoDir}/zm-admin-help-network/WebRoot/help ${repoDir}/zm-build/${currentPackage}/opt/zimbra/jetty_base/webapps/zimbraAdmin/
fi
if [ "${buildType}" == "NETWORK" ]
then
echo -e "\t\tCopy ext-common files of /opt/zimbra/lib/" >> ${buildLogFile}
mkdir -p ${repoDir}/zm-build/${currentPackage}/opt/zimbra/lib/ext-common
cp -f ${repoDir}/zm-zcs-lib/build/dist/bcpkix-jdk15on-1.64.jar ${repoDir}/zm-build/${currentPackage}/opt/zimbra/lib/ext-common/
cp -f ${repoDir}/zm-zcs-lib/build/dist/bcmail-jdk15on-1.64.jar ${repoDir}/zm-build/${currentPackage}/opt/zimbra/lib/ext-common/
cp -f ${repoDir}/zm-zcs-lib/build/dist/bcprov-jdk15on-1.64.jar ${repoDir}/zm-build/${currentPackage}/opt/zimbra/lib/ext-common/
cp -f ${repoDir}/zm-zcs-lib/build/dist/saaj-impl-1.5.1.jar ${repoDir}/zm-build/${currentPackage}/opt/zimbra/lib/ext-common/
fi
cp -f ${repoDir}/zm-migration-tools/src/libexec/zmztozmig ${repoDir}/zm-build/${currentPackage}/opt/zimbra/libexec
cp -f ${repoDir}/zm-migration-tools/src/libexec/zmcleaniplanetics ${repoDir}/zm-build/${currentPackage}/opt/zimbra/libexec
cp -f ${repoDir}/zm-versioncheck-utilities/src/libexec/zmcheckversion ${repoDir}/zm-build/${currentPackage}/opt/zimbra/libexec
echo -e "\tCopy log files of /opt/zimbra/" >> ${buildLogFile}
mkdir -p ${repoDir}/zm-build/${currentPackage}/opt/zimbra/log
cp -f ${repoDir}/zm-build/rpmconf/Conf/hotspot_compiler ${repoDir}/zm-build/${currentPackage}/opt/zimbra/log/.hotspot_compiler
echo -e "\tCopy zimlets files of /opt/zimbra/" >> ${buildLogFile}
mkdir -p ${repoDir}/zm-build/${currentPackage}/opt/zimbra/zimlets
zimletsArray=( "zm-versioncheck-admin-zimlet" \
"zm-bulkprovision-admin-zimlet" \
"zm-certificate-manager-admin-zimlet" \
"zm-proxy-config-admin-zimlet" \
"zm-helptooltip-zimlet" \
"zm-viewmail-admin-zimlet" )
for i in "${zimletsArray[@]}"
do
cp ${repoDir}/${i}/build/zimlet/*.zip ${repoDir}/zm-build/${currentPackage}/opt/zimbra/zimlets
done
cp -f ${repoDir}/zm-zimlets/build/dist/zimlets/*.zip ${repoDir}/zm-build/${currentPackage}/opt/zimbra/zimlets
if [ "${buildType}" == "NETWORK" ]
then
echo -e "\tCopy zimlets-network files of /opt/zimbra/" >> ${buildLogFile}
mkdir -p ${repoDir}/zm-build/${currentPackage}/opt/zimbra/zimlets-network
adminZimlets=( "zm-license-admin-zimlet" \
"zm-backup-restore-admin-zimlet" \
"zm-convertd-admin-zimlet" \
"zm-delegated-admin-zimlet" \
"zm-hsm-admin-zimlet" \
"zm-smime-cert-admin-zimlet" \
"zm-2fa-admin-zimlet" \
"zm-ucconfig-admin-zimlet" \
"zm-securemail-zimlet" \
"zm-mobile-sync-admin-zimlet" )
for i in "${adminZimlets[@]}"
do
cp ${repoDir}/${i}/build/zimlet/*.zip ${repoDir}/zm-build/${currentPackage}/opt/zimbra/zimlets-network
done
adminUcZimlets=( "cisco" "mitel" "voiceprefs" )
for i in "${adminUcZimlets[@]}"
do
cp ${repoDir}/zm-uc-admin-zimlets/${i}/build/zimlet/*.zip ${repoDir}/zm-build/${currentPackage}/opt/zimbra/zimlets-network
done
fi
echo "\t\t***** Building jetty/common/ *****" >> ${buildLogFile}
mkdir -p ${repoDir}/zm-build/${currentPackage}/opt/zimbra/jetty_base/common/endorsed
mkdir -p ${repoDir}/zm-build/${currentPackage}/opt/zimbra/jetty_base/common/lib
mkdir -p ${repoDir}/zm-build/${currentPackage}/opt/zimbra/jetty_base/temp
touch ${repoDir}/zm-build/${currentPackage}/opt/zimbra/jetty_base/temp/.emptyfile
echo -e "\tCreate jetty conf" >> ${buildLogFile}
mkdir -p ${repoDir}/zm-build/${currentPackage}/opt/zimbra/jetty_base/etc
mkdir -p ${repoDir}/zm-build/${currentPackage}/opt/zimbra/jetty_base/modules
mkdir -p ${repoDir}/zm-build/${currentPackage}/opt/zimbra/jetty_base/start.d
cp -f ${repoDir}/zm-jetty-conf/conf/jetty/jettyrc ${repoDir}/zm-build/${currentPackage}/opt/zimbra/jetty_base/etc/
cp -f ${repoDir}/zm-jetty-conf/conf/jetty/zimbra.policy.example ${repoDir}/zm-build/${currentPackage}/opt/zimbra/jetty_base/etc/
cp -f ${repoDir}/zm-jetty-conf/conf/jetty/jetty.xml.production ${repoDir}/zm-build/${currentPackage}/opt/zimbra/jetty_base/etc/jetty.xml.in
cp -f ${repoDir}/zm-jetty-conf/conf/jetty/webdefault.xml.production ${repoDir}/zm-build/${currentPackage}/opt/zimbra/jetty_base/etc/webdefault.xml
cp -f ${repoDir}/zm-jetty-conf/conf/jetty/jetty-setuid.xml ${repoDir}/zm-build/${currentPackage}/opt/zimbra/jetty_base/etc/jetty-setuid.xml
cp -f ${repoDir}/zm-jetty-conf/conf/jetty/spnego/etc/spnego.properties ${repoDir}/zm-build/${currentPackage}/opt/zimbra/jetty_base/etc/spnego.properties.in
cp -f ${repoDir}/zm-jetty-conf/conf/jetty/spnego/etc/spnego.conf ${repoDir}/zm-build/${currentPackage}/opt/zimbra/jetty_base/etc/spnego.conf.in
cp -f ${repoDir}/zm-jetty-conf/conf/jetty/spnego/etc/krb5.ini ${repoDir}/zm-build/${currentPackage}/opt/zimbra/jetty_base/etc/krb5.ini.in
cp -f ${repoDir}/zm-jetty-conf/conf/jetty/modules/*.mod ${repoDir}/zm-build/${currentPackage}/opt/zimbra/jetty_base/modules
cp -f ${repoDir}/zm-jetty-conf/conf/jetty/modules/*.mod.in ${repoDir}/zm-build/${currentPackage}/opt/zimbra/jetty_base/modules
cp -f ${repoDir}/zm-jetty-conf/conf/jetty/start.d/*.ini.in ${repoDir}/zm-build/${currentPackage}/opt/zimbra/jetty_base/start.d
cp -f ${repoDir}/zm-jetty-conf/conf/jetty/modules/npn/*.mod ${repoDir}/zm-build/${currentPackage}/opt/zimbra/jetty_base/modules/npn
cp -f ${repoDir}/zm-jetty-conf/conf/jetty/jetty-logging.properties ${repoDir}/zm-build/${currentPackage}/opt/zimbra/jetty_base/etc/
cp -f ${repoDir}/zm-zimlets/conf/web.xml.production ${repoDir}/zm-build/${currentPackage}/opt/zimbra/jetty_base/etc/zimlet.web.xml.in
CreatePackage "${os}"
}
#-------------------- Util Functions ---------------------------
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
source "$SCRIPT_DIR/utils.sh"
CreateDebianPackage()
{
mkdir -p ${repoDir}/zm-build/${currentPackage}/DEBIAN
cat ${repoDir}/zm-build/rpmconf/Spec/Scripts/${currentScript}.pre >> ${repoDir}/zm-build/${currentPackage}/DEBIAN/preinst
cat ${repoDir}/zm-build/rpmconf/Spec/Scripts/${currentScript}.post >> ${repoDir}/zm-build/${currentPackage}/DEBIAN/postinst
chmod 555 ${repoDir}/zm-build/${currentPackage}/DEBIAN/*
echo -e "\tCreate debian package" >> ${buildLogFile}
(cd ${repoDir}/zm-build/${currentPackage}; find . -type f ! -regex '.*jetty_base/webapps/zimbra/WEB-INF/jetty-env.xml' ! \
-regex '.*jetty_base/webapps/zimbraAdmin/WEB-INF/jetty-env.xml' ! -regex '.*jetty_base/modules/setuid.mod' ! \
-regex '.*jetty_base/etc/krb5.ini' ! -regex '.*jetty_base/etc/spnego.properties' ! -regex '.*jetty_base/etc/jetty.xml' ! \
-regex '.*jetty_base/etc/spnego.conf' ! -regex '.*jetty_base/webapps/zimbraAdmin/WEB-INF/web.xml' ! \
-regex '.*jetty_base/webapps/zimbra/WEB-INF/web.xml' ! -regex '.*jetty_base/webapps/service/WEB-INF/web.xml' ! \
-regex '.*jetty_base/work/.*' ! -regex '.*.hg.*' ! -regex '.*?debian-binary.*' ! -regex '.*?DEBIAN.*' -print0 | xargs -0 md5sum | \sed -e 's| \./| |' \
> ${repoDir}/zm-build/${currentPackage}/DEBIAN/md5sums)
(
set -e
MORE_DEPENDS="$(find ${repoDir}/zm-packages/ -name \*.deb \
| xargs -n1 basename \
| sed -e 's/_[0-9].*//' \
| grep -e zimbra-mbox- \
| sed '1s/^/, /; :a; {N;s/\n/, /;ba}')";
cat ${repoDir}/zm-build/rpmconf/Spec/${currentScript}.deb \
| sed -e "s/@@VERSION@@/${releaseNo}.${releaseCandidate}.${buildNo}.${os/_/.}/" \
-e "s/@@branch@@/${buildTimeStamp}/" \
-e "s/@@ARCH@@/${arch}/" \
-e "s/@@MORE_DEPENDS@@/${MORE_DEPENDS}/" \
-e "s/@@PKG_OS_TAG@@/${PKG_OS_TAG}/" \
-e "/^%post$/ r ${currentScript}.post"
) > ${repoDir}/zm-build/${currentPackage}/DEBIAN/control
(cd ${repoDir}/zm-build/${currentPackage}; dpkg -b ${repoDir}/zm-build/${currentPackage} ${repoDir}/zm-build/${arch})
}
CreateRhelPackage()
{
MORE_DEPENDS="$(find ${repoDir}/zm-packages/ -name \*.rpm \
| xargs -n1 basename \
| sed -e 's/-[0-9].*//' \
| grep -e zimbra-mbox- \
| sed '1s/^/, /; :a; {N;s/\n/, /;ba}')";
cat ${repoDir}/zm-build/rpmconf/Spec/${currentScript}.spec | \
sed -e "s/@@VERSION@@/${releaseNo}_${releaseCandidate}_${buildNo}.${os}/" \
-e "s/@@RELEASE@@/${buildTimeStamp}/" \
-e "s/@@MORE_DEPENDS@@/${MORE_DEPENDS}/" \
-e "s/@@PKG_OS_TAG@@/${PKG_OS_TAG}/" \
-e "/^%pre$/ r ${repoDir}/zm-build/rpmconf/Spec/Scripts/${currentScript}.pre" \
-e "/^%post$/ r ${repoDir}/zm-build/rpmconf/Spec/Scripts/${currentScript}.post" > ${repoDir}/zm-build/${currentScript}.spec
echo "%attr(-, root, root) /opt/zimbra/lib" >> \
${repoDir}/zm-build/${currentScript}.spec
echo "%attr(440, root, root) /etc/sudoers.d/02_zimbra-store" >> \
${repoDir}/zm-build/${currentScript}.spec
echo "%attr(755, zimbra, zimbra) /opt/zimbra/conf" >> \
${repoDir}/zm-build/${currentScript}.spec
echo "%attr(644, zimbra, zimbra) /opt/zimbra/conf/*" >> \
${repoDir}/zm-build/${currentScript}.spec
echo "%attr(-, zimbra, zimbra) /opt/zimbra/log" >> \
${repoDir}/zm-build/${currentScript}.spec
echo "%attr(-, zimbra, zimbra) /opt/zimbra/zimlets" >> \
${repoDir}/zm-build/${currentScript}.spec
echo "%attr(-, zimbra, zimbra) /opt/zimbra/extensions-extra" >> \
${repoDir}/zm-build/${currentScript}.spec
if [ "${buildType}" == "NETWORK" ]
then
echo "%attr(-, zimbra, zimbra) /opt/zimbra/zimlets-network" >> \
${repoDir}/zm-build/${currentScript}.spec
echo "%attr(-, zimbra, zimbra) /opt/zimbra/extensions-network-extra" >> \
${repoDir}/zm-build/${currentScript}.spec
fi
echo "%attr(755, root, root) /opt/zimbra/bin" >> \
${repoDir}/zm-build/${currentScript}.spec
echo "%attr(755, root, root) /opt/zimbra/libexec" >> \
${repoDir}/zm-build/${currentScript}.spec
echo "%attr(-, zimbra, zimbra) /opt/zimbra/jetty_base" >> \
${repoDir}/zm-build/${currentScript}.spec
echo "" >> ${repoDir}/zm-build/${currentScript}.spec
echo "%clean" >> ${repoDir}/zm-build/${currentScript}.spec
(cd ${repoDir}/zm-build/${currentPackage}; \
rpmbuild --target ${arch} --define '_rpmdir ../' --buildroot=${repoDir}/zm-build/${currentPackage} -bb ${repoDir}/zm-build/${currentScript}.spec )
}
############################################################################
main "$@"