merge the formfield patch from ooo-build
[ooovba.git] / solenv / bin / modules / installer / scriptitems.pm
bloba215a41ca6d43939531f9cae2e662d7f717ad933
1 #*************************************************************************
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 #
5 # Copyright 2008 by Sun Microsystems, Inc.
7 # OpenOffice.org - a multi-platform office productivity suite
9 # $RCSfile: scriptitems.pm,v $
11 # $Revision: 1.53 $
13 # This file is part of OpenOffice.org.
15 # OpenOffice.org is free software: you can redistribute it and/or modify
16 # it under the terms of the GNU Lesser General Public License version 3
17 # only, as published by the Free Software Foundation.
19 # OpenOffice.org is distributed in the hope that it will be useful,
20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 # GNU Lesser General Public License version 3 for more details
23 # (a copy is included in the LICENSE file that accompanied this code).
25 # You should have received a copy of the GNU Lesser General Public License
26 # version 3 along with OpenOffice.org. If not, see
27 # <http://www.openoffice.org/license.html>
28 # for a copy of the LGPLv3 License.
30 #*************************************************************************
32 package installer::scriptitems;
34 use installer::converter;
35 use installer::existence;
36 use installer::exiter;
37 use installer::globals;
38 use installer::languages;
39 use installer::logger;
40 use installer::pathanalyzer;
41 use installer::remover;
42 use installer::systemactions;
44 ################################################################
45 # Resolving the GID for the directories defined in setup script
46 ################################################################
48 sub resolve_all_directory_names
50 my ($directoryarrayref) = @_;
52 if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::resolve_all_directory_names : $#{$directoryarrayref}"); }
54 # After this procedure the hash shall contain the complete language
55 # dependent path, not only the language dependent HostName.
57 my ($key, $value, $parentvalue, $parentgid, $parentdirectoryhashref);
59 for ( my $i = 0; $i <= $#{$directoryarrayref}; $i++ )
61 my $directoryhashref = ${$directoryarrayref}[$i];
62 my $gid = $directoryhashref-> {'gid'};
63 my $parentid = $directoryhashref-> {'ParentID'};
65 if ( $parentid ne "PREDEFINED_PROGDIR" )
67 # find the array of the parentid, which has to be defined before in setup script
68 # and is therefore listed before in this array
70 for ( my $j = 0; $j <= $i; $j++ )
72 $parentdirectoryhashref = ${$directoryarrayref}[$j];
73 $parentgid = $parentdirectoryhashref->{'gid'};
75 if ( $parentid eq $parentgid)
77 last;
81 # and now we can put the path together
82 # But take care of the languages!
84 my $dirismultilingual = $directoryhashref->{'ismultilingual'};
85 my $parentismultilingual = $parentdirectoryhashref->{'ismultilingual'};
87 # First: Both directories are language independent or both directories are language dependent
89 if ((( ! $dirismultilingual ) && ( ! $parentismultilingual )) ||
90 (( $dirismultilingual ) && ( $parentismultilingual )))
92 foreach $key (keys %{$directoryhashref})
94 # the key ("HostName (en-US)") must be usable for both hashes
96 if ( $key =~ /\bHostName\b/ )
98 $parentvalue = "";
99 $value = $directoryhashref->{$key};
100 if ( $parentdirectoryhashref->{$key} ) { $parentvalue = $parentdirectoryhashref->{$key}; }
102 # It is possible, that in scp project, a directory is defined in more languages than
103 # the directory parent (happened after automatic generation of macros.inc).
104 # Therefore this is checked now and written with a warning into the logfile.
105 # This is no error, because (in most cases) the concerned language is not build.
107 if ($parentvalue eq "")
109 $directoryhashref->{$key} = "FAILURE";
110 my $infoline = "WARNING: No hostname for $parentid with \"$key\". Needed by child directory $gid !\n";
111 push( @installer::globals::globallogfileinfo, $infoline);
113 else
115 $directoryhashref->{$key} = $parentvalue . $installer::globals::separator . $value;
121 # Second: The directory is language dependent, the parent not
123 if (( $dirismultilingual ) && ( ! $parentismultilingual ))
125 $parentvalue = $parentdirectoryhashref->{'HostName'}; # there is only one
127 foreach $key (keys %{$directoryhashref}) # the current directory
129 if ( $key =~ /\bHostName\b/ )
131 $value = $directoryhashref->{$key};
132 $directoryhashref->{$key} = $parentvalue . $installer::globals::separator . $value;
137 # Third: The directory is not language dependent, the parent is language dependent
139 if (( ! $dirismultilingual ) && ( $parentismultilingual ))
141 $value = $directoryhashref->{'HostName'}; # there is only one
142 delete($directoryhashref->{'HostName'});
144 foreach $key (keys %{$parentdirectoryhashref}) # the parent directory
146 if ( $key =~ /\bHostName\b/ )
148 $parentvalue = $parentdirectoryhashref->{$key}; # there is only one
149 $directoryhashref->{$key} = $parentvalue . $installer::globals::separator . $value;
153 $directoryhashref->{'ismultilingual'} = 1; # now this directory is also language dependent
159 #############################################################################
160 # Files with flag DELETE_ONLY do not need to be packed into installation set
161 #############################################################################
163 sub remove_delete_only_files_from_productlists
165 my ($productarrayref) = @_;
167 if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::remove_delete_only_files_from_productlists : $#{$productarrayref}"); }
169 my @newitems = ();
171 for ( my $i = 0; $i <= $#{$productarrayref}; $i++ )
173 my $oneitem = ${$productarrayref}[$i];
174 my $styles = "";
176 if ( $oneitem->{'Styles'} ) { $styles = $oneitem->{'Styles'}; }
178 if (!($styles =~ /\bDELETE_ONLY\b/))
180 push(@newitems, $oneitem);
184 return \@newitems;
187 #############################################################################
188 # Files with flag NOT_IN_SUITE do not need to be packed into
189 # Suite installation sets
190 #############################################################################
192 sub remove_notinsuite_files_from_productlists
194 my ($productarrayref) = @_;
196 if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::remove_notinsuite_files_from_productlists : $#{$productarrayref}"); }
198 my @newitems = ();
200 for ( my $i = 0; $i <= $#{$productarrayref}; $i++ )
202 my $oneitem = ${$productarrayref}[$i];
203 my $styles = "";
205 if ( $oneitem->{'Styles'} ) { $styles = $oneitem->{'Styles'}; }
207 if (!($styles =~ /\bNOT_IN_SUITE\b/))
209 push(@newitems, $oneitem);
211 else
213 my $infoline = "INFO: Flag NOT_IN_SUITE \-\> Removing $oneitem->{'gid'} from file list.\n";
214 push( @installer::globals::globallogfileinfo, $infoline);
218 return \@newitems;
221 #############################################################################
222 # Files with flag NOT_IN_SUITE do not need to be packed into
223 # Suite installation sets
224 #############################################################################
226 sub remove_office_start_language_files
228 my ($productarrayref) = @_;
230 if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::remove_notinsuite_files_from_productlists : $#{$productarrayref}"); }
232 my @newitems = ();
234 for ( my $i = 0; $i <= $#{$productarrayref}; $i++ )
236 my $oneitem = ${$productarrayref}[$i];
237 my $styles = "";
239 if ( $oneitem->{'Styles'} ) { $styles = $oneitem->{'Styles'}; }
241 if (!($styles =~ /\bSET_OFFICE_LANGUAGE\b/))
243 push(@newitems, $oneitem);
245 else
247 my $infoline = "INFO: Flag SET_OFFICE_LANGUAGE \-\> Removing $oneitem->{'gid'} from file list.\n";
248 push( @installer::globals::globallogfileinfo, $infoline);
252 return \@newitems;
255 #############################################################################
256 # Registryitems for Uninstall have to be removed
257 #############################################################################
259 sub remove_uninstall_regitems_from_script
261 my ($registryarrayref) = @_;
263 if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::remove_uninstall_regitems_from_script : $#{$registryarrayref}"); }
265 my @newitems = ();
267 for ( my $i = 0; $i <= $#{$registryarrayref}; $i++ )
269 my $oneitem = ${$registryarrayref}[$i];
270 my $subkey = "";
272 if ( $oneitem->{'Subkey'} ) { $subkey = $oneitem->{'Subkey'}; }
274 if ( $subkey =~ /Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall/ ) { next; }
276 push(@newitems, $oneitem);
279 return \@newitems;
282 ##############################################################################
283 # Searching the language module for a specified language
284 ##############################################################################
286 sub get_languagespecific_module
288 my ( $lang, $modulestring ) = @_;
290 my $langmodulestring = "";
292 my $module;
293 foreach $module ( keys %installer::globals::alllangmodules )
295 if (( $installer::globals::alllangmodules{$module} eq $lang ) && ( $modulestring =~ /\b$module\b/ ))
297 $langmodulestring = "$langmodulestring,$module";
301 $langmodulestring =~ s/^\s*,//;
303 if ( $langmodulestring eq "" ) { installer::exiter::exit_program("ERROR: No language pack module found for language $lang in string \"$modulestring\"!", "get_languagespecific_module"); }
305 return $langmodulestring;
308 ##############################################################################
309 # Removing all items in product lists which do not have the correct languages
310 ##############################################################################
312 sub resolving_all_languages_in_productlists
314 my ($productarrayref, $languagesarrayref) = @_;
316 if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::resolving_all_languages_in_productlists : $#{$productarrayref} : $#{$languagesarrayref}"); }
318 my @itemsinalllanguages = ();
320 my ($key, $value);
322 for ( my $i = 0; $i <= $#{$productarrayref}; $i++ )
324 my $oneitem = ${$productarrayref}[$i];
326 my $ismultilingual = $oneitem->{'ismultilingual'};
328 if (!($ismultilingual)) # nothing to do with single language items
330 $oneitem->{'specificlanguage'} = "";
331 push(@itemsinalllanguages, $oneitem);
333 else #all language dependent files
335 for ( my $j = 0; $j <= $#{$languagesarrayref}; $j++ ) # iterating over all languages
337 my $onelanguage = ${$languagesarrayref}[$j];
339 my %oneitemhash = ();
341 foreach $key (keys %{$oneitem})
343 if ( $key =~ /\(\S+\)/ ) # this are the language dependent keys
345 if ( $key =~ /\(\Q$onelanguage\E\)/ )
347 $value = $oneitem->{$key};
348 $oneitemhash{$key} = $value;
351 else
353 $value = $oneitem->{$key};
354 $oneitemhash{$key} = $value;
358 $oneitemhash{'specificlanguage'} = $onelanguage;
360 if ( $oneitemhash{'haslanguagemodule'} )
362 my $langmodulestring = get_languagespecific_module($onelanguage, $oneitemhash{'modules'});
363 $oneitemhash{'modules'} = $langmodulestring;
366 push(@itemsinalllanguages, \%oneitemhash);
371 return \@itemsinalllanguages;
374 ################################################################################
375 # Removing all modules, that have the flag LANGUAGEMODULE, but do not
376 # have the correct language
377 ################################################################################
379 sub remove_not_required_language_modules
381 my ($modulesarrayref, $languagesarrayref) = @_;
383 my @allmodules = ();
385 for ( my $i = 0; $i <= $#{$modulesarrayref}; $i++ )
387 my $module = ${$modulesarrayref}[$i];
388 my $styles = "";
389 if ( $module->{'Styles'} ) { $styles = $module->{'Styles'}; }
391 if ( $styles =~ /\bLANGUAGEMODULE\b/ )
393 if ( ! exists($module->{'Language'}) ) { installer::exiter::exit_program("ERROR: \"$module->{'gid'}\" has flag LANGUAGEMODULE, but does not know its language!", "remove_not_required_language_modules"); }
394 my $modulelanguage = $module->{'Language'};
395 # checking, if language is required
396 my $doinclude = 0;
397 for ( my $j = 0; $j <= $#{$languagesarrayref}; $j++ )
399 my $onelanguage = ${$languagesarrayref}[$j];
400 if ( $onelanguage eq $modulelanguage )
402 $doinclude = 1;
403 last;
407 if ( $doinclude ) { push(@allmodules, $module); }
409 else
411 push(@allmodules, $module);
415 return \@allmodules;
418 ################################################################################
419 # Removing all modules, that have a spellchecker language that is not
420 # required for this product (spellchecker selection).
421 # All required spellchecker languages are stored in
422 # %installer::globals::spellcheckerlanguagehash
423 ################################################################################
425 sub remove_not_required_spellcheckerlanguage_modules
427 my ($modulesarrayref) = @_;
429 my $infoline = "";
430 my @allmodules = ();
432 for ( my $i = 0; $i <= $#{$modulesarrayref}; $i++ )
434 my $module = ${$modulesarrayref}[$i];
435 if ( $module->{'Spellcheckerlanguage'} ) # selecting modules with Spellcheckerlanguage
437 if ( exists($installer::globals::spellcheckerlanguagehash{$module->{'Spellcheckerlanguage'}}) )
439 push(@allmodules, $module);
441 else
443 $infoline = "Spellchecker selection: Removing module $module->{'gid'}\n";
444 push( @installer::globals::logfileinfo, $infoline);
446 # Collecting all files at modules that are removed
448 if ( $module->{'Files'} )
450 if ( $module->{'Files'} =~ /^\s*\((.*?)\)\s*$/ )
452 my $filelist = $1;
454 my $filelisthash = installer::converter::convert_stringlist_into_hash(\$filelist, ",");
455 foreach my $onefile ( keys %{$filelisthash} ) { $installer::globals::spellcheckerfilehash{$onefile} = 1; }
460 else
462 push(@allmodules, $module);
466 return \@allmodules;
469 ################################################################################
470 # Removing all modules, that belong to a module that was removed
471 # in "remove_not_required_spellcheckerlanguage_modules" because of the
472 # spellchecker language. The files belonging to the modules are collected
473 # in %installer::globals::spellcheckerfilehash.
474 ################################################################################
476 sub remove_not_required_spellcheckerlanguage_files
478 my ($filesarrayref) = @_;
480 my @filesarray = ();
481 my $infoline = "";
483 for ( my $i = 0; $i <= $#{$filesarrayref}; $i++ )
485 my $onefile = ${$filesarrayref}[$i];
486 if ( exists($installer::globals::spellcheckerfilehash{$onefile->{'gid'}}) )
488 $infoline = "Spellchecker selection: Removing file $onefile->{'gid'}\n";
489 push( @installer::globals::logfileinfo, $infoline);
490 next;
492 push(@filesarray, $onefile);
495 return \@filesarray;
498 ################################################################################
499 # Looking for directories without correct HostName
500 ################################################################################
502 sub checking_directories_with_corrupt_hostname
504 my ($dirsref, $languagesarrayref) = @_;
506 for ( my $i = 0; $i <= $#{$dirsref}; $i++ )
508 my $onedir = ${$dirsref}[$i];
510 my $hostname = "";
512 if ( $onedir->{'HostName'} ) { $hostname = $onedir->{'HostName'}; }
514 if ( $hostname eq "" )
516 my $langstring = "";
517 for ( my $j = 0; $j <= $#{$languagesarrayref}; $j++ ) { $langstring .= ${$languagesarrayref}[$j] . " "; }
518 installer::exiter::exit_program("ERROR: HostName not defined for $onedir->{'gid'} for specified language. Probably you wanted to create an installation set, in a language not defined in scp2 project. You selected the following language(s): $langstring", "checking_directories_with_corrupt_hostname");
521 if ( $hostname eq "FAILURE" )
523 installer::exiter::exit_program("ERROR: Could not create HostName for $onedir->{'gid'} (missing language at parent). See logfile warning for more info!", "checking_directories_with_corrupt_hostname");
528 ################################################################################
529 # Setting global properties
530 ################################################################################
532 sub set_global_directory_hostnames
534 my ($dirsref, $allvariables) = @_;
536 for ( my $i = 0; $i <= $#{$dirsref}; $i++ )
538 my $onedir = ${$dirsref}[$i];
539 my $styles = "";
540 if ( $onedir->{'Styles'} ) { $styles = $onedir->{'Styles'}; }
542 if ( $styles =~ /\bOFFICEDIRECTORY\b/ )
544 $installer::globals::officedirhostname = $onedir->{'HostName'};
545 $installer::globals::officedirgid = $onedir->{'gid'};
546 $allvariables->{'OFFICEDIRECTORYHOSTNAME'} = $installer::globals::officedirhostname;
548 if ( $styles =~ /\bBASISDIRECTORY\b/ )
550 $installer::globals::basisdirhostname = $onedir->{'HostName'};
551 $installer::globals::basisdirgid = $onedir->{'gid'};
552 $allvariables->{'BASISDIRECTORYHOSTNAME'} = $installer::globals::basisdirhostname;
554 if ( $styles =~ /\bUREDIRECTORY\b/ )
556 $installer::globals::uredirhostname = $onedir->{'HostName'};
557 $installer::globals::uredirgid = $onedir->{'gid'};
558 $allvariables->{'UREDIRECTORYHOSTNAME'} = $installer::globals::uredirhostname;
560 if ( $styles =~ /\bSUNDIRECTORY\b/ )
562 $installer::globals::sundirhostname = $onedir->{'HostName'};
563 $installer::globals::sundirgid = $onedir->{'gid'};
564 $allvariables->{'SUNDIRECTORYHOSTNAME'} = $installer::globals::sundirhostname;
569 ########################################################
570 # Recursively defined procedure to order
571 # modules and directories
572 ########################################################
574 sub get_children
576 my ($allitems, $startparent, $newitemorder) = @_;
578 for ( my $i = 0; $i <= $#{$allitems}; $i++ )
580 my $gid = ${$allitems}[$i]->{'gid'};
581 my $parent = "";
582 if ( ${$allitems}[$i]->{'ParentID'} ) { $parent = ${$allitems}[$i]->{'ParentID'}; }
584 if ( $parent eq $startparent )
586 push(@{$newitemorder}, ${$allitems}[$i]);
587 my $parent = $gid;
588 get_children($allitems, $parent, $newitemorder); # recursive!
593 ################################################################################
594 # Using different HostName for language packs
595 ################################################################################
597 sub use_langpack_hostname
599 my ($dirsref) = @_;
601 for ( my $i = 0; $i <= $#{$dirsref}; $i++ )
603 my $onedir = ${$dirsref}[$i];
604 if (( $onedir->{'LangPackHostName'} ) && ( $onedir->{'LangPackHostName'} ne "" )) { $onedir->{'HostName'} = $onedir->{'LangPackHostName'}; }
608 ################################################################################
609 # Using different HostName for language packs
610 ################################################################################
612 sub use_patch_hostname
614 my ($dirsref) = @_;
616 for ( my $i = 0; $i <= $#{$dirsref}; $i++ )
618 my $onedir = ${$dirsref}[$i];
619 if (( $onedir->{'PatchHostName'} ) && ( $onedir->{'PatchHostName'} ne "" )) { $onedir->{'HostName'} = $onedir->{'PatchHostName'}; }
623 ################################################################################
624 # Using different HostName for language packs
625 ################################################################################
627 sub use_langpack_copy_scpaction
629 my ($scpactionsref) = @_;
631 for ( my $i = 0; $i <= $#{$scpactionsref}; $i++ )
633 my $onescpaction = ${$scpactionsref}[$i];
634 if (( $onescpaction->{'LangPackCopy'} ) && ( $onescpaction->{'LangPackCopy'} ne "" )) { $onescpaction->{'Copy'} = $onescpaction->{'LangPackCopy'}; }
638 ################################################################################
639 # Using different HostName for language packs
640 ################################################################################
642 sub use_patch_copy_scpaction
644 my ($scpactionsref) = @_;
646 for ( my $i = 0; $i <= $#{$scpactionsref}; $i++ )
648 my $onescpaction = ${$scpactionsref}[$i];
649 if (( $onescpaction->{'PatchCopy'} ) && ( $onescpaction->{'PatchCopy'} ne "" )) { $onescpaction->{'Copy'} = $onescpaction->{'PatchCopy'}; }
653 ################################################################################
654 # Shifting parent directories of URE and Basis layer, so that
655 # these directories are located below the Brand layer.
656 # Style: SHIFT_BASIS_INTO_BRAND_LAYER
657 ################################################################################
659 sub shift_basis_directory_parents
661 my ($dirsref) = @_;
663 my @alldirs = ();
664 my @savedirs = ();
665 my @shifteddirs = ();
667 my $officedirgid = "";
669 for ( my $i = 0; $i <= $#{$dirsref}; $i++ )
671 my $onedir = ${$dirsref}[$i];
672 my $styles = "";
673 if ( $onedir->{'Styles'} ) { $styles = $onedir->{'Styles'}; }
675 if ( $styles =~ /\bOFFICEDIRECTORY\b/ ) { $officedirgid = $onedir->{'gid'}; }
678 if ( $officedirgid ne "" )
680 for ( my $i = 0; $i <= $#{$dirsref}; $i++ )
682 my $onedir = ${$dirsref}[$i];
683 my $styles = "";
684 if ( $onedir->{'Styles'} ) { $styles = $onedir->{'Styles'}; }
686 if (( $styles =~ /\bBASISDIRECTORY\b/ ) || ( $styles =~ /\bUREDIRECTORY\b/ ))
688 $onedir->{'ParentID'} = $officedirgid;
692 # Sorting directories
693 my $startgid = "PREDEFINED_PROGDIR";
694 get_children($dirsref, $startgid, \@alldirs);
697 return \@alldirs;
700 ################################################################################
701 # Setting the name of the directory with style OFFICEDIRECTORY.
702 # The name can be defined in property OFFICEDIRECTORYNAME.
703 ################################################################################
705 sub set_officedirectory_name
707 my ($dirsref, $officedirname) = @_;
709 for ( my $i = 0; $i <= $#{$dirsref}; $i++ )
711 my $onedir = ${$dirsref}[$i];
712 my $styles = "";
713 if ( $onedir->{'Styles'} ) { $styles = $onedir->{'Styles'}; }
714 if ( $styles =~ /\bOFFICEDIRECTORY\b/ )
716 $onedir->{'HostName'} = $officedirname;
717 last;
722 ################################################################################
723 # Simplifying the name for language dependent items from "Name (xy)" to "Name"
724 ################################################################################
726 sub changing_name_of_language_dependent_keys
728 my ($itemsarrayref) = @_;
730 if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::changing_name_of_language_dependent_keys : $#{$itemsarrayref}"); }
732 # Changing key for multilingual items from "Name ( )" to "Name" or "HostName ( )" to "HostName"
734 for ( my $i = 0; $i <= $#{$itemsarrayref}; $i++ )
736 my $oneitem = ${$itemsarrayref}[$i];
737 my $onelanguage = $oneitem->{'specificlanguage'};
739 if (!($onelanguage eq "" )) # language dependent item
741 my $itemkey;
743 foreach $itemkey (keys %{$oneitem})
745 if ( $itemkey =~ /^\s*(\S+?)\s+\(\S+\)\s*$/ )
747 my $newitemkey = $1;
748 my $itemvalue = $oneitem->{$itemkey};
749 $oneitem->{$newitemkey} = $itemvalue;
750 delete($oneitem->{$itemkey});
757 ################################################################################
758 # Collecting language specific names for language packs
759 ################################################################################
761 sub collect_language_specific_names
763 my ($itemsarrayref) = @_;
765 for ( my $i = 0; $i <= $#{$itemsarrayref}; $i++ )
767 my $oneitem = ${$itemsarrayref}[$i];
768 my $styles = "";
769 if ( $oneitem->{'Styles'} ) { $styles = $oneitem->{'Styles'}; }
771 if ( $styles =~ /\bUSELANGUAGENAME\b/ )
773 my $language = "";
774 if ( $oneitem->{'Language'} ) { $language = $oneitem->{'Language'}; }
775 my $specificlanguage = "";
776 if ( $oneitem->{'specificlanguage'} ) { $specificlanguage = $oneitem->{'specificlanguage'}; }
778 if (( $language ne "" ) && ( $language eq $specificlanguage ))
780 if (! installer::existence::exists_in_array($oneitem->{'Name'}, \@installer::globals::languagenames ))
782 push(@installer::globals::languagenames, $oneitem->{'Name'});
789 ################################################################################
790 # Replacement of setup variables in ConfigurationItems and ProfileItems
791 # <productkey>, <buildid>, <sequence_languages>, <productcode>, <upgradecode>, <productupdate>
792 ################################################################################
794 sub replace_setup_variables
796 my ($itemsarrayref, $languagestringref, $hashref) = @_;
798 if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::replace_setup_variables : $#{$itemsarrayref} : $$languagestringref : $hashref->{'PRODUCTNAME'}"); }
800 my $languagesstring = $$languagestringref;
801 $languagesstring =~ s/\_/ /g; # replacing underscore with whitespace
802 # $languagesstring is "01 49" instead of "en-US de"
803 installer::languages::fake_languagesstring(\$languagesstring);
805 my $productname = $hashref->{'PRODUCTNAME'};
806 my $productversion = $hashref->{'PRODUCTVERSION'};
807 my $userdirproductversion = "";
808 if ( $hashref->{'USERDIRPRODUCTVERSION'} ) { $userdirproductversion = $hashref->{'USERDIRPRODUCTVERSION'}; }
809 my $productkey = $productname . " " . $productversion;
811 # string $buildid, which is used to replace the setup variable <buildid>
813 my $localminor = "flat";
814 if ( $installer::globals::minor ne "" ) { $localminor = $installer::globals::minor; }
815 else { $localminor = $installer::globals::lastminor; }
817 my $localbuild = $installer::globals::build;
819 if ( $localbuild =~ /^\s*(\w+?)(\d+)\s*$/ ) { $localbuild = $2; } # using "680" instead of "src680"
821 my $buildidstring = $localbuild . $localminor . "(Build:" . $installer::globals::buildid . ")";
823 # the environment variable CWS_WORK_STAMP is set only in CWS
824 if ( $ENV{'CWS_WORK_STAMP'} ) { $buildidstring = $buildidstring . "\[CWS\:" . $ENV{'CWS_WORK_STAMP'} . "\]"; }
826 if ( $localminor =~ /^\s*\w(\d+)\w*\s*$/ ) { $localminor = $1; }
828 # $updateid
829 my $updateid = $productname . "_" . $userdirproductversion . "_" . $$languagestringref;
830 $updateid =~ s/ /_/g;
832 for ( my $i = 0; $i <= $#{$itemsarrayref}; $i++ )
834 my $oneitem = ${$itemsarrayref}[$i];
835 my $value = $oneitem->{'Value'};
837 $value =~ s/\<buildid\>/$buildidstring/;
838 $value =~ s/\<sequence_languages\>/$languagesstring/;
839 $value =~ s/\<productkey\>/$productkey/;
840 $value =~ s/\<productcode\>/$installer::globals::productcode/;
841 $value =~ s/\<upgradecode\>/$installer::globals::upgradecode/;
842 $value =~ s/\<alllanguages\>/$languagesstring/;
843 $value =~ s/\<productmajor\>/$localbuild/;
844 $value =~ s/\<productminor\>/$localminor/;
845 $value =~ s/\<productbuildid\>/$installer::globals::buildid/;
846 $value =~ s/\<sourceid\>/$installer::globals::build/;
847 $value =~ s/\<updateid\>/$updateid/;
848 $value =~ s/\<pkgformat\>/$installer::globals::packageformat/;
849 $value =~ s/\<vendor\>/$ENV{'OOO_VENDOR'}/;
850 $value =~ s/\<buildversion\>/$ENV{'BUILD_VER_STRING'}/;
852 $oneitem->{'Value'} = $value;
856 ################################################################################
857 # By defining variable LOCALUSERDIR in *.lst it is possible to change
858 # the standard destination of user directory defined in scp2 ($SYSUSERCONFIG).
859 ################################################################################
861 sub replace_userdir_variable
863 my ($itemsarrayref) = @_;
865 my $userdir = "";
866 if ( $allvariableshashref->{'LOCALUSERDIR'} ) { $userdir = $allvariableshashref->{'LOCALUSERDIR'}; }
867 else { $userdir = $installer::globals::simpledefaultuserdir; }
869 if ( $userdir ne "" )
871 for ( my $i = 0; $i <= $#{$itemsarrayref}; $i++ )
873 my $oneitem = ${$itemsarrayref}[$i];
874 $oneitem->{'Value'} =~ s/\$SYSUSERCONFIG/$userdir/;
879 #####################################################################################
880 # Files and ConfigurationItems are not included for all languages.
881 # For instance asian fonts. These can be removed, if no "Name" is found.
882 # ConfigurationItems are not always defined in the linguistic configuration file.
883 # The "Key" cannot be found for them.
884 #####################################################################################
886 sub remove_non_existent_languages_in_productlists
888 my ($itemsarrayref, $languagestringref, $searchkey, $itemtype) = @_;
890 if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::remove_non_existent_languages_in_productlists : $#{$itemsarrayref} : $$languagestringref : $searchkey : $itemtype"); }
892 # Removing of all non existent files, for instance asian fonts
894 installer::logger::include_header_into_logfile("Removing for this language $$languagestringref:");
896 my @allexistentitems = ();
898 my $infoline;
900 for ( my $i = 0; $i <= $#{$itemsarrayref}; $i++ )
902 my $oneitem = ${$itemsarrayref}[$i];
903 my $oneitemname = ""; # $searchkey is "Name" for files and "Key" for ConfigurationItems
905 if ( $oneitem->{$searchkey} ) { $oneitemname = $oneitem->{$searchkey} }
907 my $itemtoberemoved = 0;
909 if ($oneitemname eq "") # for instance asian font in english installation set
911 $itemtoberemoved = 1;
914 if ($itemtoberemoved)
916 $infoline = "WARNING: Language $$languagestringref: No $itemtype packed for $oneitem->{'gid'}!\n";
917 push( @installer::globals::logfileinfo, $infoline);
919 else
921 push(@allexistentitems, $oneitem);
925 $infoline = "\n";
926 push( @installer::globals::logfileinfo, $infoline);
928 return \@allexistentitems;
931 ########################################################################
932 # Input is the directory gid, output the "HostName" of the directory
933 ########################################################################
935 sub get_Directoryname_From_Directorygid
937 my ($dirsarrayref ,$searchgid, $onelanguage, $oneitemgid) = @_;
939 if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::get_Directoryname_From_Directorygid : $#{$dirsarrayref} : $searchgid : $onelanguage"); }
941 my $directoryname = "";
942 my $onedirectory;
943 my $foundgid = 0;
945 for ( my $i = 0; $i <= $#{$dirsarrayref}; $i++ )
947 $onedirectory = ${$dirsarrayref}[$i];
948 my $directorygid = $onedirectory->{'gid'};
950 if ($directorygid eq $searchgid)
952 $foundgid = 1;
953 last;
957 if (!($foundgid))
959 installer::exiter::exit_program("ERROR: Gid $searchgid not defined in $installer::globals::setupscriptname", "get_Directoryname_From_Directorygid");
962 if ( ! ( $onedirectory->{'ismultilingual'} )) # the directory is not language dependent
964 $directoryname = $onedirectory->{'HostName'};
966 else
968 $directoryname = $onedirectory->{"HostName ($onelanguage)"};
971 # gid_Dir_Template_Wizard_Letter is defined as language dependent directory, but the file gid_Dir_Template_Wizard_Letter
972 # is not language dependent. Therefore $onelanguage is not defined. But which language is the correct language for the
973 # directory?
974 # Perhaps better solution: In scp it must be forbidden to have a language independent file in a language dependent directory.
976 if (( ! $directoryname ) && ( $onelanguage eq "" ))
978 installer::exiter::exit_program("ERROR (in scp): Directory $searchgid is language dependent, but not $oneitemgid inside this directory", "get_Directoryname_From_Directorygid");
981 return \$directoryname;
984 ##################################################################
985 # Getting destination direcotory for links, files and profiles
986 ##################################################################
988 sub get_Destination_Directory_For_Item_From_Directorylist # this is used for Files, Profiles and Links
990 my ($itemarrayref, $dirsarrayref) = @_;
992 if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::get_Destination_Directory_For_Item_From_Directorylist : $#{$itemarrayref} : $#{$dirsarrayref}"); }
994 for ( my $i = 0; $i <= $#{$itemarrayref}; $i++ )
996 my $oneitem = ${$itemarrayref}[$i];
997 my $oneitemgid = $oneitem->{'gid'};
998 my $directorygid = $oneitem->{'Dir'}; # for instance gid_Dir_Program
999 my $netdirectorygid = "";
1000 my $onelanguage = $oneitem->{'specificlanguage'};
1001 my $ispredefinedprogdir = 0;
1002 my $ispredefinedconfigdir = 0;
1004 my $oneitemname = $oneitem->{'Name'};
1006 if ( $oneitem->{'NetDir'} ) { $netdirectorygid = $oneitem->{'NetDir'}; }
1008 installer::pathanalyzer::make_absolute_filename_to_relative_filename(\$oneitemname); # making /registry/schema/org/openoffice/VCL.xcs to VCL.xcs
1010 my $searchdirgid;
1012 if ( $netdirectorygid eq "" ) # if NetDir is defined, it is privileged
1014 $searchdirgid = $directorygid
1016 else
1018 $searchdirgid = $netdirectorygid
1021 if ($searchdirgid =~ /PREDEFINED_PROGDIR/) # the root directory is not defined in setup script
1023 $ispredefinedprogdir = 1;
1026 if ($searchdirgid =~ /PREDEFINED_CONFIGDIR/) # the root directory is not defined in setup script
1028 $ispredefinedconfigdir = 1;
1031 my $destfilename;
1033 if ((!( $ispredefinedprogdir )) && (!( $ispredefinedconfigdir )))
1035 my $directorynameref = get_Directoryname_From_Directorygid($dirsarrayref, $searchdirgid, $onelanguage, $oneitemgid);
1036 $destfilename = $$directorynameref . $installer::globals::separator . $oneitemname;
1038 else
1040 $destfilename = $oneitemname;
1043 $oneitem->{'destination'} = $destfilename;
1047 ##########################################################################
1048 # Searching a file in a list of pathes
1049 ##########################################################################
1051 sub get_sourcepath_from_filename_and_includepath_classic
1053 my ($searchfilenameref, $includepatharrayref, $write_logfile) = @_;
1055 if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::get_sourcepath_from_filename_and_includepath_classic : $$searchfilenameref : $#{$includepatharrayref} : $write_logfile"); }
1057 my ($onefile, $includepath, $infoline);
1059 my $foundsourcefile = 0;
1061 for ( my $j = 0; $j <= $#{$includepatharrayref}; $j++ )
1063 $includepath = ${$includepatharrayref}[$j];
1064 installer::remover::remove_leading_and_ending_whitespaces(\$includepath);
1066 $onefile = $includepath . $installer::globals::separator . $$searchfilenameref;
1068 if ( -f $onefile )
1070 $foundsourcefile = 1;
1071 last;
1075 if (!($foundsourcefile))
1077 $onefile = ""; # the sourcepath has to be empty
1078 if ( $write_logfile)
1080 if ( $ENV{'DEFAULT_TO_ENGLISH_FOR_PACKING'} )
1082 $infoline = "WARNING: Source for $$searchfilenameref not found!\n"; # Important message in log file
1084 else
1086 $infoline = "ERROR: Source for $$searchfilenameref not found!\n"; # Important message in log file
1089 push( @installer::globals::logfileinfo, $infoline);
1092 else
1094 if ( $write_logfile)
1096 $infoline = "SUCCESS: Source for $$searchfilenameref: $onefile\n";
1097 push( @installer::globals::logfileinfo, $infoline);
1101 return \$onefile;
1104 ##########################################################################
1105 # Input is one file name, output the complete absolute path of this file
1106 ##########################################################################
1108 sub get_sourcepath_from_filename_and_includepath
1110 my ($searchfilenameref, $unused, $write_logfile) = @_;
1112 if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::get_sourcepath_from_filename_and_includepath : $$searchfilenameref : $#{$includepatharrayref} : $write_logfile"); }
1114 my ($onefile, $includepath, $infoline);
1116 my $foundsourcefile = 0;
1117 my $foundnewname = 0;
1119 for ( my $j = 0; $j <= $#installer::globals::allincludepathes; $j++ )
1121 my $allfiles = $installer::globals::allincludepathes[$j];
1123 if ( exists( $allfiles->{$$searchfilenameref} ))
1125 $onefile = $allfiles->{'includepath'} . $installer::globals::separator . $$searchfilenameref;
1126 $foundsourcefile = 1;
1127 last;
1131 if (!($foundsourcefile)) # testing with lowercase filename
1133 # Attention: README01.html is copied for Windows to readme01.html, not case sensitive
1135 for ( my $j = 0; $j <= $#installer::globals::allincludepathes; $j++ )
1137 my $allfiles = $installer::globals::allincludepathes[$j];
1139 my $newfilename = $$searchfilenameref;
1140 $newfilename =~ s/readme/README/; # special handling for readme files
1141 $newfilename =~ s/license/LICENSE/; # special handling for license files
1143 if ( exists( $allfiles->{$newfilename} ))
1145 $onefile = $allfiles->{'includepath'} . $installer::globals::separator . $newfilename;
1146 $foundsourcefile = 1;
1147 $foundnewname = 1;
1148 last;
1153 if (!($foundsourcefile))
1155 $onefile = ""; # the sourcepath has to be empty
1156 if ( $write_logfile)
1158 if ( $ENV{'DEFAULT_TO_ENGLISH_FOR_PACKING'} )
1160 $infoline = "WARNING: Source for $$searchfilenameref not found!\n"; # Important message in log file
1162 else
1164 $infoline = "ERROR: Source for $$searchfilenameref not found!\n"; # Important message in log file
1167 push( @installer::globals::logfileinfo, $infoline);
1170 else
1172 if ( $write_logfile)
1174 if (!($foundnewname))
1176 $infoline = "SUCCESS: Source for $$searchfilenameref: $onefile\n";
1178 else
1180 $infoline = "SUCCESS/WARNING: Special handling for $$searchfilenameref: $onefile\n";
1182 push( @installer::globals::logfileinfo, $infoline);
1186 return \$onefile;
1189 ##############################################################
1190 # Determining, whether a specified directory is language
1191 # dependent
1192 ##############################################################
1194 sub determine_directory_language_dependency
1196 my($directorygid, $dirsref) = @_;
1198 my $is_multilingual = 0;
1200 for ( my $i = 0; $i <= $#{$dirsref}; $i++ )
1202 my $onedir = ${$dirsref}[$i];
1203 my $gid = $onedir->{'gid'};
1205 if ( $gid eq $directorygid )
1207 $is_multilingual = $onedir->{'ismultilingual'};
1208 last;
1212 return $is_multilingual;
1215 ##############################################################
1216 # Getting all source pathes for all files to be packed
1217 # $item can be "Files" or "ScpActions"
1218 ##############################################################
1220 sub get_Source_Directory_For_Files_From_Includepathlist
1222 my ($filesarrayref, $includepatharrayref, $dirsref, $item) = @_;
1224 if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::get_Source_Directory_For_Files_From_Includepathlist : $#{$filesarrayref} : $#{$includepatharrayref} : $item"); }
1226 installer::logger::include_header_into_logfile("$item:");
1228 my $infoline = "";
1230 for ( my $i = 0; $i <= $#{$filesarrayref}; $i++ )
1232 my $onefile = ${$filesarrayref}[$i];
1233 my $onelanguage = $onefile->{'specificlanguage'};
1235 if ( ! $onefile->{'Name'} ) { installer::exiter::exit_program("ERROR: $item without name ! GID: $onefile->{'gid'} ! Language: $onelanguage", "get_Source_Directory_For_Files_From_Includepathlist"); }
1237 my $onefilename = $onefile->{'Name'};
1238 if ( $item eq "ScpActions" ) { $onefilename =~ s/\//$installer::globals::separator/g; }
1239 $onefilename =~ s/^\s*\Q$installer::globals::separator\E//; # filename begins with a slash, for instance /registry/schema/org/openoffice/VCL.xcs
1241 my $styles = "";
1242 my $file_can_miss = 0;
1243 if ( $onefile->{'Styles'} ) { $styles = $onefile->{'Styles'}; }
1244 if (( $styles =~ /\bSTARREGISTRY\b/ ) || ( $styles =~ /\bFILE_CAN_MISS\b/ )) { $file_can_miss = 1; }
1246 if (( $installer::globals::languagepack ) && ( ! $onefile->{'ismultilingual'} ) && ( ! ( $styles =~ /\bFORCELANGUAGEPACK\b/ ))) { $file_can_miss = 1; }
1248 my $sourcepathref = "";
1250 if ( $file_can_miss ) { $sourcepathref = get_sourcepath_from_filename_and_includepath(\$onefilename, $includepatharrayref, 0); }
1251 else { $sourcepathref = get_sourcepath_from_filename_and_includepath(\$onefilename, $includepatharrayref, 1); }
1253 $onefile->{'sourcepath'} = $$sourcepathref; # This $$sourcepathref is empty, if no source was found
1255 # defaulting to english for multilingual files if DEFAULT_TO_ENGLISH_FOR_PACKING is set
1257 if ( $ENV{'DEFAULT_TO_ENGLISH_FOR_PACKING'} )
1259 if (( ! $onefile->{'sourcepath'} ) && ( $onefile->{'ismultilingual'} ))
1261 my $oldname = $onefile->{'Name'};
1262 my $oldlanguage = $onefile->{'specificlanguage'};
1263 my $newlanguage = "en-US";
1264 # $onefile->{'Name'} =~ s/$oldlanguage\./$newlanguage\./; # Example: tplwizfax_it.zip -> tplwizfax_en-US.zip
1265 $onefilename = $onefile->{'Name'};
1266 $onefilename =~ s/$oldlanguage\./$newlanguage\./; # Example: tplwizfax_it.zip -> tplwizfax_en-US.zip
1267 $onefilename =~ s/^\s*\Q$installer::globals::separator\E//; # filename begins with a slash, for instance /registry/schema/org/openoffice/VCL.xcs
1268 $sourcepathref = get_sourcepath_from_filename_and_includepath(\$onefilename, $includepatharrayref, 1);
1269 $onefile->{'sourcepath'} = $$sourcepathref; # This $$sourcepathref is empty, if no source was found
1271 if ($onefile->{'sourcepath'}) # defaulting to english was successful
1273 $infoline = "WARNING: Using $onefilename instead of $oldname\n";
1274 push( @installer::globals::logfileinfo, $infoline);
1275 print " $infoline";
1276 # if ( $onefile->{'destination'} ) { $onefile->{'destination'} =~ s/\Q$oldname\E/$onefile->{'Name'}/; }
1278 # If the directory, in which the new file is installed, is not language dependent,
1279 # the filename has to be changed to avoid installation conflicts
1280 # No mechanism for resource files!
1281 # -> implementing for the content of ARCHIVE files
1283 if ( $onefile->{'Styles'} =~ /\bARCHIVE\b/ )
1285 my $directorygid = $onefile->{'Dir'};
1286 my $islanguagedependent = determine_directory_language_dependency($directorygid, $dirsref);
1288 if ( ! $islanguagedependent )
1290 $onefile->{'Styles'} =~ s/\bARCHIVE\b/ARCHIVE, RENAME_TO_LANGUAGE/; # Setting new flag RENAME_TO_LANGUAGE
1291 $infoline = "Setting flag RENAME_TO_LANGUAGE: File $onefile->{'Name'} in directory: $directorygid\n";
1292 push( @installer::globals::logfileinfo, $infoline);
1296 else
1298 $infoline = "WARNING: Using $onefile->{'Name'} instead of $oldname was not successful\n";
1299 push( @installer::globals::logfileinfo, $infoline);
1300 $onefile->{'Name'} = $oldname; # Switching back to old file name
1306 $infoline = "\n"; # empty line after listing of all files
1307 push( @installer::globals::logfileinfo, $infoline);
1310 #################################################################################
1311 # Removing files, that shall not be included into languagepacks
1312 # (because of rpm conflicts)
1313 #################################################################################
1315 sub remove_Files_For_Languagepacks
1317 my ($itemsarrayref) = @_;
1319 if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::remove_Files_For_Languagepacks : $#{$filesarrayref}"); }
1321 my $infoline;
1323 my @newitemsarray = ();
1325 for ( my $i = 0; $i <= $#{$itemsarrayref}; $i++ )
1327 my $oneitem = ${$itemsarrayref}[$i];
1328 my $gid = $oneitem->{'gid'};
1330 # scp Todo: Remove asap after removal of old setup
1332 if (( $gid eq "gid_File_Extra_Fontunxpsprint" ) ||
1333 ( $gid eq "gid_File_Extra_Migration_Lang" ))
1335 $infoline = "ATTENTION: Removing item $oneitem->{'gid'} from the installation set.\n";
1336 push( @installer::globals::logfileinfo, $infoline);
1338 next;
1341 push(@newitemsarray, $oneitem);
1344 return \@newitemsarray;
1347 #################################################################################
1348 # Files, whose source directory is not found, are removed now (this is an ERROR)
1349 #################################################################################
1351 sub remove_Files_Without_Sourcedirectory
1353 my ($filesarrayref) = @_;
1355 if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::remove_Files_Without_Sourcedirectory : $#{$filesarrayref}"); }
1357 my $infoline;
1359 my $error_occured = 0;
1360 my @missingfiles = ();
1361 push(@missingfiles, "ERROR: The following files could not be found: \n");
1363 my @newfilesarray = ();
1365 for ( my $i = 0; $i <= $#{$filesarrayref}; $i++ )
1367 my $onefile = ${$filesarrayref}[$i];
1368 my $sourcepath = $onefile->{'sourcepath'};
1370 if ($sourcepath eq "")
1372 my $styles = $onefile->{'Styles'};
1374 if ( ! ( $styles =~ /\bSTARREGISTRY\b/ )) # StarRegistry files will be created later
1376 my $filename = $onefile->{'Name'};
1378 if ( ! $installer::globals::languagepack )
1380 $infoline = "ERROR: Removing file $filename from file list.\n";
1381 push( @installer::globals::logfileinfo, $infoline);
1383 push(@missingfiles, "ERROR: File not found: $filename\n");
1384 $error_occured = 1;
1386 next; # removing this file from list, if sourcepath is empty
1388 else # special case for language packs
1390 if (( $onefile->{'ismultilingual'} ) || ( $styles =~ /\bFORCELANGUAGEPACK\b/ ))
1392 $infoline = "ERROR: Removing file $filename from file list.\n";
1393 push( @installer::globals::logfileinfo, $infoline);
1395 push(@missingfiles, "ERROR: File not found: $filename\n");
1396 $error_occured = 1;
1398 next; # removing this file from list, if sourcepath is empty
1400 else
1402 $infoline = "INFO: Removing file $filename from file list. It is not language dependent.\n";
1403 push( @installer::globals::logfileinfo, $infoline);
1404 $infoline = "INFO: It is not language dependent and can be ignored in language packs.\n";
1405 push( @installer::globals::logfileinfo, $infoline);
1407 next; # removing this file from list, if sourcepath is empty
1413 push(@newfilesarray, $onefile);
1416 $infoline = "\n";
1417 push( @installer::globals::logfileinfo, $infoline);
1419 if ( $error_occured )
1421 for ( my $i = 0; $i <= $#missingfiles; $i++ ) { print "$missingfiles[$i]"; }
1422 installer::exiter::exit_program("ERROR: Missing files", "remove_Files_Without_Sourcedirectory");
1425 return \@newfilesarray;
1428 ############################################################################
1429 # License and Readme files in the default language have to be installed
1430 # in the directory with flag OFFICEDIRECTORY. If this is not defined
1431 # they have to be installed in the installation root.
1432 ############################################################################
1434 sub get_office_directory_gid_and_hostname
1436 my ($dirsarrayref) = @_;
1438 my $foundofficedir = 0;
1439 my $gid = "";
1440 my $hostname = "";
1442 for ( my $i = 0; $i <= $#{$dirsarrayref}; $i++ )
1444 my $onedir = ${$dirsarrayref}[$i];
1445 if ( $onedir->{'Styles'} )
1447 my $styles = $onedir->{'Styles'};
1449 if ( $styles =~ /\bOFFICEDIRECTORY\b/ )
1451 $foundofficedir = 1;
1452 $gid = $onedir->{'gid'};
1453 $hostname = $onedir->{'HostName'};
1454 last;
1459 return ($foundofficedir, $gid, $hostname);
1462 ############################################################################
1463 # License and Readme files in the default language have to be installed
1464 # in the installation root (next to the program dir). This is in scp
1465 # project done by a post install basic script
1466 ############################################################################
1468 sub add_License_Files_into_Installdir
1470 my ($filesarrayref, $dirsarrayref, $languagesarrayref) = @_;
1472 if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::add_License_Files_into_Installdir : $#{$filesarrayref} : $#{$languagesarrayref}"); }
1474 my $infoline;
1476 my @newfilesarray = ();
1478 my $defaultlanguage = installer::languages::get_default_language($languagesarrayref);
1480 my ($foundofficedir, $officedirectorygid, $officedirectoryhostname) = get_office_directory_gid_and_hostname($dirsarrayref);
1482 # copy all files from directory share/readme, that contain the default language in their name
1483 # without default language into the installation root. This makes the settings of the correct
1484 # file names superfluous. On the other hand this requires a dependency to the directory
1485 # share/readme
1487 for ( my $i = 0; $i <= $#{$filesarrayref}; $i++ )
1489 my $onefile = ${$filesarrayref}[$i];
1490 my $destination = $onefile->{'destination'};
1491 my $styles = "";
1492 if ( $onefile->{'Styles'} ) { $styles = $onefile->{'Styles'}; }
1494 if ( ( $destination =~ /share\Q$installer::globals::separator\Ereadme\Q$installer::globals::separator\E(\w+?)_?$defaultlanguage\.?(\w*)\s*/ )
1495 || (( $styles =~ /\bROOTLICENSEFILE\b/ ) && ( $destination =~ /\Q$installer::globals::separator\E?(\w+?)_?$defaultlanguage\.?(\w*?)\s*$/ )) )
1497 my $filename = $1;
1498 my $extension = $2;
1500 my $newfilename;
1502 if ( $extension eq "" ) { $newfilename = $filename; }
1503 else { $newfilename = $filename . "\." . $extension; }
1505 my %newfile = ();
1506 my $newfile = \%newfile;
1508 installer::converter::copy_item_object($onefile, $newfile);
1510 $newfile->{'gid'} = $onefile->{'gid'} . "_Copy";
1511 $newfile->{'Name'} = $newfilename;
1512 $newfile->{'ismultilingual'} = "0";
1513 $newfile->{'specificlanguage'} = "";
1514 $newfile->{'haslanguagemodule'} = "0";
1516 if ( $foundofficedir )
1518 $newfile->{'Dir'} = $officedirectorygid;
1519 $newfile->{'destination'} = $officedirectoryhostname . $installer::globals::separator . $newfilename;
1521 else
1523 $newfile->{'Dir'} = "PREDEFINED_PROGDIR";
1524 $newfile->{'destination'} = $newfilename;
1527 # Also setting "modules=gid_Module_Root_Brand" (module with style: ROOT_BRAND_PACKAGE)
1528 if ( $installer::globals::rootbrandpackageset )
1530 $newfile->{'modules'} = $installer::globals::rootbrandpackage;
1533 push(@newfilesarray, $newfile);
1535 $infoline = "New files: Adding file $newfilename for the installation root to the file list. Language: $defaultlanguage\n";
1536 push( @installer::globals::logfileinfo, $infoline);
1538 # Collecting license and readme file for the installation set
1540 push(@installer::globals::installsetfiles, $newfile);
1541 $infoline = "New files: Adding file $newfilename to the file collector for the installation set. Language: $defaultlanguage\n";
1542 push( @installer::globals::logfileinfo, $infoline);
1545 push(@newfilesarray, $onefile);
1548 return \@newfilesarray;
1551 ############################################################################
1552 # Removing files with flag ONLY_ASIA_LANGUAGE, only if no asian
1553 # language is part of the product.
1554 # This special files are connected to the root module and are not
1555 # included into a language pack (would lead to conflicts!).
1556 # But this files shall only be included into the product, if the
1557 # product contains at least one asian language.
1558 ############################################################################
1560 sub remove_onlyasialanguage_files_from_productlists
1562 my ($filesarrayref) = @_;
1564 my $infoline;
1566 my @newfilesarray = ();
1567 my $returnfilesarrayref;
1569 my $containsasianlanguage = installer::languages::detect_asian_language($installer::globals::alllanguagesinproductarrayref);
1571 my $alllangstring = installer::converter::convert_array_to_comma_separated_string($installer::globals::alllanguagesinproductarrayref);
1572 $infoline = "\nLanguages in complete product: $alllangstring\n";
1573 push( @installer::globals::logfileinfo, $infoline);
1575 if ( ! $containsasianlanguage )
1577 $infoline = "Product does not contain asian language -> removing files\n";
1578 push( @installer::globals::logfileinfo, $infoline);
1580 for ( my $i = 0; $i <= $#{$filesarrayref}; $i++ )
1582 my $onefile = ${$filesarrayref}[$i];
1583 my $styles = "";
1584 if ( $onefile->{'Styles'} ) { $styles = $onefile->{'Styles'}; }
1585 if ( $styles =~ /\bONLY_ASIA_LANGUAGE\b/ )
1587 $infoline = "Flag ONLY_ASIA_LANGUAGE: Removing file $onefile->{'Name'} from files collector!\n";
1588 push( @installer::globals::logfileinfo, $infoline);
1589 next;
1592 push(@newfilesarray, $onefile);
1595 $returnfilesarrayref = \@newfilesarray;
1597 else
1599 $returnfilesarrayref = $filesarrayref;
1601 $infoline = "Product contains asian language -> Nothing to do\n";
1602 push( @installer::globals::logfileinfo, $infoline);
1606 return $returnfilesarrayref;
1609 ############################################################################
1610 # Removing files with flag ONLY_WESTERN_LANGUAGE, only if no western
1611 # language is part of the product.
1612 # This special files are connected to the root module and are not
1613 # included into a language pack (would lead to conflicts!).
1614 # But this files shall only be included into the product, if the
1615 # product contains at least one western language.
1616 ############################################################################
1618 sub remove_onlywesternlanguage_files_from_productlists
1620 my ($filesarrayref) = @_;
1622 my $infoline;
1624 my @newfilesarray = ();
1625 my $returnfilesarrayref;
1627 my $containswesternlanguage = installer::languages::detect_western_language($installer::globals::alllanguagesinproductarrayref);
1629 my $alllangstring = installer::converter::convert_array_to_comma_separated_string($installer::globals::alllanguagesinproductarrayref);
1630 $infoline = "\nLanguages in complete product: $alllangstring\n";
1631 push( @installer::globals::logfileinfo, $infoline);
1633 if ( ! $containswesternlanguage )
1635 $infoline = "Product does not contain western language -> removing files\n";
1636 push( @installer::globals::logfileinfo, $infoline);
1638 for ( my $i = 0; $i <= $#{$filesarrayref}; $i++ )
1640 my $onefile = ${$filesarrayref}[$i];
1641 my $styles = "";
1642 if ( $onefile->{'Styles'} ) { $styles = $onefile->{'Styles'}; }
1643 if ( $styles =~ /\bONLY_WESTERN_LANGUAGE\b/ )
1645 $infoline = "Flag ONLY_WESTERN_LANGUAGE: Removing file $onefile->{'Name'} from files collector!\n";
1646 push( @installer::globals::logfileinfo, $infoline);
1647 next;
1650 push(@newfilesarray, $onefile);
1653 $returnfilesarrayref = \@newfilesarray;
1655 else
1657 $returnfilesarrayref = $filesarrayref;
1659 $infoline = "Product contains western language -> Nothing to do\n";
1660 push( @installer::globals::logfileinfo, $infoline);
1664 return $returnfilesarrayref;
1667 ############################################################################
1668 # Some files are included for more than one language and have the same
1669 # name and the same destination directory for all languages. This would
1670 # lead to conflicts, if the filenames are not changed.
1671 # In scp project this files must have the flag MAKE_LANG_SPECIFIC
1672 # For this files, the language is included into the filename.
1673 ############################################################################
1675 sub make_filename_language_specific
1677 my ($filesarrayref) = @_;
1679 my $infoline = "";
1681 for ( my $i = 0; $i <= $#{$filesarrayref}; $i++ )
1683 my $onefile = ${$filesarrayref}[$i];
1685 if ( $onefile->{'ismultilingual'} )
1687 my $styles = "";
1688 if ( $onefile->{'Styles'} ) { $styles = $onefile->{'Styles'}; }
1689 if ( $styles =~ /\bMAKE_LANG_SPECIFIC\b/ )
1691 my $language = $onefile->{'specificlanguage'};
1692 my $olddestination = $onefile->{'destination'};
1693 my $oldname = $onefile->{'Name'};
1695 # Including the language into the file name.
1696 # But be sure, to include the language before the file extension.
1698 my $fileextension = "";
1700 if ( $onefile->{'Name'} =~ /(\.\w+?)\s*$/ ) { $fileextension = $1; }
1701 if ( $fileextension ne "" )
1703 $onefile->{'Name'} =~ s/\Q$fileextension\E\s*$/_$language$fileextension/;
1704 $onefile->{'destination'} =~ s/\Q$fileextension\E\s*$/_$language$fileextension/;
1707 $infoline = "Flag MAKE_LANG_SPECIFIC:\n";
1708 push( @installer::globals::logfileinfo, $infoline);
1709 $infoline = "Changing name from $oldname to $onefile->{'Name'} !\n";
1710 push( @installer::globals::logfileinfo, $infoline);
1711 $infoline = "Changing destination from $olddestination to $onefile->{'destination'} !\n";
1712 push( @installer::globals::logfileinfo, $infoline);
1718 ############################################################################
1719 # Removing all scpactions, that have no name.
1720 # See: FlatLoaderZip
1721 ############################################################################
1723 sub remove_scpactions_without_name
1725 my ($itemsarrayref) = @_;
1727 if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::remove_scpactions_without_name : $#{$itemsarrayref}"); }
1729 my $infoline;
1731 my @newitemsarray = ();
1733 for ( my $i = 0; $i <= $#{$itemsarrayref}; $i++ )
1735 my $oneitem = ${$itemsarrayref}[$i];
1736 my $name = "";
1738 if ( $oneitem->{'Name'} ) { $name = $oneitem->{'Name'}; }
1740 if ( $name eq "" )
1742 $infoline = "ATTENTION: Removing scpaction $oneitem->{'gid'} from the installation set.\n";
1743 push( @installer::globals::logfileinfo, $infoline);
1744 next;
1747 push(@newitemsarray, $oneitem);
1750 return \@newitemsarray;
1753 ############################################################################
1754 # Because of the item "File" the source name must be "Name". Therefore
1755 # "Copy" is changed to "Name" and "Name" is changed to "DestinationName".
1756 ############################################################################
1758 sub change_keys_of_scpactions
1760 my ($itemsarrayref) = @_;
1762 if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::change_keys_of_scpactions : $#{$itemsarrayref}"); }
1764 for ( my $i = 0; $i <= $#{$itemsarrayref}; $i++ )
1766 my $oneitem = ${$itemsarrayref}[$i];
1768 my $key;
1770 # First Name to DestinationName, then deleting Name
1771 foreach $key (keys %{$oneitem})
1773 if ( $key =~ /\bName\b/ )
1775 my $value = $oneitem->{$key};
1776 my $oldkey = $key;
1777 $key =~ s/Name/DestinationName/;
1778 $oneitem->{$key} = $value;
1779 delete($oneitem->{$oldkey});
1783 # Second Copy to Name, then deleting Copy
1784 foreach $key (keys %{$oneitem})
1786 if ( $key =~ /\bCopy\b/ )
1788 my $value = $oneitem->{$key};
1789 my $oldkey = $key;
1790 $key =~ s/Copy/Name/;
1791 $oneitem->{$key} = $value;
1792 delete($oneitem->{$oldkey});
1798 ############################################################################
1799 # Removing all xpd only items from installation set (scpactions with
1800 # the style XPD_ONLY), except an xpd installation set is created
1801 ############################################################################
1803 sub remove_Xpdonly_Items
1805 my ($itemsarrayref) = @_;
1807 if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::remove_Xpdonly_Items : $#{$itemsarrayref}"); }
1809 my $infoline;
1811 my @newitemsarray = ();
1813 for ( my $i = 0; $i <= $#{$itemsarrayref}; $i++ )
1815 my $oneitem = ${$itemsarrayref}[$i];
1816 my $styles = "";
1817 if ( $oneitem->{'Styles'} ) { $styles = $oneitem->{'Styles'}; }
1819 if ( $styles =~ /\bXPD_ONLY\b/ )
1821 $infoline = "Removing \"xpd only\" item $oneitem->{'gid'} from the installation set.\n";
1822 push( @installer::globals::globallogfileinfo, $infoline);
1824 next;
1827 push(@newitemsarray, $oneitem);
1830 $infoline = "\n";
1831 push( @installer::globals::globallogfileinfo, $infoline);
1833 return \@newitemsarray;
1836 ############################################################################
1837 # Removing all language pack files from installation set (files with
1838 # the style LANGUAGEPACK), except this is a language pack.
1839 ############################################################################
1841 sub remove_Languagepacklibraries_from_Installset
1843 my ($itemsarrayref) = @_;
1845 if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::remove_Languagepacklibraries_from_Installset : $#{$itemsarrayref}"); }
1847 my $infoline;
1849 my @newitemsarray = ();
1851 for ( my $i = 0; $i <= $#{$itemsarrayref}; $i++ )
1853 my $oneitem = ${$itemsarrayref}[$i];
1854 my $styles = "";
1855 if ( $oneitem->{'Styles'} ) { $styles = $oneitem->{'Styles'}; }
1857 if ( $styles =~ /\bLANGUAGEPACK\b/ )
1859 $infoline = "Removing language pack file $oneitem->{'gid'} from the installation set.\n";
1860 push( @installer::globals::globallogfileinfo, $infoline);
1862 next;
1865 push(@newitemsarray, $oneitem);
1868 $infoline = "\n";
1869 push( @installer::globals::globallogfileinfo, $infoline);
1871 return \@newitemsarray;
1874 ############################################################################
1875 # Removing all files with flag PATCH_ONLY from installation set.
1876 # This function is not called during patch creation.
1877 ############################################################################
1879 sub remove_patchonlyfiles_from_Installset
1881 my ($itemsarrayref) = @_;
1883 if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::remove_patchonlyfiles_from_Installset : $#{$itemsarrayref}"); }
1885 my $infoline;
1887 my @newitemsarray = ();
1889 for ( my $i = 0; $i <= $#{$itemsarrayref}; $i++ )
1891 my $oneitem = ${$itemsarrayref}[$i];
1892 my $styles = "";
1893 if ( $oneitem->{'Styles'} ) { $styles = $oneitem->{'Styles'}; }
1895 if ( $styles =~ /\bPATCH_ONLY\b/ )
1897 $infoline = "Removing file with flag PATCH_ONLY $oneitem->{'gid'} from the installation set.\n";
1898 push( @installer::globals::globallogfileinfo, $infoline);
1900 next;
1903 push(@newitemsarray, $oneitem);
1906 $infoline = "\n";
1907 push( @installer::globals::globallogfileinfo, $infoline);
1909 return \@newitemsarray;
1912 ############################################################################
1913 # Removing all files with flag TAB_ONLY from installation set.
1914 # This function is not called during tab creation.
1915 ############################################################################
1917 sub remove_tabonlyfiles_from_Installset
1919 my ($itemsarrayref) = @_;
1921 if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::remove_tabonlyfiles_from_Installset : $#{$itemsarrayref}"); }
1923 my $infoline;
1925 my @newitemsarray = ();
1927 for ( my $i = 0; $i <= $#{$itemsarrayref}; $i++ )
1929 my $oneitem = ${$itemsarrayref}[$i];
1930 my $styles = "";
1931 if ( $oneitem->{'Styles'} ) { $styles = $oneitem->{'Styles'}; }
1933 if ( $styles =~ /\bTAB_ONLY\b/ )
1935 $infoline = "Removing tab only file $oneitem->{'gid'} from the installation set.\n";
1936 push( @installer::globals::globallogfileinfo, $infoline);
1938 next;
1941 push(@newitemsarray, $oneitem);
1944 $infoline = "\n";
1945 push( @installer::globals::globallogfileinfo, $infoline);
1947 return \@newitemsarray;
1950 ###############################################################################
1951 # Removing all files with flag ONLY_INSTALLED_PRODUCT from installation set.
1952 # This function is not called for PKGFORMAT installed and archive.
1953 ###############################################################################
1955 sub remove_installedproductonlyfiles_from_Installset
1957 my ($itemsarrayref) = @_;
1959 if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::remove_installedproductonlyfiles_from_Installset : $#{$itemsarrayref}"); }
1961 my $infoline;
1963 my @newitemsarray = ();
1965 for ( my $i = 0; $i <= $#{$itemsarrayref}; $i++ )
1967 my $oneitem = ${$itemsarrayref}[$i];
1968 my $styles = "";
1969 if ( $oneitem->{'Styles'} ) { $styles = $oneitem->{'Styles'}; }
1971 if ( $styles =~ /\bONLY_INSTALLED_PRODUCT\b/ )
1973 $infoline = "Removing file $oneitem->{'gid'} from the installation set. This file is only required for PKGFORMAT archive or installed).\n";
1974 push( @installer::globals::globallogfileinfo, $infoline);
1975 next;
1978 push(@newitemsarray, $oneitem);
1981 $infoline = "\n";
1982 push( @installer::globals::globallogfileinfo, $infoline);
1984 return \@newitemsarray;
1987 ############################################################################
1988 # Some files cotain a $ in their name. epm conflicts with such files.
1989 # Solution: Renaming this files, converting "$" to "$$"
1990 ############################################################################
1992 sub quoting_illegal_filenames
1994 my ($filesarrayref) = @_;
1996 if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::rename_illegal_filenames : $#{$filesarrayref}"); }
1998 # This function has to be removed as soon as possible!
2000 installer::logger::include_header_into_logfile("Renaming illegal filenames:");
2002 for ( my $i = 0; $i <= $#{$filesarrayref}; $i++ )
2004 my $onefile = ${$filesarrayref}[$i];
2005 my $filename = $onefile->{'Name'};
2007 if ( $filename =~ /\$/ )
2009 my $sourcepath = $onefile->{'sourcepath'};
2010 my $destpath = $onefile->{'destination'};
2012 # sourcepath and destination have to be quoted for epm list file
2014 # $filename =~ s/\$/\$\$/g;
2015 $destpath =~ s/\$/\$\$/g;
2016 $sourcepath =~ s/\$/\$\$/g;
2018 # my $infoline = "ATTENTION: Files: Renaming $onefile->{'Name'} to $filename\n";
2019 # push( @installer::globals::logfileinfo, $infoline);
2020 my $infoline = "ATTENTION: Files: Quoting sourcepath $onefile->{'sourcepath'} to $sourcepath\n";
2021 push( @installer::globals::logfileinfo, $infoline);
2022 $infoline = "ATTENTION: Files: Quoting destination path $onefile->{'destination'} to $destpath\n";
2023 push( @installer::globals::logfileinfo, $infoline);
2025 # $onefile->{'Name'} = $filename;
2026 $onefile->{'sourcepath'} = $sourcepath;
2027 $onefile->{'destination'} = $destpath;
2032 ############################################################################
2033 # Removing multiple occurences of same module.
2034 ############################################################################
2036 sub optimize_list
2038 my ( $longlist ) = @_;
2040 my $shortlist = "";
2041 my $hashref = installer::converter::convert_stringlist_into_hash(\$longlist, ",");
2042 foreach my $key (sort keys %{$hashref} ) { $shortlist = "$shortlist,$key"; }
2043 $shortlist =~ s/^\s*\,//;
2045 return $shortlist;
2048 #######################################################################
2049 # Collecting all directories needed for the epm list
2050 # 1. Looking for all destination paths in the files array
2051 # 2. Looking for directories with CREATE flag in the directory array
2052 #######################################################################
2054 ##################################
2055 # Collecting directories: Part 1
2056 ##################################
2058 sub collect_directories_from_filesarray
2060 my ($filesarrayref) = @_;
2062 if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::collect_directories_from_filesarray : $#{$filesarrayref}"); }
2064 my @alldirectories = ();
2065 my %alldirectoryhash = ();
2067 my $predefinedprogdir_added = 0;
2068 my $alreadyincluded = 0;
2070 # Preparing this already as hash, although the only needed value at the moment is the HostName
2071 # But also adding: "specificlanguage" and "Dir" (for instance gid_Dir_Program)
2073 for ( my $i = 0; $i <= $#{$filesarrayref}; $i++ )
2075 my $onefile = ${$filesarrayref}[$i];
2076 my $destinationpath = $onefile->{'destination'};
2077 installer::pathanalyzer::get_path_from_fullqualifiedname(\$destinationpath);
2078 $destinationpath =~ s/\Q$installer::globals::separator\E\s*$//; # removing ending slashes or backslashes
2080 $alreadyincluded = 0;
2081 if ( exists($alldirectoryhash{$destinationpath}) ) { $alreadyincluded = 1; }
2083 if (!($alreadyincluded))
2085 my %directoryhash = ();
2086 $directoryhash{'HostName'} = $destinationpath;
2087 $directoryhash{'specificlanguage'} = $onefile->{'specificlanguage'};
2088 $directoryhash{'Dir'} = $onefile->{'Dir'};
2089 $directoryhash{'modules'} = $onefile->{'modules'}; # NEW, saving modules
2090 # NEVER!!! if ( ! $installer::globals::iswindowsbuild ) { $directoryhash{'Styles'} = "(CREATE)"; } # this directories must be created
2092 if ( $onefile->{'Dir'} eq "PREDEFINED_PROGDIR" ) { $predefinedprogdir_added = 1; }
2094 $alldirectoryhash{$destinationpath} = \%directoryhash;
2096 # Problem: The $destinationpath can be share/registry/schema/org/openoffice
2097 # but not all directories contain files and will be added to this list.
2098 # Therefore the path has to be analyzed.
2100 while ( $destinationpath =~ /(^.*\S)\Q$installer::globals::separator\E(\S.*?)\s*$/ ) # as long as the path contains slashes
2102 $destinationpath = $1;
2104 $alreadyincluded = 0;
2105 if ( exists($alldirectoryhash{$destinationpath}) ) { $alreadyincluded = 1; }
2107 if (!($alreadyincluded))
2109 my %directoryhash = ();
2111 $directoryhash{'HostName'} = $destinationpath;
2112 $directoryhash{'specificlanguage'} = $onefile->{'specificlanguage'};
2113 $directoryhash{'Dir'} = $onefile->{'Dir'};
2114 $directoryhash{'modules'} = $onefile->{'modules'}; # NEW, saving modules
2115 # NEVER!!! if ( ! $installer::globals::iswindowsbuild ) { $directoryhash{'Styles'} = "(CREATE)"; } # this directories must be created
2117 $alldirectoryhash{$destinationpath} = \%directoryhash;
2119 else
2121 # Adding the modules to the module list!
2122 $alldirectoryhash{$destinationpath}->{'modules'} = $alldirectoryhash{$destinationpath}->{'modules'} . "," . $onefile->{'modules'};
2126 else
2128 # Adding the modules to the module list!
2129 $alldirectoryhash{$destinationpath}->{'modules'} = $alldirectoryhash{$destinationpath}->{'modules'} . "," . $onefile->{'modules'};
2131 # Also adding the module to all parents
2132 while ( $destinationpath =~ /(^.*\S)\Q$installer::globals::separator\E(\S.*?)\s*$/ ) # as long as the path contains slashes
2134 $destinationpath = $1;
2135 $alldirectoryhash{$destinationpath}->{'modules'} = $alldirectoryhash{$destinationpath}->{'modules'} . "," . $onefile->{'modules'};
2140 # if there is no file in the root directory PREDEFINED_PROGDIR, it has to be included into the directory array now
2141 # HostName= specificlanguage= Dir=PREDEFINED_PROGDIR
2143 if (! $predefinedprogdir_added )
2145 my %directoryhash = ();
2146 $directoryhash{'HostName'} = "";
2147 $directoryhash{'specificlanguage'} = "";
2148 $directoryhash{'modules'} = ""; # ToDo?
2149 $directoryhash{'Dir'} = "PREDEFINED_PROGDIR";
2151 push(@alldirectories, \%directoryhash);
2154 # Creating directory array
2155 foreach my $destdir ( sort keys %alldirectoryhash )
2157 $alldirectoryhash{$destdir}->{'modules'} = optimize_list($alldirectoryhash{$destdir}->{'modules'});
2158 push(@alldirectories, $alldirectoryhash{$destdir});
2161 return (\@alldirectories, \%alldirectoryhash);
2164 ##################################
2165 # Collecting directories: Part 2
2166 ##################################
2168 sub collect_directories_with_create_flag_from_directoryarray
2170 my ($directoryarrayref, $alldirectoryhash) = @_;
2172 if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::collect_directories_with_create_flag_from_directoryarray : $#{$directoryarrayref}"); }
2174 my $alreadyincluded = 0;
2175 my @alldirectories = ();
2177 for ( my $i = 0; $i <= $#{$directoryarrayref}; $i++ )
2179 my $onedir = ${$directoryarrayref}[$i];
2180 my $styles = "";
2181 $newdirincluded = 0;
2183 if ( $onedir->{'Styles'} ) { $styles = $onedir->{'Styles'}; }
2185 if ( $styles =~ /\bCREATE\b/ )
2187 my $directoryname = "";
2189 if ( $onedir->{'HostName'} ) { $directoryname = $onedir->{'HostName'}; }
2190 else { installer::exiter::exit_program("ERROR: No directory name (HostName) set for specified language in gid $onedir->{'gid'}", "collect_directories_with_create_flag_from_directoryarray"); }
2192 $alreadyincluded = 0;
2193 if ( exists($alldirectoryhash->{$directoryname}) ) { $alreadyincluded = 1; }
2195 if (!($alreadyincluded))
2197 my %directoryhash = ();
2198 $directoryhash{'HostName'} = $directoryname;
2199 $directoryhash{'specificlanguage'} = $onedir->{'specificlanguage'};
2200 # $directoryhash{'gid'} = $onedir->{'gid'};
2201 $directoryhash{'Dir'} = $onedir->{'gid'};
2202 $directoryhash{'Styles'} = $onedir->{'Styles'};
2204 # saving also the modules
2205 if ( ! $onedir->{'modules'} ) { installer::exiter::exit_program("ERROR: No assigned modules found for directory $onedir->{'gid'}", "collect_directories_with_create_flag_from_directoryarray"); }
2206 $directoryhash{'modules'} = $onedir->{'modules'};
2208 $alldirectoryhash->{$directoryname} = \%directoryhash;
2209 $newdirincluded = 1;
2211 # Problem: The $destinationpath can be share/registry/schema/org/openoffice
2212 # but not all directories contain files and will be added to this list.
2213 # Therefore the path has to be analyzed.
2215 while ( $directoryname =~ /(^.*\S)\Q$installer::globals::separator\E(\S.*?)\s*$/ ) # as long as the path contains slashes
2217 $directoryname = $1;
2219 $alreadyincluded = 0;
2220 if ( exists($alldirectoryhash->{$directoryname}) ) { $alreadyincluded = 1; }
2222 if (!($alreadyincluded))
2224 my %directoryhash = ();
2226 $directoryhash{'HostName'} = $directoryname;
2227 $directoryhash{'specificlanguage'} = $onedir->{'specificlanguage'};
2228 $directoryhash{'Dir'} = $onedir->{'gid'};
2229 if ( ! $installer::globals::iswindowsbuild ) { $directoryhash{'Styles'} = "(CREATE)"; } # Exeception for Windows?
2231 # saving also the modules
2232 $directoryhash{'modules'} = $onedir->{'modules'};
2234 $alldirectoryhash->{$directoryname} = \%directoryhash;
2235 $newdirincluded = 1;
2237 else
2239 # Adding the modules to the module list!
2240 $alldirectoryhash->{$directoryname}->{'modules'} = $alldirectoryhash->{$directoryname}->{'modules'} . "," . $onedir->{'modules'};
2244 else
2246 # Adding the modules to the module list!
2247 $alldirectoryhash->{$directoryname}->{'modules'} = $alldirectoryhash->{$directoryname}->{'modules'} . "," . $onedir->{'modules'};
2249 while ( $directoryname =~ /(^.*\S)\Q$installer::globals::separator\E(\S.*?)\s*$/ ) # as long as the path contains slashes
2251 $directoryname = $1;
2252 # Adding the modules to the module list!
2253 $alldirectoryhash->{$directoryname}->{'modules'} = $alldirectoryhash->{$directoryname}->{'modules'} . "," . $onedir->{'modules'};
2258 # Saving the styles for already added directories in function collect_directories_from_filesarray
2260 if (( ! $newdirincluded ) && ( $styles ne "" ))
2262 $styles =~ s/\bWORKSTATION\b//;
2263 $styles =~ s/\bCREATE\b//;
2265 if (( ! ( $styles =~ /^\s*\(\s*\)\s*$/ )) && ( ! ( $styles =~ /^\s*\(\s*\,\s*\)\s*$/ )) && ( ! ( $styles =~ /^\s*$/ ))) # checking, if there are styles left
2267 my $directoryname = "";
2268 if ( $onedir->{'HostName'} ) { $directoryname = $onedir->{'HostName'}; }
2269 else { installer::exiter::exit_program("ERROR: No directory name (HostName) set for specified language in gid $onedir->{'gid'}", "collect_directories_with_create_flag_from_directoryarray"); }
2271 if ( exists($alldirectoryhash->{$directoryname}) )
2273 $alldirectoryhash->{$directoryname}->{'Styles'} = $styles;
2279 # Creating directory array
2280 foreach my $destdir ( sort keys %{$alldirectoryhash} )
2282 $alldirectoryhash->{$destdir}->{'modules'} = optimize_list($alldirectoryhash->{$destdir}->{'modules'});
2283 push(@alldirectories, $alldirectoryhash->{$destdir});
2286 return (\@alldirectories, \%alldirectoryhash);
2289 #################################################
2290 # Determining the destination file of a link
2291 #################################################
2293 sub get_destination_file_path_for_links
2295 my ($linksarrayref, $filesarrayref) = @_;
2297 if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::get_destination_file_path_for_links : $#{$linksarrayref} : $#{$filesarrayref}"); }
2299 my $infoline;
2301 for ( my $i = 0; $i <= $#{$linksarrayref}; $i++ )
2303 my $fileid = "";
2304 my $onelink = ${$linksarrayref}[$i];
2305 if ( $onelink->{'FileID'} ) { $fileid = $onelink->{'FileID'}; }
2307 if (!( $fileid eq "" ))
2309 my $foundfile = 0;
2311 for ( my $j = 0; $j <= $#{$filesarrayref}; $j++ )
2313 my $onefile = ${$filesarrayref}[$j];
2314 my $filegid = $onefile->{'gid'};
2316 if ( $filegid eq $fileid )
2318 $foundfile = 1;
2319 $onelink->{'destinationfile'} = $onefile->{'destination'};
2320 last;
2324 if (!($foundfile))
2326 $infoline = "Warning: FileID $fileid for Link $onelink->{'gid'} not found!\n";
2327 push( @installer::globals::logfileinfo, $infoline);
2332 $infoline = "\n";
2333 push( @installer::globals::logfileinfo, $infoline);
2336 #################################################
2337 # Determining the destination link of a link
2338 #################################################
2340 sub get_destination_link_path_for_links
2342 my ($linksarrayref) = @_;
2344 if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::get_destination_link_path_for_links : $#{$linksarrayref}"); }
2346 my $infoline;
2348 for ( my $i = 0; $i <= $#{$linksarrayref}; $i++ )
2350 my $shortcutid = "";
2351 my $onelink = ${$linksarrayref}[$i];
2352 if ( $onelink->{'ShortcutID'} ) { $shortcutid = $onelink->{'ShortcutID'}; }
2354 if (!( $shortcutid eq "" ))
2356 my $foundlink = 0;
2358 for ( my $j = 0; $j <= $#{$linksarrayref}; $j++ )
2360 my $destlink = ${$linksarrayref}[$j];
2361 $shortcutgid = $destlink->{'gid'};
2363 if ( $shortcutgid eq $shortcutid )
2365 $foundlink = 1;
2366 $onelink->{'destinationfile'} = $destlink->{'destination'}; # making key 'destinationfile'
2367 last;
2371 if (!($foundlink))
2373 $infoline = "Warning: ShortcutID $shortcutid for Link $onelink->{'gid'} not found!\n";
2374 push( @installer::globals::logfileinfo, $infoline);
2379 $infoline = "\n";
2380 push( @installer::globals::logfileinfo, $infoline);
2383 ###################################################################################
2384 # Items with flag WORKSTATION are not needed (here: links and configurationitems)
2385 ###################################################################################
2387 sub remove_workstation_only_items
2389 my ($itemarrayref) = @_;
2391 if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::remove_workstation_only_items : $#{$itemarrayref}"); }
2393 my @newitemarray = ();
2395 for ( my $i = 0; $i <= $#{$itemarrayref}; $i++ )
2397 my $oneitem = ${$itemarrayref}[$i];
2398 my $styles = $oneitem->{'Styles'};
2400 if (( $styles =~ /\bWORKSTATION\b/ ) &&
2401 (!( $styles =~ /\bNETWORK\b/ )) &&
2402 (!( $styles =~ /\bSTANDALONE\b/ )))
2404 next; # removing this link, it is only needed for a workstation installation
2407 push(@newitemarray, $oneitem);
2410 return \@newitemarray;
2413 ################################################
2414 # Resolving relative path in links
2415 ################################################
2417 sub resolve_links_with_flag_relative
2419 my ($linksarrayref) = @_;
2421 if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::resolve_links_with_flag_relative : $#{$linksarrayref}"); }
2423 # Before this step is:
2424 # destination=program/libsalhelperC52.so.3, this will be the name of the link
2425 # destinationfile=program/libsalhelperC52.so.3, this will be the linked file or name
2426 # If the flag RELATIVE is set, the pathes have to be analyzed. If the flag is not set
2427 # (this will not occur in the future?) destinationfile has to be an absolute path name
2429 for ( my $i = 0; $i <= $#{$linksarrayref}; $i++ )
2431 my $onelink = ${$linksarrayref}[$i];
2432 my $styles = $onelink->{'Styles'};
2434 if ( $styles =~ /\bRELATIVE\b/ )
2436 # ToDo: This is only a simple not sufficient mechanism
2438 my $destination = $onelink->{'destination'};
2439 my $destinationfile = $onelink->{'destinationfile'};
2441 my $destinationpath = $destination;
2443 installer::pathanalyzer::get_path_from_fullqualifiedname(\$destinationpath);
2445 my $destinationfilepath = $destinationfile;
2447 # it is possible, that the destinationfile is no longer part of the files collector
2448 if ($destinationfilepath) { installer::pathanalyzer::get_path_from_fullqualifiedname(\$destinationfilepath); }
2449 else { $destinationfilepath = ""; }
2451 if ( $destinationpath eq $destinationfilepath )
2453 # link and file are in the same directory
2454 # Therefore the path of the file can be removed
2456 my $newdestinationfile = $destinationfile;
2457 installer::pathanalyzer::make_absolute_filename_to_relative_filename(\$newdestinationfile);
2459 $onelink->{'destinationfile'} = $newdestinationfile;
2465 ########################################################################
2466 # This function is a helper of function "assigning_modules_to_items"
2467 ########################################################################
2469 sub insert_for_item ($$$)
2471 my ($hash, $item, $id) = @_;
2473 # print STDERR "insert '$id' for '$item'\n";
2474 if (!defined $hash->{$item})
2476 my @gids = ();
2477 $hash->{$item} = \@gids;
2479 my $gid_list = $hash->{$item};
2480 push @{$gid_list}, $id;
2481 $hash->{$item} = $gid_list;
2484 sub build_modulegids_table
2486 my ($modulesref, $itemname) = @_;
2488 my %module_lookup_table = ();
2490 # build map of item names to list of respective module gids
2491 # containing these items
2492 for my $onemodule (@{$modulesref})
2494 next if ( ! defined $onemodule->{$itemname} );
2495 # these are the items contained in this module
2496 # eg. Files = (gid_a_b_c,gid_d_e_f)
2497 my $module_gids = $onemodule->{$itemname};
2499 # prune outer brackets
2500 $module_gids =~ s|^\s*\(||g;
2501 $module_gids =~ s|\)\s*$||g;
2502 for my $id (split (/,/, $module_gids))
2504 chomp $id;
2505 insert_for_item(\%module_lookup_table, lc ($id), $onemodule->{'gid'});
2509 return \%module_lookup_table;
2512 ########################################################################
2513 # Items like files do not know their modules
2514 # This function is a helper of function "assigning_modules_to_items"
2515 ########################################################################
2517 sub get_string_of_modulegids_for_itemgid
2519 my ($module_lookup_table, $modulesref, $itemgid, $itemname) = @_;
2521 if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::get_string_of_modulegids_for_itemgid : $#{$modulesref} : $itemgid : $itemname"); }
2523 my $allmodules = "";
2524 my $haslanguagemodule = 0;
2525 my %foundmodules = ();
2527 # print STDERR "lookup '" . lc($itemgid) . "'\n";
2528 my $gid_list = $module_lookup_table->{lc($itemgid)};
2530 for my $gid (@{$gid_list})
2532 $foundmodules{$gid} = 1;
2533 $allmodules = $allmodules . "," . $gid;
2534 # Is this module a language module? This info should be stored at the file.
2535 if ( exists($installer::globals::alllangmodules{$gid}) ) { $haslanguagemodule = 1; }
2538 $allmodules =~ s/^\s*\,//; # removing leading comma
2540 # Check: All modules or no module must have flag LANGUAGEMODULE
2541 if ( $haslanguagemodule )
2543 my $isreallylanguagemodule = installer::worker::key_in_a_is_also_key_in_b(\%foundmodules, \%installer::globals::alllangmodules);
2544 if ( ! $isreallylanguagemodule ) { installer::exiter::exit_program("ERROR: \"$itemgid\" is assigned to modules with flag \"LANGUAGEMODULE\" and also to modules without this flag! Modules: $allmodules", "get_string_of_modulegids_for_itemgid"); }
2547 # print STDERR "get_string_for_itemgid ($itemgid, $itemname) => $allmodules, $haslanguagemodule\n";
2549 return ($allmodules, $haslanguagemodule);
2552 ########################################################
2553 # Items like files do not know their modules
2554 # This function add the {'modules'} to these items
2555 ########################################################
2557 sub assigning_modules_to_items
2559 my ($modulesref, $itemsref, $itemname) = @_;
2561 if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::assigning_modules_to_items : $#{$modulesref} : $#{$itemsref} : $itemname"); }
2563 my $infoline = "";
2564 my $languageassignmenterror = 0;
2565 my @languageassignmenterrors = ();
2567 my $module_lookup_table = build_modulegids_table($modulesref, $itemname);
2569 for my $oneitem (@{$itemsref})
2571 my $itemgid = $oneitem->{'gid'};
2573 my $styles = "";
2574 if ( $oneitem->{'Styles'} ) { $styles = $oneitem->{'Styles'}; }
2575 if (( $itemname eq "Dirs" ) && ( ! ( $styles =~ /\bCREATE\b/ ))) { next; }
2577 if ( $itemgid eq "" )
2579 installer::exiter::exit_program("ERROR in item collection: No gid for item $oneitem->{'Name'}", "assigning_modules_to_items");
2582 # every item can belong to many modules
2584 my ($modulegids, $haslanguagemodule) = get_string_of_modulegids_for_itemgid($module_lookup_table, $modulesref, $itemgid, $itemname);
2586 if ($modulegids eq "")
2588 installer::exiter::exit_program("ERROR in file collection: No module found for $itemname $itemgid", "assigning_modules_to_items");
2591 $oneitem->{'modules'} = $modulegids;
2592 $oneitem->{'haslanguagemodule'} = $haslanguagemodule;
2594 # Important check: "ismultilingual" and "haslanguagemodule" must have the same value !
2595 if (( $oneitem->{'ismultilingual'} ) && ( ! $oneitem->{'haslanguagemodule'} ))
2597 $infoline = "Error: \"$oneitem->{'gid'}\" is multi lingual, but not in language pack (Assigned module: $modulegids)!\n";
2598 push( @installer::globals::globallogfileinfo, $infoline);
2599 push( @languageassignmenterrors, $infoline );
2600 $languageassignmenterror = 1;
2602 if (( $oneitem->{'haslanguagemodule'} ) && ( ! $oneitem->{'ismultilingual'} ))
2604 $infoline = "Error: \"$oneitem->{'gid'}\" is in language pack, but not multi lingual (Assigned module: $modulegids)!\n";
2605 push( @installer::globals::globallogfileinfo, $infoline);
2606 push( @languageassignmenterrors, $infoline );
2607 $languageassignmenterror = 1;
2611 if ($languageassignmenterror)
2613 for ( my $i = 0; $i <= $#languageassignmenterrors; $i++ ) { print "$languageassignmenterrors[$i]"; }
2614 installer::exiter::exit_program("ERROR: Incorrect assignments for language packs.", "assigning_modules_to_items");
2619 #################################################################################################
2620 # Root path (for instance /opt/openofficeorg20) needs to be added to directories, files and links
2621 #################################################################################################
2623 sub add_rootpath_to_directories
2625 my ($dirsref, $rootpath) = @_;
2627 if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::add_rootpath_to_directories : $#{$dirsref} : $rootpath"); }
2629 for ( my $i = 0; $i <= $#{$dirsref}; $i++ )
2631 my $onedir = ${$dirsref}[$i];
2632 my $dir = "";
2634 if ( $onedir->{'Dir'} ) { $dir = $onedir->{'Dir'}; }
2636 if (!($dir =~ /\bPREDEFINED_/ ))
2638 my $hostname = $onedir->{'HostName'};
2639 $hostname = $rootpath . $installer::globals::separator . $hostname;
2640 $onedir->{'HostName'} = $hostname;
2643 # added
2645 if ( $dir =~ /\bPREDEFINED_PROGDIR\b/ )
2647 my $hostname = $onedir->{'HostName'};
2648 if ( $hostname eq "" ) { $onedir->{'HostName'} = $rootpath; }
2649 else { $onedir->{'HostName'} = $rootpath . $installer::globals::separator . $hostname; }
2654 sub add_rootpath_to_files
2656 my ($filesref, $rootpath) = @_;
2658 if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::add_rootpath_to_files : $#{$filesref} : $rootpath"); }
2660 for ( my $i = 0; $i <= $#{$filesref}; $i++ )
2662 my $onefile = ${$filesref}[$i];
2663 my $destination = $onefile->{'destination'};
2664 $destination = $rootpath . $installer::globals::separator . $destination;
2665 $onefile->{'destination'} = $destination;
2669 sub add_rootpath_to_links
2671 my ($linksref, $rootpath) = @_;
2673 if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::add_rootpath_to_links : $#{$linksref} : $rootpath"); }
2675 for ( my $i = 0; $i <= $#{$linksref}; $i++ )
2677 my $onelink = ${$linksref}[$i];
2678 my $styles = $onelink->{'Styles'};
2680 my $destination = $onelink->{'destination'};
2681 $destination = $rootpath . $installer::globals::separator . $destination;
2682 $onelink->{'destination'} = $destination;
2684 if (!($styles =~ /\bRELATIVE\b/ )) # for absolute links
2686 my $destinationfile = $onelink->{'destinationfile'};
2687 $destinationfile = $rootpath . $installer::globals::separator . $destinationfile;
2688 $onelink->{'destinationfile'} = $destinationfile;
2693 #################################################################################
2694 # Collecting all parent gids
2695 #################################################################################
2697 sub collect_all_parent_feature
2699 my ($modulesref) = @_;
2701 my @allparents = ();
2703 my $found_root_module = 0;
2705 for ( my $i = 0; $i <= $#{$modulesref}; $i++ )
2707 my $onefeature = ${$modulesref}[$i];
2709 my $parentgid = "";
2710 if ( $onefeature->{'ParentID'} )
2712 $parentgid = $onefeature->{'ParentID'};
2715 if ( $parentgid ne "" )
2717 if (! installer::existence::exists_in_array($parentgid, \@allparents))
2719 push(@allparents, $parentgid);
2723 # Setting the global root module
2725 if ( $parentgid eq "" )
2727 if ( $found_root_module ) { installer::exiter::exit_program("ERROR: Only one module without ParentID or with empty ParentID allowed ($installer::globals::rootmodulegid, $onefeature->{'gid'}).", "collect_all_parent_feature"); }
2728 $installer::globals::rootmodulegid = $onefeature->{'gid'};
2729 $found_root_module = 1;
2730 $infoline = "Setting Root Module: $installer::globals::rootmodulegid\n";
2731 push( @installer::globals::globallogfileinfo, $infoline);
2734 if ( ! $found_root_module ) { installer::exiter::exit_program("ERROR: Could not define root module. No module without ParentID or with empty ParentID exists.", "collect_all_parent_feature"); }
2738 return \@allparents;
2741 #################################################################################
2742 # Checking for every feature, whether it has children
2743 #################################################################################
2745 sub set_children_flag
2747 my ($modulesref) = @_;
2749 my $allparents = collect_all_parent_feature($modulesref);
2751 for ( my $i = 0; $i <= $#{$modulesref}; $i++ )
2753 my $onefeature = ${$modulesref}[$i];
2754 my $gid = $onefeature->{'gid'};
2756 # is this gid a parent?
2758 if ( installer::existence::exists_in_array($gid, $allparents) )
2760 $onefeature->{'has_children'} = 1;
2762 else
2764 $onefeature->{'has_children'} = 0;
2769 #################################################################################
2770 # All modules, that use a template module, do now get the assignments of
2771 # the template module.
2772 #################################################################################
2774 sub resolve_assigned_modules
2776 my ($modulesref) = @_;
2778 # collecting all template modules
2780 my %directaccess = ();
2782 for ( my $i = 0; $i <= $#{$modulesref}; $i++ )
2784 my $onefeature = ${$modulesref}[$i];
2785 my $styles = "";
2786 if ( $onefeature->{'Styles'} ) { $styles = $onefeature->{'Styles'}; }
2787 if ( $styles =~ /\bTEMPLATEMODULE\b/ ) { $directaccess{$onefeature->{'gid'}} = $onefeature; }
2789 # also looking for module with flag ROOT_BRAND_PACKAGE, to save is for further usage
2790 if ( $styles =~ /\bROOT_BRAND_PACKAGE\b/ )
2792 $installer::globals::rootbrandpackage = $onefeature->{'gid'};
2793 $installer::globals::rootbrandpackageset = 1;
2797 # looking, where template modules are assigned
2799 for ( my $i = 0; $i <= $#{$modulesref}; $i++ )
2801 my $onefeature = ${$modulesref}[$i];
2802 if ( $onefeature->{'Assigns'} )
2804 my $templategid = $onefeature->{'Assigns'};
2806 if ( ! exists($directaccess{$templategid}) )
2808 installer::exiter::exit_program("ERROR: Did not find definition of assigned template module \"$templategid\"", "resolve_assigned_modules");
2811 # Currently no merging of Files, Dirs, ...
2812 # This has to be included here, if it is required
2813 my $item;
2814 foreach $item (@installer::globals::items_at_modules)
2816 if ( exists($directaccess{$templategid}->{$item}) ) { $onefeature->{$item} = $directaccess{$templategid}->{$item}; }
2822 #################################################################################
2823 # Removing the template modules from the list, after all
2824 # assignments are transferred to the "real" modules.
2825 #################################################################################
2827 sub remove_template_modules
2829 my ($modulesref) = @_;
2831 my @modules = ();
2833 for ( my $i = 0; $i <= $#{$modulesref}; $i++ )
2835 my $onefeature = ${$modulesref}[$i];
2836 my $styles = "";
2837 if ( $onefeature->{'Styles'} ) { $styles = $onefeature->{'Styles'}; }
2838 if ( $styles =~ /\bTEMPLATEMODULE\b/ ) { next; }
2840 push(@modules, $onefeature);
2843 return \@modules;
2846 #################################################################################
2847 # Collecting all modules with flag LANGUAGEMODULE in a global
2848 # collector.
2849 #################################################################################
2851 sub collect_all_languagemodules
2853 my ($modulesref) = @_;
2855 for ( my $i = 0; $i <= $#{$modulesref}; $i++ )
2857 my $onefeature = ${$modulesref}[$i];
2858 my $styles = "";
2859 if ( $onefeature->{'Styles'} ) { $styles = $onefeature->{'Styles'}; }
2860 if ( $styles =~ /\bLANGUAGEMODULE\b/ )
2862 if ( ! exists($onefeature->{'Language'}) ) { installer::exiter::exit_program("ERROR: \"$onefeature->{'gid'}\" has flag LANGUAGEMODULE, but does not know its language!", "collect_all_languagemodules"); }
2863 $installer::globals::alllangmodules{$onefeature->{'gid'}} = $onefeature->{'Language'};
2864 # Collecting also the english names, that are used for nsis unpack directory for language packs
2865 my $lang = $onefeature->{'Language'};
2866 my $name = "";
2867 foreach my $localkey ( keys %{$onefeature} )
2869 if ( $localkey =~ /^\s*Name\s*\(\s*en-US\s*\)\s*$/ )
2871 $installer::globals::all_english_languagestrings{$lang} = $onefeature->{$localkey};
2878 #################################################################################
2879 # Selecting from all collected english language strings those, that are really
2880 # required in this installation set.
2881 #################################################################################
2883 sub select_required_language_strings
2885 my ($modulesref) = @_;
2887 for ( my $i = 0; $i <= $#{$modulesref}; $i++ )
2889 my $onefeature = ${$modulesref}[$i];
2890 my $styles = "";
2891 if ( $onefeature->{'Styles'} ) { $styles = $onefeature->{'Styles'}; }
2892 if ( $styles =~ /\bLANGUAGEMODULE\b/ )
2894 if ( ! exists($onefeature->{'Language'}) ) { installer::exiter::exit_program("ERROR: \"$onefeature->{'gid'}\" has flag LANGUAGEMODULE, but does not know its language!", "select_required_language_strings"); }
2895 my $lang = $onefeature->{'Language'};
2897 if (( exists($installer::globals::all_english_languagestrings{$lang}) ) && ( ! exists($installer::globals::all_required_english_languagestrings{$lang}) ))
2899 $installer::globals::all_required_english_languagestrings{$lang} = $installer::globals::all_english_languagestrings{$lang};
2905 #####################################################################################
2906 # Unixlinks are not always required. For Linux RPMs and Solaris Packages they are
2907 # created dynamically. Exception: For package formats "installed" or "archive".
2908 # In scp2 this unixlinks have the flag LAYERLINK.
2909 #####################################################################################
2911 sub filter_layerlinks_from_unixlinks
2913 my ( $unixlinksref ) = @_;
2915 my @alllinks = ();
2917 for ( my $i = 0; $i <= $#{$unixlinksref}; $i++ )
2919 my $isrequired = 1;
2921 my $onelink = ${$unixlinksref}[$i];
2922 my $styles = "";
2923 if ( $onelink->{'Styles'} ) { $styles = $onelink->{'Styles'}; }
2925 if ( $styles =~ /\bLAYERLINK\b/ )
2927 # Platforms, that do not need the layer links
2928 if (( $installer::globals::islinuxrpmbuild ) || ( $installer::globals::issolarispkgbuild ))
2930 $isrequired = 0;
2933 # Package formats, that need the layer link (platform independent)
2934 if (( $installer::globals::packageformat eq "installed" ) || ( $installer::globals::packageformat eq "archive" ))
2936 $isrequired = 1;
2940 if ( $isrequired ) { push(@alllinks, $onelink); }
2943 return \@alllinks;