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
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
|
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# This file incorporates work covered by the following license notice:
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed
# with this work for additional information regarding copyright
# ownership. The ASF licenses this file to you under the Apache
# License, Version 2.0 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.apache.org/licenses/LICENSE-2.0 .
#
package installer::windows::property;
use installer::exiter;
use installer::files;
use installer::globals;
use installer::windows::idtglobal;
use installer::windows::language;
#############################################
# Setting the properties dynamically
# for the table Property.idt
#############################################
sub get_arpcomments_for_property_table
{
my ( $allvariables, $languagestringref ) = @_;
my $name = $allvariables->{'PRODUCTNAME'};
my $version = $allvariables->{'PRODUCTVERSION'};
my $comment = $name . " " . $version;
my $postversionextension = "";
if ( $allvariables->{'POSTVERSIONEXTENSION'} )
{
$postversionextension = $allvariables->{'POSTVERSIONEXTENSION'};
$comment = $comment . " " . $postversionextension;
}
if ( $installer::globals::languagepack ) { $comment = $comment . " " . "Language Pack"; }
elsif ( $installer::globals::helppack ) { $comment = $comment . " " . "Help Pack"; }
my $languagestring = $$languagestringref;
$languagestring =~ s/\_/\,/g;
if ( length($languagestring) > 30 ) { $languagestring = "multilanguage"; } # fdo#64053
$comment = $comment . " ($languagestring)";
return $comment;
}
sub get_installlevel_for_property_table
{
my $installlevel = "100";
return $installlevel;
}
sub get_ischeckforproductupdates_for_property_table
{
my $ischeckforproductupdates = "1";
return $ischeckforproductupdates;
}
sub get_manufacturer_for_property_table
{
return $installer::globals::manufacturer;
}
sub get_productlanguage_for_property_table
{
my ($language) = @_;
my $windowslanguage = installer::windows::language::get_windows_language($language);
return $windowslanguage;
}
sub get_language_string
{
my $langstring = "";
for ( my $i = 0; $i <= $#installer::globals::languagenames; $i++ )
{
$langstring = $langstring . $installer::globals::languagenames[$i] . ", ";
}
$langstring =~ s/\,\s*$//;
$langstring = "(" . $langstring . ")";
return $langstring;
}
sub get_english_language_string
{
my $langstring = "";
# Sorting value not keys, therefore collecting all values
my %helper = ();
foreach my $lang ( keys %installer::globals::all_required_english_languagestrings )
{
$helper{$installer::globals::all_required_english_languagestrings{$lang}} = 1;
}
foreach my $lang ( sort keys %helper )
{
$langstring = $langstring . $lang . ", ";
}
$langstring =~ s/\,\s*$//;
$langstring = "(" . $langstring . ")";
return $langstring;
}
sub get_productname($$)
{
my ( $language, $allvariables ) = @_;
my $name = $allvariables->{'PRODUCTNAME'};
return $name;
}
sub get_productname_for_property_table($$)
{
my ( $language, $allvariables ) = @_;
my $name = get_productname ($language, $allvariables);
my $version = $allvariables->{'PRODUCTVERSION'};
my $productname = $name . " " . $version;
my $productextension = "";
if ( $allvariables->{'PRODUCTEXTENSION'} )
{
$productextension = $allvariables->{'PRODUCTEXTENSION'};
$productname = $productname . $productextension;
}
my $postversionextension = "";
if ( $allvariables->{'POSTVERSIONEXTENSION'} )
{
$postversionextension = $allvariables->{'POSTVERSIONEXTENSION'};
$productname = $productname . " " . $postversionextension;
}
if ( $installer::globals::languagepack )
{
my $langstring = get_english_language_string(); # Example: (English, German)
$productname = $name . " " . $version . " Language Pack" . " " . $langstring;
}
elsif ( $installer::globals::helppack )
{
my $langstring = get_english_language_string(); # New: (English, German)
$productname = $name . " " . $version . " Help Pack" . " " . $langstring;
}
# Saving this name in hash $allvariables for further usage
$allvariables->{'PROPERTYTABLEPRODUCTNAME'} = $productname;
my $infoline = "Defined variable PROPERTYTABLEPRODUCTNAME: $productname\n";
push(@installer::globals::logfileinfo, $infoline);
return $productname;
}
sub get_quickstarterlinkname_for_property_table($$)
{
my ( $language, $allvariables ) = @_;
# no usage of POSTVERSIONEXTENSION for Quickstarter link name!
my $name = get_productname ($language, $allvariables);
my $version = $allvariables->{'PRODUCTVERSION'};
my $quickstartername = $name . " " . $version;
my $infoline = "Defined Quickstarter Link name: $quickstartername\n";
push(@installer::globals::logfileinfo, $infoline);
return $quickstartername;
}
sub get_productversion_for_property_table
{
return $installer::globals::msiproductversion;
}
#######################################################
# Setting some important properties
# (for finding the product in deinstallation process)
#######################################################
sub set_important_properties
{
my ($propertyfile, $allvariables, $languagestringref) = @_;
# Setting new variables with the content of %PRODUCTNAME and %PRODUCTVERSION
if ( $allvariables->{'PRODUCTNAME'} )
{
my $onepropertyline = "DEFINEDPRODUCT" . "\t" . $allvariables->{'PRODUCTNAME'} . "\n";
push(@{$propertyfile}, $onepropertyline);
}
if ( $allvariables->{'PRODUCTVERSION'} )
{
my $onepropertyline = "DEFINEDVERSION" . "\t" . $allvariables->{'PRODUCTVERSION'} . "\n";
push(@{$propertyfile}, $onepropertyline);
}
if (( $allvariables->{'PRODUCTNAME'} ) && ( $allvariables->{'PRODUCTVERSION'} ) && ( $allvariables->{'REGISTRYLAYERNAME'} ))
{
my $onepropertyline = "FINDPRODUCT" . "\t" . "Software\\LibreOffice" . "\\" . $allvariables->{'REGISTRYLAYERNAME'} . "\\" . $allvariables->{'PRODUCTNAME'} . "\\" . $allvariables->{'PRODUCTVERSION'} . "\n";
push(@{$propertyfile}, $onepropertyline);
}
if ( $allvariables->{'PRODUCTMAJOR'} )
{
my $onepropertyline = "PRODUCTMAJOR" . "\t" . $allvariables->{'PRODUCTMAJOR'} . "\n";
push(@{$propertyfile}, $onepropertyline);
}
if ( $allvariables->{'PRODUCTBUILDID'} )
{
my $onepropertyline = "PRODUCTBUILDID" . "\t" . $allvariables->{'PRODUCTBUILDID'} . "\n";
push(@{$propertyfile}, $onepropertyline);
}
if ( $allvariables->{'URELAYERVERSION'} )
{
my $onepropertyline = "URELAYERVERSION" . "\t" . $allvariables->{'URELAYERVERSION'} . "\n";
push(@{$propertyfile}, $onepropertyline);
}
if ( $allvariables->{'BRANDPACKAGEVERSION'} )
{
my $onepropertyline = "BRANDPACKAGEVERSION" . "\t" . $allvariables->{'BRANDPACKAGEVERSION'} . "\n";
push(@{$propertyfile}, $onepropertyline);
}
if ( $allvariables->{'EXCLUDE_FROM_REBASE'} )
{
my $onepropertyline = "EXCLUDE_FROM_REBASE" . "\t" . $allvariables->{'EXCLUDE_FROM_REBASE'} . "\n";
push(@{$propertyfile}, $onepropertyline);
}
if ( $allvariables->{'PREREQUIREDPATCH'} )
{
my $onepropertyline = "PREREQUIREDPATCH" . "\t" . $allvariables->{'PREREQUIREDPATCH'} . "\n";
push(@{$propertyfile}, $onepropertyline);
}
my $onepropertyline = "IGNOREPREREQUIREDPATCH" . "\t" . "1" . "\n";
push(@{$propertyfile}, $onepropertyline);
$onepropertyline = "DONTOPTIMIZELIBS" . "\t" . "0" . "\n";
push(@{$propertyfile}, $onepropertyline);
if ( $installer::globals::officedirhostname )
{
my $onepropertyline = "OFFICEDIRHOSTNAME" . "\t" . $installer::globals::officedirhostname . "\n";
push(@{$propertyfile}, $onepropertyline);
my $localofficedirhostname = $installer::globals::officedirhostname;
$localofficedirhostname =~ s/\//\\/g;
$onepropertyline = "OFFICEDIRHOSTNAME_" . "\t" . $localofficedirhostname . "\n";
push(@{$propertyfile}, $onepropertyline);
}
if ( $installer::globals::desktoplinkexists )
{
my $onepropertyline = "DESKTOPLINKEXISTS" . "\t" . "1" . "\n";
push(@{$propertyfile}, $onepropertyline);
$onepropertyline = "CREATEDESKTOPLINK" . "\t" . "1" . "\n"; # Setting the default
push(@{$propertyfile}, $onepropertyline);
}
if ( $installer::globals::languagepack )
{
my $onepropertyline = "ISLANGUAGEPACK" . "\t" . "1" . "\n";
push(@{$propertyfile}, $onepropertyline);
}
elsif ( $installer::globals::helppack )
{
my $onepropertyline = "ISHELPPACK" . "\t" . "1" . "\n";
push(@{$propertyfile}, $onepropertyline);
}
my $languagesline = "PRODUCTALLLANGUAGES" . "\t" . $$languagestringref . "\n";
push(@{$propertyfile}, $languagesline);
if (( $allvariables->{'PRODUCTEXTENSION'} ) && ( $allvariables->{'PRODUCTEXTENSION'} eq "Beta" ))
{
# my $registryline = "WRITE_REGISTRY" . "\t" . "0" . "\n";
# push(@{$propertyfile}, $registryline);
my $betainfoline = "BETAPRODUCT" . "\t" . "1" . "\n";
push(@{$propertyfile}, $betainfoline);
}
elsif ( $allvariables->{'DEVELOPMENTPRODUCT'} )
{
my $registryline = "WRITE_REGISTRY" . "\t" . "0" . "\n";
push(@{$propertyfile}, $registryline);
}
else
{
my $registryline = "WRITE_REGISTRY" . "\t" . "1" . "\n"; # Default: Write complete registry
push(@{$propertyfile}, $registryline);
}
# Adding also used tree conditions for multilayer products.
# These are saved in %installer::globals::usedtreeconditions
foreach my $treecondition (keys %installer::globals::usedtreeconditions)
{
my $onepropertyline = $treecondition . "\t" . "1" . "\n";
push(@{$propertyfile}, $onepropertyline);
}
# No more license dialog for selected products
if ( $allvariables->{'HIDELICENSEDIALOG'} )
{
my $onepropertyline = "HIDEEULA" . "\t" . "1" . "\n";
my $already_defined = 0;
for ( my $i = 0; $i <= $#{$propertyfile}; $i++ )
{
if ( ${$propertyfile}[$i] =~ /^\s*HIDEEULA\t/ )
{
${$propertyfile}[$i] = $onepropertyline;
$already_defined = 1;
last;
}
}
if ( ! $already_defined )
{
push(@{$propertyfile}, $onepropertyline);
}
}
}
#######################################################
# Setting properties needed for ms file type registration
#######################################################
sub set_ms_file_types_properties
{
my ($propertyfile) = @_;
# we do not register PPSM, PPAM, and XLAM file types in
# setup_native\source\win32\customactions\reg4allmsdoc\reg4allmsi.cxx
# (probably because LibreOffice can't deal with them properly (?)
push(@{$propertyfile}, "REGISTER_PPS" . "\t" . "0" . "\n");
push(@{$propertyfile}, "REGISTER_PPSX" . "\t" . "0" . "\n");
# push(@{$propertyfile}, "REGISTER_PPSM" . "\t" . "0" . "\n");
# push(@{$propertyfile}, "REGISTER_PPAM" . "\t" . "0" . "\n");
push(@{$propertyfile}, "REGISTER_PPT" . "\t" . "0" . "\n");
push(@{$propertyfile}, "REGISTER_PPTX" . "\t" . "0" . "\n");
push(@{$propertyfile}, "REGISTER_PPTM" . "\t" . "0" . "\n");
push(@{$propertyfile}, "REGISTER_POT" . "\t" . "0" . "\n");
push(@{$propertyfile}, "REGISTER_POTX" . "\t" . "0" . "\n");
push(@{$propertyfile}, "REGISTER_POTM" . "\t" . "0" . "\n");
push(@{$propertyfile}, "REGISTER_DOC" . "\t" . "0" . "\n");
push(@{$propertyfile}, "REGISTER_DOCX" . "\t" . "0" . "\n");
push(@{$propertyfile}, "REGISTER_DOCM" . "\t" . "0" . "\n");
push(@{$propertyfile}, "REGISTER_DOT" . "\t" . "0" . "\n");
push(@{$propertyfile}, "REGISTER_DOTX" . "\t" . "0" . "\n");
push(@{$propertyfile}, "REGISTER_DOTM" . "\t" . "0" . "\n");
push(@{$propertyfile}, "REGISTER_RTF" . "\t" . "0" . "\n");
push(@{$propertyfile}, "REGISTER_XLS" . "\t" . "0" . "\n");
push(@{$propertyfile}, "REGISTER_XLSX" . "\t" . "0" . "\n");
push(@{$propertyfile}, "REGISTER_XLSM" . "\t" . "0" . "\n");
push(@{$propertyfile}, "REGISTER_XLSB" . "\t" . "0" . "\n");
# push(@{$propertyfile}, "REGISTER_XLAM" . "\t" . "0" . "\n");
push(@{$propertyfile}, "REGISTER_XLT" . "\t" . "0" . "\n");
push(@{$propertyfile}, "REGISTER_XLTX" . "\t" . "0" . "\n");
push(@{$propertyfile}, "REGISTER_XLTM" . "\t" . "0" . "\n");
push(@{$propertyfile}, "REGISTER_IQY" . "\t" . "0" . "\n");
push(@{$propertyfile}, "REGISTER_NO_MSO_TYPES" . "\t" . "0" . "\n");
push(@{$propertyfile}, "REGISTER_ALL_MSO_TYPES" . "\t" . "0" . "\n");
}
####################################################################################
# Updating the file Property.idt dynamically
# Content:
# Property Value
####################################################################################
sub update_property_table
{
my ($basedir, $language, $allvariables, $languagestringref) = @_;
my $properyfilename = $basedir . $installer::globals::separator . "Property.idt";
my $propertyfile = installer::files::read_file($properyfilename);
my $hasarpnomodify = 0;
# Getting the new values
# Some values (arpcomments, arpcontacts, ...) are inserted from the Property.mlf
my $arpcomments = get_arpcomments_for_property_table($allvariables, $languagestringref);
my $installlevel = get_installlevel_for_property_table();
my $ischeckforproductupdates = get_ischeckforproductupdates_for_property_table();
my $manufacturer = get_manufacturer_for_property_table();
my $productlanguage = get_productlanguage_for_property_table($language);
my $productname = get_productname_for_property_table($language, $allvariables);
my $productversion = get_productversion_for_property_table();
my $quickstarterlinkname = get_quickstarterlinkname_for_property_table($language, $allvariables);
my $windowsminversiontext = "Windows 7 SP1";
my $windowsminversionnumber = "601";
my $windowsminspnumber = "1";
# Updating the values
for ( my $i = 0; $i <= $#{$propertyfile}; $i++ )
{
${$propertyfile}[$i] =~ s/\bARPCOMMENTSTEMPLATE\b/$arpcomments/;
${$propertyfile}[$i] =~ s/\bINSTALLLEVELTEMPLATE\b/$installlevel/;
${$propertyfile}[$i] =~ s/\bISCHECKFORPRODUCTUPDATESTEMPLATE\b/$ischeckforproductupdates/;
${$propertyfile}[$i] =~ s/\bMANUFACTURERTEMPLATE\b/$manufacturer/;
${$propertyfile}[$i] =~ s/\bPRODUCTLANGUAGETEMPLATE\b/$productlanguage/;
${$propertyfile}[$i] =~ s/\bPRODUCTNAMETEMPLATE\b/$productname/;
${$propertyfile}[$i] =~ s/\bPRODUCTVERSIONTEMPLATE\b/$productversion/;
${$propertyfile}[$i] =~ s/\bQUICKSTARTERLINKNAMETEMPLATE\b/$quickstarterlinkname/;
${$propertyfile}[$i] =~ s/\bWINDOWSMINVERSIONTEXTTEMPLATE\b/$windowsminversiontext/;
${$propertyfile}[$i] =~ s/\bWINDOWSMINVERSIONNUMBERTEMPLATE\b/$windowsminversionnumber/;
${$propertyfile}[$i] =~ s/\bWINDOWSMINSPNUMBERTEMPLATE\b/$windowsminspnumber/;
if ( ${$propertyfile}[$i] =~ m/\bARPNOMODIFY\b/ ) { $hasarpnomodify = 1; }
}
# Check if are building silent MSI
if ( $ENV{ENABLE_SILENT_MSI} eq "TRUE" )
{
push(@{$propertyfile}, "LIMITUI" . "\t" . "1" . "\n");
if ( !($hasarpnomodify) )
{
push(@{$propertyfile}, "ARPNOMODIFY" . "\t" . "1" . "\n");
}
}
# Setting variables into propertytable
set_important_properties($propertyfile, $allvariables, $languagestringref);
# Setting variables for register for ms file types
set_ms_file_types_properties($propertyfile);
# Saving the file
installer::files::save_file($properyfilename ,$propertyfile);
my $infoline = "Updated idt file: $properyfilename\n";
push(@installer::globals::logfileinfo, $infoline);
}
####################################################################################
# Setting language specific Properties in file Property.idt dynamically
# Adding:
# isMulti = 1
####################################################################################
sub set_languages_in_property_table
{
my ($basedir, $languagesarrayref) = @_;
my $properyfilename = $basedir . $installer::globals::separator . "Property.idt";
my $propertyfile = installer::files::read_file($properyfilename);
# Setting the info about multilingual installation in property "isMulti"
my $propertyname = "isMulti";
my $ismultivalue = 0;
if ( $installer::globals::ismultilingual ) { $ismultivalue = 1; }
my $onepropertyline = $propertyname . "\t" . $ismultivalue . "\n";
push(@{$propertyfile}, $onepropertyline);
# setting the ARPPRODUCTICON
if ($installer::globals::sofficeiconadded) # set in shortcut.pm
{
$onepropertyline = "ARPPRODUCTICON" . "\t" . "soffice.ico" . "\n";
push(@{$propertyfile}, $onepropertyline);
}
# Saving the file
installer::files::save_file($properyfilename ,$propertyfile);
my $infoline = "Added language content into idt file: $properyfilename\n";
push(@installer::globals::logfileinfo, $infoline);
}
############################################################
# Setting the ProductCode and the UpgradeCode
# into the Property table. Both have to be stored
# in the global file $installer::globals::codefilename
############################################################
sub set_codes_in_property_table
{
my ($basedir) = @_;
# Reading the property file
my $properyfilename = $basedir . $installer::globals::separator . "Property.idt";
my $propertyfile = installer::files::read_file($properyfilename);
# Updating the values
for ( my $i = 0; $i <= $#{$propertyfile}; $i++ )
{
${$propertyfile}[$i] =~ s/\bPRODUCTCODETEMPLATE\b/$installer::globals::productcode/;
${$propertyfile}[$i] =~ s/\bUPGRADECODETEMPLATE\b/$installer::globals::upgradecode/;
}
# Saving the property file
installer::files::save_file($properyfilename ,$propertyfile);
my $infoline = "Added language content into idt file: $properyfilename\n";
push(@installer::globals::logfileinfo, $infoline);
}
############################################################
# Changing default for MS file type registration
# in Beta products.
############################################################
sub update_checkbox_table
{
my ($basedir, $allvariables) = @_;
if (( $allvariables->{'PRODUCTEXTENSION'} ) && ( $allvariables->{'PRODUCTEXTENSION'} eq "Beta" ))
{
my $checkboxfilename = $basedir . $installer::globals::separator . "CheckBox.idt";
if ( -f $checkboxfilename )
{
my $checkboxfile = installer::files::read_file($checkboxfilename);
my $checkboxline = "SELECT_WORD" . "\t" . "0" . "\n";
push(@{$checkboxfile}, $checkboxline);
$checkboxline = "SELECT_EXCEL" . "\t" . "0" . "\n";
push(@{$checkboxfile}, $checkboxline);
$checkboxline = "SELECT_POWERPOINT" . "\t" . "0" . "\n";
push(@{$checkboxfile}, $checkboxline);
$checkboxline = "SELECT_VISIO" . "\t" . "0" . "\n";
push(@{$checkboxfile}, $checkboxline);
# Saving the property file
installer::files::save_file($checkboxfilename ,$checkboxfile);
my $infoline = "Added ms file type defaults into idt file: $checkboxfilename\n";
push(@installer::globals::logfileinfo, $infoline);
}
}
}
1;
|