-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpre-install.sh
419 lines (355 loc) · 10.5 KB
/
pre-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
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
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
#!/bin/bash
###
### README
###
### Script.....: pre-install.sh
### Description: Prepare linux systems Debian or RedHat based for the
### LibreOffice compilation process. Options for dependencies
### install and clone the source (standard), or just dependencies
### install.
### LICENSE
### 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.
###
### This program is distributed in the hope that it will be useful,
### but WITHOUT ANY WARRANTY; without even the implied warranty of
### MERCHANTABILITY of FITNESS FOR A PARTICULAR PURPOSE. See the
### GNU General Public License for more details.
### http://www.gnu.org/licenses
###
### Authors
### - Marcos Paulo de Souza ..(marcos.souza.org [at] gmail.com)
### - Ricardo Montania .......(ricardo.montania [at] gmail.com)
### Testers
### - Marcos Paulo de Souza ..(marcos.souza.org [at] gmail.com)
### - Jose Guilherme Vanz ....(guilherme.sft [at] gmail.com)
###
###
### Changelog
###
# 1.0 (Oct 31, 2012)
# - Start version
# - Build dependencies and install for supported distros
# - Fedora Support
# - Debian/Ubuntu Support
#
# 1.1 (Nov 02, 2012)
# - Option to clone core repository added
# - Bug fixes
#
# 1.2 (Nov 05, 2012)
# - Inform the location where to clone added
# - --no-clone option added
# - --help option added
#
# 1.3 (Dec 04, 2012)
# - OpenSUSE Support added (Thanks to Alexandre Vicenzi)
#
# 1.4 (May 15, 2013)
# - Bug fixes
# - Ubuntu 12.x bug fixes (Thanks to Carlos Alexandro Becker)
#
# 1.5 (Jul 18, 2013)
# - Mint Support added
#
# 1.6 (Ago 12, 2013)
# - Packages download option added
# - Bug fixes for installing tools
#
# 1.7 (Ago 22, 2013)
# - --just-clone option added
###
### Version
###
VERSION="1.7"
VERSION_DATE="Ago 12, 2013"
usageSyntax()
{
echo " "
echo "Usage:"
echo " "
echo "bash pre-install.sh [option]"
echo " "
echo "Options:"
echo " "
echo " --dir [/some/folder/] - Dep install and clone in /some/folder/"
echo " PS: If no dir was informed, whill be installed"
echo " the deps and git clone will use the $HOME/libo/ folder"
echo " --just-clone - Only clone the core repository"
echo " --just-download - Just download the needed packages instead of install them"
echo " --no-update - Disable aptitide update before the aptitura install"
echo " --no-clone - Disable clone option (only dep install)"
echo " --ccache - Install ccache. It speeds up recompilation by"
echo " caching previous compilations and detecting when"
echo " the same compilation is being done again"
echo " --help - Show this help message"
echo " --version - Show current version"
echo " "
}
gitClone()
{
if [ $noclone == "true" ]; then
exit
fi
if [ "$clonedir" == "" ]; then
clonedir=$HOME/libo
fi
git clone git://anongit.freedesktop.org/libreoffice/core $clonedir &&
echo "Success! Enjoy your LibreOffice source code at $clonedir :-)"
exit
}
debianInstall()
{
echo "Dep install for Debian/Ubuntu/Mint"
echo " "
# installing aptitude for a lot of reasons :)
sudo apt-get install aptitude
if [ $update == "true" ]; then
sudo aptitude update
fi
if [ $inccache == "true" ]; then
sudo aptitude install ccache -y
fi
option="sudo aptitude install"
if [ $download == "true" ]; then
option="aptitude download"
# installing the tools to verify the dependencies of a package
sudo aptitude install apt-rdepends
fi
if [ $download == "true" ]; then
double_jump="false"
# this format usually is: Build-Depends: zlib1g-dev
for i in `apt-rdepends --build-depends --follow=DEPENDS libreoffice`
do
if [ $double_jump == "true" ]; then
double_jump=false
continue
fi
# after this part of build-dep, we have a number, so skip too
if [[ "$i" == "(>=" || "$i" == "(>>" ]]; then
double_jump=true
continue
fi
# skip deps by LibreOffice itself
case $i in
"libcmis-dev" | "libicu-dev" | "liblcms2-dev" | "libmdds-dev" | "libwpd-dev")
continue
esac
# first line of command
if [[ "$i" != "libreoffice" && "$i" != "Build-Depends:" && "$i" != "Build-Depends-Indep:" ]]; then
file_entry=$(ls | grep "$i" | wc -l)
if [ $file_entry -eq 0 ]; then
aptitude download $i
fi
fi
done
else
sudo aptitude build-dep libreoffice -y
fi
$option git-core libgnomeui-dev gawk junit4 doxygen libgstreamer0.10-dev -y
$option libarchive-zip-perl
$option libcupsys2-dev
$option gperf libxslt1-dev libdbus-glib-1-dev libgstreamer-plugins-base0.10-dev
}
fedoraInstall()
{
echo "Dep install for Fedora"
echo " "
if [ $update == "true" ]; then
sudo yum update
fi
if [ $inccache == "true" ]; then
sudo yum install ccache
fi
option="sudo yum install"
if [ $download == "true" ]; then
option="yum install"
fi
sudo yum install yum-downloadonly
sudo yum-builddep libreoffice -y
if [ $download == "true" ]; then
$option git libgnomeui-devel gawk junit doxygen perl-Archive-Zip Cython python-devel -y --download-only
else
$option git libgnomeui-devel gawk junit doxygen perl-Archive-Zip Cython python-devel -y
fi
}
suseInstall()
{
echo " "
echo "1. 11.4"
echo "2. 12.1"
echo "3. 12.2"
echo "4. 12.3"
echo " "
read -p "Select your SUSE version: " version
case $version in
1) vername="11.4";;
2) vername="12.1";;
3) vername="12.2";;
4) vername="12.3";;
*) echo "Sorry, invalid option!"; exit;;
esac
echo " "
echo "1. 32 bits"
echo "2. 64 bits"
echo " "
read -p "Select your system type: " systype
case $systype in
"1") sysname="32 bits";;
"2") sysname="64 bits";;
*) echo "Sorry, invalid option!"; exit;;
esac
echo " "
echo "Dep install for openSUSE" $vername $sysname
echo "If you receive a question to answer [yes or no], please, read carrefully."
echo "Maybe root's password will be asked more than once."
echo " "
sudo zypper refresh
sudo zypper update
sudo zypper in java-1_7_0-openjdk-devel # gcj is installed by default but it does not work reasonably.
if [ $inccache == "true" ]; then
sudo zypper in ccache
fi
if [ $systype == "1" ]; then
sudo zypper in krb5-devel-32bits
else
sudo zypper in krb5-devel
fi
sudo zypper mr --enable "openSUSE-$vername-Source" # Enable te repo to download the source.
sudo zypper si -d libreoffice # For OpenSUSE 11.4+ (was OpenOffice_org-bootstrap)
sudo zypper in git libgnomeui-devel gawk junit doxygen
}
showDestination()
{
if [ "$clonedir" == "" ]; then
echo "Path (absolute) for the folder where will be cloned the libo repository: '$HOME'"; echo " "
elif [ "$clonedir" == "--no-clone" ]; then
echo "Chosen option for don't clone!"; echo " "
else
echo "Path (absolute) for the folder where will be cloned the libo repository: '$clonedir'"; echo " "
fi
}
distroChoice()
{
echo "1. Debian/Ubuntu"
echo "2. Fedora"
echo "3. openSUSE"
echo "4. Other linux"
echo " "
read -p "Choice your distro: " distro
case $distro in
"1")
debianInstall
;;
"2")
fedoraInstall
;;
"3")
suseInstall
;;
"4")
echo "Please, follow the instructions in \"http://www.libreoffice.org/developers-2\" to configure you system or contact us."
exit
;;
*)
echo "Sorry, invalid option!"
exit
;;
esac
}
cloneSyntaxError()
{
echo "Syntax error. Cannot use --no-clone and --dir together."
usageSyntax
exit
}
showVersion()
{
echo "Current version: $VERSION from $VERSION_DATE"
echo ""
echo "See the changelog section for more information"
}
inccache="false"
noclone="false"
clonedir=""
download="false"
update="true"
only_clone="false"
###
### Check input parameters.
###
while [ $# -ne 0 ]
do
case $1 in
"--help")
usageSyntax
exit
;;
"--version")
showVersion
exit
;;
"--ccache")
inccache="true"
;;
"--no-clone")
echo "opcao para nao clonar."
if [ "$clonedir" != "" ]; then
cloneSyntaxError
fi
noclone="true"
;;
# if we want just ot download the deps, create a dir called
# deps and enter in the new dir, and call this shell again with the parameter
"--just-download")
mkdir deps 2> /dev/null
if [ ! -d "deps" ]; then
echo "Failed to create deps dir. ABORTING."
exit
fi
cd deps
bash ../$0 --downloadnow --no-update --no-clone
exit
;;
# just for intern use, download the packets inside the deps dir
"--downloadnow")
# don't use sudo just for download
download="true"
;;
"--just-clone")
only_clone="true"
;;
"--no-updae")
update="false"
;;
"--dir")
if [ $noclone == "true" ]; then
cloneSyntaxError
fi
# Get dir name.
shift
clonedir=$1
dr=${clonedir:0:1}
# Need a name before the next parameter.
if [ "$dr" == "-" ]; then
echo "Syntax error. Invalid directory \"$clonedir\"."
exit
fi
;;
*)
echo "Syntax error. Invalid parameter \"$1\"."
usageSyntax;
exit
;;
esac
# Next parameter.
shift
done
clear
echo "Script for dependencies installation and/or LibreOffice source code."
showDestination
if [ ! $only_clone ]; then
distroChoice
fi
gitClone