2 # This file is part of the LibreOffice project.
4 # This Source Code Form is subject to the terms of the Mozilla Public
5 # License, v. 2.0. If a copy of the MPL was not distributed with this
6 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 # This file incorporates work covered by the following license notice:
10 # Licensed to the Apache Software Foundation (ASF) under one or more
11 # contributor license agreements. See the NOTICE file distributed
12 # with this work for additional information regarding copyright
13 # ownership. The ASF licenses this file to you under the Apache
14 # License, Version 2.0 (the "License"); you may not use this file
15 # except in compliance with the License. You may obtain a copy of
16 # the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 package installer
::windows
::property
;
24 use installer
::exiter
;
26 use installer
::globals
;
27 use installer
::windows
::idtglobal
;
28 use installer
::windows
::language
;
30 #############################################
31 # Setting the properties dynamically
32 # for the table Property.idt
33 #############################################
35 sub get_arpcomments_for_property_table
37 my ( $allvariables, $languagestringref ) = @_;
39 my $name = $allvariables->{'PRODUCTNAME'};
40 my $version = $allvariables->{'PRODUCTVERSION'};
41 my $comment = $name . " " . $version;
43 my $postversionextension = "";
44 if ( $allvariables->{'POSTVERSIONEXTENSION'} )
46 $postversionextension = $allvariables->{'POSTVERSIONEXTENSION'};
47 $comment = $comment . " " . $postversionextension;
50 if ( $installer::globals
::languagepack
) { $comment = $comment . " " . "Language Pack"; }
51 elsif ( $installer::globals
::helppack
) { $comment = $comment . " " . "Help Pack"; }
53 my $languagestring = $$languagestringref;
54 $languagestring =~ s/\_/\,/g;
55 if ( length($languagestring) > 30 ) { $languagestring = "multilanguage"; } # fdo#64053
57 $comment = $comment . " ($languagestring)";
62 sub get_installlevel_for_property_table
64 my $installlevel = "100";
68 sub get_ischeckforproductupdates_for_property_table
70 my $ischeckforproductupdates = "1";
71 return $ischeckforproductupdates;
74 sub get_manufacturer_for_property_table
76 return $installer::globals
::manufacturer
;
79 sub get_productlanguage_for_property_table
82 my $windowslanguage = installer
::windows
::language
::get_windows_language
($language);
83 return $windowslanguage;
86 sub get_language_string
90 for ( my $i = 0; $i <= $#installer::globals
::languagenames
; $i++ )
92 $langstring = $langstring . $installer::globals
::languagenames
[$i] . ", ";
95 $langstring =~ s/\,\s*$//;
96 $langstring = "(" . $langstring . ")";
101 sub get_english_language_string
105 # Sorting value not keys, therefore collecting all values
107 foreach my $lang ( keys %installer::globals
::all_required_english_languagestrings
)
109 $helper{$installer::globals
::all_required_english_languagestrings
{$lang}} = 1;
112 foreach my $lang ( sort keys %helper )
114 $langstring = $langstring . $lang . ", ";
117 $langstring =~ s/\,\s*$//;
118 $langstring = "(" . $langstring . ")";
123 sub get_productname
($$)
125 my ( $language, $allvariables ) = @_;
127 my $name = $allvariables->{'PRODUCTNAME'};
132 sub get_productname_for_property_table
($$)
134 my ( $language, $allvariables ) = @_;
136 my $name = get_productname
($language, $allvariables);
137 my $version = $allvariables->{'PRODUCTVERSION'};
138 my $productname = $name . " " . $version;
140 my $productextension = "";
141 if ( $allvariables->{'PRODUCTEXTENSION'} )
143 $productextension = $allvariables->{'PRODUCTEXTENSION'};
144 $productname = $productname . $productextension;
147 my $postversionextension = "";
148 if ( $allvariables->{'POSTVERSIONEXTENSION'} )
150 $postversionextension = $allvariables->{'POSTVERSIONEXTENSION'};
151 $productname = $productname . " " . $postversionextension;
154 if ( $installer::globals
::languagepack
)
156 my $langstring = get_english_language_string
(); # Example: (English, German)
157 $productname = $name . " " . $version . " Language Pack" . " " . $langstring;
159 elsif ( $installer::globals
::helppack
)
161 my $langstring = get_english_language_string
(); # New: (English, German)
162 $productname = $name . " " . $version . " Help Pack" . " " . $langstring;
165 # Saving this name in hash $allvariables for further usage
166 $allvariables->{'PROPERTYTABLEPRODUCTNAME'} = $productname;
167 my $infoline = "Defined variable PROPERTYTABLEPRODUCTNAME: $productname\n";
168 push(@installer::globals
::logfileinfo
, $infoline);
173 sub get_quickstarterlinkname_for_property_table
($$)
175 my ( $language, $allvariables ) = @_;
177 # no usage of POSTVERSIONEXTENSION for Quickstarter link name!
178 my $name = get_productname
($language, $allvariables);
179 my $version = $allvariables->{'PRODUCTVERSION'};
180 my $quickstartername = $name . " " . $version;
182 my $infoline = "Defined Quickstarter Link name: $quickstartername\n";
183 push(@installer::globals
::logfileinfo
, $infoline);
185 return $quickstartername;
188 sub get_productversion_for_property_table
190 return $installer::globals
::msiproductversion
;
193 #######################################################
194 # Setting some important properties
195 # (for finding the product in deinstallation process)
196 #######################################################
198 sub set_important_properties
200 my ($propertyfile, $allvariables, $languagestringref) = @_;
202 # Setting new variables with the content of %PRODUCTNAME and %PRODUCTVERSION
203 if ( $allvariables->{'PRODUCTNAME'} )
205 my $onepropertyline = "DEFINEDPRODUCT" . "\t" . $allvariables->{'PRODUCTNAME'} . "\n";
206 push(@
{$propertyfile}, $onepropertyline);
209 if ( $allvariables->{'PRODUCTVERSION'} )
211 my $onepropertyline = "DEFINEDVERSION" . "\t" . $allvariables->{'PRODUCTVERSION'} . "\n";
212 push(@
{$propertyfile}, $onepropertyline);
215 if ( $allvariables->{'PRODUCTMAJOR'} )
217 my $onepropertyline = "PRODUCTMAJOR" . "\t" . $allvariables->{'PRODUCTMAJOR'} . "\n";
218 push(@
{$propertyfile}, $onepropertyline);
221 if ( $allvariables->{'PRODUCTBUILDID'} )
223 my $onepropertyline = "PRODUCTBUILDID" . "\t" . $allvariables->{'PRODUCTBUILDID'} . "\n";
224 push(@
{$propertyfile}, $onepropertyline);
227 if ( $allvariables->{'URELAYERVERSION'} )
229 my $onepropertyline = "URELAYERVERSION" . "\t" . $allvariables->{'URELAYERVERSION'} . "\n";
230 push(@
{$propertyfile}, $onepropertyline);
233 if ( $allvariables->{'BRANDPACKAGEVERSION'} )
235 my $onepropertyline = "BRANDPACKAGEVERSION" . "\t" . $allvariables->{'BRANDPACKAGEVERSION'} . "\n";
236 push(@
{$propertyfile}, $onepropertyline);
239 if ( $allvariables->{'EXCLUDE_FROM_REBASE'} )
241 my $onepropertyline = "EXCLUDE_FROM_REBASE" . "\t" . $allvariables->{'EXCLUDE_FROM_REBASE'} . "\n";
242 push(@
{$propertyfile}, $onepropertyline);
245 if ( $allvariables->{'PREREQUIREDPATCH'} )
247 my $onepropertyline = "PREREQUIREDPATCH" . "\t" . $allvariables->{'PREREQUIREDPATCH'} . "\n";
248 push(@
{$propertyfile}, $onepropertyline);
251 my $onepropertyline = "IGNOREPREREQUIREDPATCH" . "\t" . "1" . "\n";
252 push(@
{$propertyfile}, $onepropertyline);
254 $onepropertyline = "DONTOPTIMIZELIBS" . "\t" . "0" . "\n";
255 push(@
{$propertyfile}, $onepropertyline);
257 if ( $installer::globals
::officedirhostname
)
259 my $onepropertyline = "OFFICEDIRHOSTNAME" . "\t" . $installer::globals
::officedirhostname
. "\n";
260 push(@
{$propertyfile}, $onepropertyline);
262 my $localofficedirhostname = $installer::globals
::officedirhostname
;
263 $localofficedirhostname =~ s/\//\\/g
;
264 $onepropertyline = "OFFICEDIRHOSTNAME_" . "\t" . $localofficedirhostname . "\n";
265 push(@
{$propertyfile}, $onepropertyline);
268 if ( $installer::globals
::desktoplinkexists
)
270 my $onepropertyline = "DESKTOPLINKEXISTS" . "\t" . "1" . "\n";
271 push(@
{$propertyfile}, $onepropertyline);
273 $onepropertyline = "CREATEDESKTOPLINK" . "\t" . "1" . "\n"; # Setting the default
274 push(@
{$propertyfile}, $onepropertyline);
277 if ( $installer::globals
::languagepack
)
279 my $onepropertyline = "ISLANGUAGEPACK" . "\t" . "1" . "\n";
280 push(@
{$propertyfile}, $onepropertyline);
282 elsif ( $installer::globals
::helppack
)
284 my $onepropertyline = "ISHELPPACK" . "\t" . "1" . "\n";
285 push(@
{$propertyfile}, $onepropertyline);
288 my $languagesline = "PRODUCTALLLANGUAGES" . "\t" . $$languagestringref . "\n";
289 push(@
{$propertyfile}, $languagesline);
291 if (( $allvariables->{'PRODUCTEXTENSION'} ) && ( $allvariables->{'PRODUCTEXTENSION'} eq "Beta" ))
293 # my $registryline = "WRITE_REGISTRY" . "\t" . "0" . "\n";
294 # push(@{$propertyfile}, $registryline);
295 my $betainfoline = "BETAPRODUCT" . "\t" . "1" . "\n";
296 push(@
{$propertyfile}, $betainfoline);
298 elsif ( $allvariables->{'DEVELOPMENTPRODUCT'} )
300 my $registryline = "WRITE_REGISTRY" . "\t" . "0" . "\n";
301 push(@
{$propertyfile}, $registryline);
305 my $registryline = "WRITE_REGISTRY" . "\t" . "1" . "\n"; # Default: Write complete registry
306 push(@
{$propertyfile}, $registryline);
309 # Adding also used tree conditions for multilayer products.
310 # These are saved in %installer::globals::usedtreeconditions
311 foreach my $treecondition (keys %installer::globals
::usedtreeconditions
)
313 my $onepropertyline = $treecondition . "\t" . "1" . "\n";
314 push(@
{$propertyfile}, $onepropertyline);
317 # No more license dialog for selected products
318 if ( $allvariables->{'HIDELICENSEDIALOG'} )
320 my $onepropertyline = "HIDEEULA" . "\t" . "1" . "\n";
322 my $already_defined = 0;
324 for ( my $i = 0; $i <= $#{$propertyfile}; $i++ )
326 if ( ${$propertyfile}[$i] =~ /^\s*HIDEEULA\t/ )
328 ${$propertyfile}[$i] = $onepropertyline;
329 $already_defined = 1;
334 if ( ! $already_defined )
336 push(@
{$propertyfile}, $onepropertyline);
341 #######################################################
342 # Setting properties needed for ms file type registration
343 #######################################################
345 sub set_ms_file_types_properties
347 my ($propertyfile) = @_;
349 # we do not register PPSM, PPAM, and XLAM file types in
350 # setup_native\source\win32\customactions\reg4allmsdoc\reg4allmsi.cxx
351 # (probably because LibreOffice can't deal with them properly (?)
353 push(@
{$propertyfile}, "REGISTER_PPS" . "\t" . "0" . "\n");
354 push(@
{$propertyfile}, "REGISTER_PPSX" . "\t" . "0" . "\n");
355 # push(@{$propertyfile}, "REGISTER_PPSM" . "\t" . "0" . "\n");
356 # push(@{$propertyfile}, "REGISTER_PPAM" . "\t" . "0" . "\n");
357 push(@
{$propertyfile}, "REGISTER_PPT" . "\t" . "0" . "\n");
358 push(@
{$propertyfile}, "REGISTER_PPTX" . "\t" . "0" . "\n");
359 push(@
{$propertyfile}, "REGISTER_PPTM" . "\t" . "0" . "\n");
360 push(@
{$propertyfile}, "REGISTER_POT" . "\t" . "0" . "\n");
361 push(@
{$propertyfile}, "REGISTER_POTX" . "\t" . "0" . "\n");
362 push(@
{$propertyfile}, "REGISTER_POTM" . "\t" . "0" . "\n");
364 push(@
{$propertyfile}, "REGISTER_DOC" . "\t" . "0" . "\n");
365 push(@
{$propertyfile}, "REGISTER_DOCX" . "\t" . "0" . "\n");
366 push(@
{$propertyfile}, "REGISTER_DOCM" . "\t" . "0" . "\n");
367 push(@
{$propertyfile}, "REGISTER_DOT" . "\t" . "0" . "\n");
368 push(@
{$propertyfile}, "REGISTER_DOTX" . "\t" . "0" . "\n");
369 push(@
{$propertyfile}, "REGISTER_DOTM" . "\t" . "0" . "\n");
370 push(@
{$propertyfile}, "REGISTER_RTF" . "\t" . "0" . "\n");
372 push(@
{$propertyfile}, "REGISTER_XLR" . "\t" . "0" . "\n");
373 push(@
{$propertyfile}, "REGISTER_XLS" . "\t" . "0" . "\n");
374 push(@
{$propertyfile}, "REGISTER_XLSX" . "\t" . "0" . "\n");
375 push(@
{$propertyfile}, "REGISTER_XLSM" . "\t" . "0" . "\n");
376 push(@
{$propertyfile}, "REGISTER_XLSB" . "\t" . "0" . "\n");
377 # push(@{$propertyfile}, "REGISTER_XLAM" . "\t" . "0" . "\n");
378 push(@
{$propertyfile}, "REGISTER_XLT" . "\t" . "0" . "\n");
379 push(@
{$propertyfile}, "REGISTER_XLTX" . "\t" . "0" . "\n");
380 push(@
{$propertyfile}, "REGISTER_XLTM" . "\t" . "0" . "\n");
381 push(@
{$propertyfile}, "REGISTER_IQY" . "\t" . "0" . "\n");
383 push(@
{$propertyfile}, "REGISTER_NO_MSO_TYPES" . "\t" . "0" . "\n");
384 push(@
{$propertyfile}, "REGISTER_ALL_MSO_TYPES" . "\t" . "0" . "\n");
387 ####################################################################################
388 # Updating the file Property.idt dynamically
391 ####################################################################################
393 sub update_property_table
395 my ($basedir, $language, $allvariables, $languagestringref) = @_;
397 my $properyfilename = $basedir . $installer::globals
::separator
. "Property.idt";
399 my $propertyfile = installer
::files
::read_file
($properyfilename);
401 my $hasarpnomodify = 0;
403 # Getting the new values
404 # Some values (arpcomments, arpcontacts, ...) are inserted from the Property.mlf
406 my $arpcomments = get_arpcomments_for_property_table
($allvariables, $languagestringref);
407 my $installlevel = get_installlevel_for_property_table
();
408 my $ischeckforproductupdates = get_ischeckforproductupdates_for_property_table
();
409 my $manufacturer = get_manufacturer_for_property_table
();
410 my $productlanguage = get_productlanguage_for_property_table
($language);
411 my $productname = get_productname_for_property_table
($language, $allvariables);
412 my $productversion = get_productversion_for_property_table
();
413 my $quickstarterlinkname = get_quickstarterlinkname_for_property_table
($language, $allvariables);
414 my $windowsminversiontext = "Windows 10";
415 my $winmajorvermin = "#10";
417 # Updating the values
419 for ( my $i = 0; $i <= $#{$propertyfile}; $i++ )
421 ${$propertyfile}[$i] =~ s/\bARPCOMMENTSTEMPLATE\b/$arpcomments/;
422 ${$propertyfile}[$i] =~ s/\bINSTALLLEVELTEMPLATE\b/$installlevel/;
423 ${$propertyfile}[$i] =~ s/\bISCHECKFORPRODUCTUPDATESTEMPLATE\b/$ischeckforproductupdates/;
424 ${$propertyfile}[$i] =~ s/\bMANUFACTURERTEMPLATE\b/$manufacturer/;
425 ${$propertyfile}[$i] =~ s/\bPRODUCTLANGUAGETEMPLATE\b/$productlanguage/;
426 ${$propertyfile}[$i] =~ s/\bPRODUCTNAMETEMPLATE\b/$productname/;
427 ${$propertyfile}[$i] =~ s/\bPRODUCTVERSIONTEMPLATE\b/$productversion/;
428 ${$propertyfile}[$i] =~ s/\bQUICKSTARTERLINKNAMETEMPLATE\b/$quickstarterlinkname/;
429 ${$propertyfile}[$i] =~ s/\bWINDOWSMINVERSIONTEXTTEMPLATE\b/$windowsminversiontext/;
430 ${$propertyfile}[$i] =~ s/\bWINMAJORVERMINTEMPLATE\b/$winmajorvermin/;
431 if ( ${$propertyfile}[$i] =~ m/\bARPNOMODIFY\b/ ) { $hasarpnomodify = 1; }
434 # Check if are building silent MSI
435 if ( $ENV{ENABLE_SILENT_MSI
} eq "TRUE" )
437 push(@
{$propertyfile}, "LIMITUI" . "\t" . "1" . "\n");
438 if ( !($hasarpnomodify) )
440 push(@
{$propertyfile}, "ARPNOMODIFY" . "\t" . "1" . "\n");
444 # Setting variables into propertytable
445 set_important_properties
($propertyfile, $allvariables, $languagestringref);
447 # Setting variables for register for ms file types
448 set_ms_file_types_properties
($propertyfile);
452 installer
::files
::save_file
($properyfilename ,$propertyfile);
453 my $infoline = "Updated idt file: $properyfilename\n";
454 push(@installer::globals
::logfileinfo
, $infoline);
458 ####################################################################################
459 # Setting language specific Properties in file Property.idt dynamically
462 ####################################################################################
464 sub set_languages_in_property_table
466 my ($basedir, $languagesarrayref) = @_;
468 my $properyfilename = $basedir . $installer::globals
::separator
. "Property.idt";
469 my $propertyfile = installer
::files
::read_file
($properyfilename);
471 # Setting the info about multilingual installation in property "isMulti"
473 my $propertyname = "isMulti";
474 my $ismultivalue = 0;
476 if ( $installer::globals
::ismultilingual
) { $ismultivalue = 1; }
478 my $onepropertyline = $propertyname . "\t" . $ismultivalue . "\n";
479 push(@
{$propertyfile}, $onepropertyline);
481 # setting the ARPPRODUCTICON
483 if ($installer::globals
::sofficeiconadded
) # set in shortcut.pm
485 $onepropertyline = "ARPPRODUCTICON" . "\t" . "soffice.ico" . "\n";
486 push(@
{$propertyfile}, $onepropertyline);
491 installer
::files
::save_file
($properyfilename ,$propertyfile);
492 my $infoline = "Added language content into idt file: $properyfilename\n";
493 push(@installer::globals
::logfileinfo
, $infoline);
497 ############################################################
498 # Setting the ProductCode and the UpgradeCode
499 # into the Property table. Both have to be stored
500 # in the global file $installer::globals::codefilename
501 ############################################################
503 sub set_codes_in_property_table
507 # Reading the property file
509 my $properyfilename = $basedir . $installer::globals
::separator
. "Property.idt";
510 my $propertyfile = installer
::files
::read_file
($properyfilename);
512 # Updating the values
514 for ( my $i = 0; $i <= $#{$propertyfile}; $i++ )
516 ${$propertyfile}[$i] =~ s/\bPRODUCTCODETEMPLATE\b/$installer::globals::productcode/;
517 ${$propertyfile}[$i] =~ s/\bUPGRADECODETEMPLATE\b/$installer::globals::upgradecode/;
520 # Saving the property file
522 installer
::files
::save_file
($properyfilename ,$propertyfile);
523 my $infoline = "Added language content into idt file: $properyfilename\n";
524 push(@installer::globals
::logfileinfo
, $infoline);
528 ############################################################
529 # Changing default for MS file type registration
531 ############################################################
533 sub update_checkbox_table
535 my ($basedir, $allvariables) = @_;
537 if (( $allvariables->{'PRODUCTEXTENSION'} ) && ( $allvariables->{'PRODUCTEXTENSION'} eq "Beta" ))
539 my $checkboxfilename = $basedir . $installer::globals
::separator
. "CheckBox.idt";
541 if ( -f
$checkboxfilename )
543 my $checkboxfile = installer
::files
::read_file
($checkboxfilename);
545 my $checkboxline = "SELECT_WORD" . "\t" . "0" . "\n";
546 push(@
{$checkboxfile}, $checkboxline);
547 $checkboxline = "SELECT_EXCEL" . "\t" . "0" . "\n";
548 push(@
{$checkboxfile}, $checkboxline);
549 $checkboxline = "SELECT_POWERPOINT" . "\t" . "0" . "\n";
550 push(@
{$checkboxfile}, $checkboxline);
551 $checkboxline = "SELECT_VISIO" . "\t" . "0" . "\n";
552 push(@
{$checkboxfile}, $checkboxline);
554 # Saving the property file
555 installer
::files
::save_file
($checkboxfilename ,$checkboxfile);
556 my $infoline = "Added ms file type defaults into idt file: $checkboxfilename\n";
557 push(@installer::globals
::logfileinfo
, $infoline);