diff options
author | Thomas Arnhold <thomas@arnhold.org> | 2012-08-18 12:03:51 +0200 |
---|---|---|
committer | Tim Retout <tim@retout.co.uk> | 2012-08-19 03:08:31 +0100 |
commit | 81dcbc38d24acd76d0d1bcda5750d2e99c965c98 (patch) | |
tree | cfe3a6730bdfc463c6bffa1dd46061a07963d488 /solenv | |
parent | 248ea1924e90ee22f55852c42f4e5cfea342737f (diff) |
installer: cleanup admin.pm
Those are unused, because their calls are commented out.
Looks like include_tables_into_pcpfile should have been
include_tables_into_msifile. Seems like copy and paste from
msp.pm.
Change-Id: I01435277b49027b6d685fb27748e513f6bc525ae
Diffstat (limited to 'solenv')
-rw-r--r-- | solenv/bin/modules/installer/windows/admin.pm | 306 |
1 files changed, 0 insertions, 306 deletions
diff --git a/solenv/bin/modules/installer/windows/admin.pm b/solenv/bin/modules/installer/windows/admin.pm index e6e69b8f5509..a0dc529afd67 100644 --- a/solenv/bin/modules/installer/windows/admin.pm +++ b/solenv/bin/modules/installer/windows/admin.pm @@ -101,65 +101,6 @@ sub unpack_cabinet_file } ################################################################################# -# Include tables into a msi database -################################################################################# - -sub include_tables_into_pcpfile -{ - my ($fullmsidatabasepath, $workdir, $tables) = @_; - - my $msidb = "msidb.exe"; # Has to be in the path - if ( $installer::globals::isunix ) - { - $msidb = "$ENV{'OUTDIR_FOR_BUILD'}/bin/msidb.exe"; - } - my $infoline = ""; - my $systemcall = ""; - my $returnvalue = ""; - - # Make all table 8+3 conform - my $alltables = installer::converter::convert_stringlist_into_array(\$tables, " "); - - for ( my $i = 0; $i <= $#{$alltables}; $i++ ) - { - my $tablename = ${$alltables}[$i]; - $tablename =~ s/\s*$//; - my $namelength = length($tablename); - if ( $namelength > 8 ) - { - my $newtablename = substr($tablename, 0, 8); # name, offset, length - my $oldfile = $workdir . $installer::globals::separator . $tablename . ".idt"; - my $newfile = $workdir . $installer::globals::separator . $newtablename . ".idt"; - if ( -f $newfile ) { unlink $newfile; } - installer::systemactions::copy_one_file($oldfile, $newfile); - my $savfile = $oldfile . ".orig"; - installer::systemactions::copy_one_file($oldfile, $savfile); - } - } - - # Import of tables - - $systemcall = $msidb . " -d " . $fullmsidatabasepath . " -f " . $workdir . " -i " . $tables; - - $returnvalue = system($systemcall); - - $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); - - if ($returnvalue) - { - $infoline = "ERROR: Could not execute $systemcall !\n"; - push( @installer::globals::logfileinfo, $infoline); - installer::exiter::exit_program("ERROR: Could not include tables into msi database: $fullmsidatabasepath !", "include_tables_into_pcpfile"); - } - else - { - $infoline = "Success: Executed $systemcall successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); - } -} - -################################################################################# # Extracting tables from msi database ################################################################################# @@ -281,70 +222,6 @@ sub analyze_component_file } ################################################################################# -# Analyzing the full content of Component.idt -################################################################################# - -sub analyze_keypath_component_file -{ - my ($filecontent) = @_; - - my %keypathtable = (); - - for ( my $i = 0; $i <= $#{$filecontent}; $i++ ) - { - if (( $i == 0 ) || ( $i == 1 ) || ( $i == 2 )) { next; } - - if ( ${$filecontent}[$i] =~ /^\s*(.*?)\t(.*?)\t(.*?)\t(.*?)\t(.*?)\t(.*?)\s*$/ ) - { - my $component = $1; - my $keypath = $6; - - $keypathtable{$keypath} = $component; - } - } - - return (\%keypathtable); - -} - -################################################################################# -# Analyzing the content of Registry.idt -################################################################################# - -sub analyze_registry_file -{ - my ($filecontent) = @_; - - my %table = (); - - for ( my $i = 0; $i <= $#{$filecontent}; $i++ ) - { - if (( $i == 0 ) || ( $i == 1 ) || ( $i == 2 )) { next; } - - if ( ${$filecontent}[$i] =~ /^\s*(.*?)\t(.*?)\t(.*?)\t(.*?)\t(.*?)\t(.*?)\s*$/ ) - { - my $registry = $1; - my $root = $2; - my $key = $3; - my $name = $4; - my $value = $5; - my $component = $6; - - my %helphash = (); - $helphash{'Root'} = $root; - $helphash{'Key'} = $key; - $helphash{'Name'} = $name; - $helphash{'Value'} = $value; - $helphash{'Component'} = $component; - - $table{$registry} = \%helphash; - } - } - - return \%table; -} - -################################################################################# # Analyzing the content of File.idt ################################################################################# @@ -524,175 +401,6 @@ sub get_sis_time_string } ############################################################### -# Windows registry entries containing properties are not set -# correctly during msp patch process. The properties are -# empty or do get their default values. This destroys the -# values of many entries in Windows registry. -# This can be fixed by removing all entries in Registry table, -# containing a property before starting msimsp.exe. -############################################################### - -sub remove_properties_from_registry_table -{ - my ($registryhash, $componentkeypathhash, $registryfilecontent) = @_; - - installer::logger::include_timestamp_into_logfile("\nPerformance Info: Start remove_properties_from_registry_table"); - - my @registrytable = (); - - # Registry hash - # Collecting all RegistryItems with values containing a property: [...] - # To which component do they belong - # Is this after removal an empty component? Create a replacement, so that - # no Component has to be removed. - # Is this RegistryItem a KeyPath of a component. Then it cannot be removed. - - my %problemitems = (); - my %problemcomponents = (); - my %securecomponents = (); - my $changevalue = ""; - my $changeroot = ""; - my $infoline = ""; - - my $newitemcounter = 0; - my $olditemcounter = 0; - - foreach my $regitem ( keys %{$registryhash} ) - { - my $value = ""; - if ( exists($registryhash->{$regitem}->{'Value'}) ) { $value = $registryhash->{$regitem}->{'Value'}; } - - if ( $value =~ /^.*(\[.*?\]).*$/ ) - { - my $property = $1; - - # Collecting registry item - $problemitems{$regitem} = 1; # "1" -> can be removed - if ( exists($componentkeypathhash->{$regitem}) ) { $problemitems{$regitem} = 2; } # "2" -> cannot be removed, KeyPath - - # Collecting component (and number of problematic registry items - # my $component = $registryhash->{$regitem}->{'Component'}; - # if ( exists($problemcomponents{$regitem}) ) { $problemcomponents{$regitem} = $problemcomponents{$regitem} + 1; } - # else { $problemcomponents{$regitem} = 1; } - } - else - { - # Collecting all components with secure regisry items - my $component = ""; - if ( exists($registryhash->{$regitem}->{'Component'}) ) { $component = $registryhash->{$regitem}->{'Component'}; } - if ( $component eq "" ) { installer::exiter::exit_program("ERROR: Did not find component for registry item \"$regitem\".", "remove_properties_from_registry_table"); } - $securecomponents{$component} = 1; - } - - # Searching for change value - my $localkey = ""; - if ( exists($registryhash->{$regitem}->{'Key'}) ) { $localkey = $registryhash->{$regitem}->{'Key'}; } - if (( $localkey =~ /^\s*(Software\\.*\\)StartMenu\s*$/ ) && ( $changevalue eq "" )) - { - $changevalue = $1; - $changeroot = $registryhash->{$regitem}->{'Root'}; - } - - $olditemcounter++; - } - - my $removecounter = 0; - my $renamecounter = 0; - - foreach my $regitem ( keys %{$registryhash} ) - { - my $value = ""; - if ( exists($registryhash->{$regitem}->{'Value'}) ) { $value = $registryhash->{$regitem}->{'Value'}; } - - if ( $value =~ /^.*(\[.*?\]).*$/ ) - { - # Removing registry items, that are no KeyPath and that belong to components, - # that have other secure registry items. - - my $component = ""; - if ( exists($registryhash->{$regitem}->{'Component'}) ) { $component = $registryhash->{$regitem}->{'Component'}; } - if ( $component eq "" ) { installer::exiter::exit_program("ERROR: Did not find component for registry item (2) \"$regitem\".", "remove_properties_from_registry_table"); } - - if (( $problemitems{$regitem} == 1 ) && ( exists($securecomponents{$component}) )) - { - # remove complete registry item - delete($registryhash->{$regitem}); - $removecounter++; - $infoline = "Removing registry item: $regitem : $value\n"; - push( @installer::globals::logfileinfo, $infoline); - } - else - { - # Changing values of registry items, that are KeyPath or that contain to - # components with only unsecure registry items. - - if (( $problemitems{$regitem} == 2 ) || ( ! exists($securecomponents{$component}) )) - { - # change value of registry item - if ( $changevalue eq "" ) { installer::exiter::exit_program("ERROR: Did not find good change value for registry items", "remove_properties_from_registry_table"); } - - my $oldkey = ""; - if ( exists($registryhash->{$regitem}->{'Key'}) ) { $oldkey = $registryhash->{$regitem}->{'Key'}; }; - my $oldname = ""; - if ( exists($registryhash->{$regitem}->{'Name'}) ) { $oldname = $registryhash->{$regitem}->{'Name'}; } - my $oldvalue = ""; - if ( exists($registryhash->{$regitem}->{'Value'}) ) { $oldvalue = $registryhash->{$regitem}->{'Value'}; } - - $registryhash->{$regitem}->{'Key'} = $changevalue . "RegistryItem"; - $registryhash->{$regitem}->{'Root'} = $changeroot; - $registryhash->{$regitem}->{'Name'} = $regitem; - $registryhash->{$regitem}->{'Value'} = 1; - $renamecounter++; - - $infoline = "Changing registry item: $regitem\n"; - $infoline = "Old: $oldkey : $oldname : $oldvalue\n"; - $infoline = "New: $registryhash->{$regitem}->{'Key'} : $registryhash->{$regitem}->{'Name'} : $registryhash->{$regitem}->{'Value'}\n"; - push( @installer::globals::logfileinfo, $infoline); - } - } - } - } - - $infoline = "Number of removed registry items: $removecounter\n"; - push( @installer::globals::logfileinfo, $infoline); - $infoline = "Number of changed registry items: $renamecounter\n"; - push( @installer::globals::logfileinfo, $infoline); - - # Creating the new content of Registry table - # First three lines from $registryfilecontent - # All further files from changed $registryhash - - for ( my $i = 0; $i <= 2; $i++ ) { push(@registrytable, ${$registryfilecontent}[$i]); } - - foreach my $regitem ( keys %{$registryhash} ) - { - my $root = ""; - if ( exists($registryhash->{$regitem}->{'Root'}) ) { $root = $registryhash->{$regitem}->{'Root'}; } - else { installer::exiter::exit_program("ERROR: Did not find root in registry table for item: \"$regitem\".", "remove_properties_from_registry_table"); } - my $localkey = ""; - if ( exists($registryhash->{$regitem}->{'Key'}) ) { $localkey = $registryhash->{$regitem}->{'Key'}; } - my $name = ""; - if ( exists($registryhash->{$regitem}->{'Name'}) ) { $name = $registryhash->{$regitem}->{'Name'}; } - my $value = ""; - if ( exists($registryhash->{$regitem}->{'Value'}) ) { $value = $registryhash->{$regitem}->{'Value'}; } - my $comp = ""; - if ( exists($registryhash->{$regitem}->{'Component'}) ) { $comp = $registryhash->{$regitem}->{'Component'}; } - - my $oneline = $regitem . "\t" . $root . "\t" . $localkey . "\t" . $name . "\t" . $value . "\t" . $comp . "\n"; - push(@registrytable, $oneline); - - $newitemcounter++; - } - - $infoline = "Number of registry items: $newitemcounter. Old value: $olditemcounter.\n"; - push( @installer::globals::logfileinfo, $infoline); - - installer::logger::include_timestamp_into_logfile("\nPerformance Info: End remove_properties_from_registry_table"); - - return (\@registrytable); -} - -############################################################### # Writing content of administrative installations into # Summary Information Stream of msi database. # This is required for example for following @@ -820,20 +528,6 @@ sub make_admin_install my $msidatabase = $targetdir . $installer::globals::separator . $databasefilename; installer::systemactions::copy_one_file($databasepath, $msidatabase); - # Editing registry table because of wrong Property value - # my $registryfilename = $helperdir . $installer::globals::separator . "Registry.idt"; - # my $componentfilename = $helperdir . $installer::globals::separator . "Component.idt"; - # my $componentkeypathhash = analyze_keypath_component_file($componentfilecontent); - - # my $registryfilecontent = installer::files::read_file($registryfilename); - # my $registryhash = analyze_registry_file($registryfilecontent); - - # $registryfilecontent = remove_properties_from_registry_table($registryhash, $componentkeypathhash, $registryfilecontent); - - # installer::files::save_file($registryfilename, $registryfilecontent); - # $tablelist = "Registry"; - # include_tables_into_pcpfile($msidatabase, $helperdir, $tablelist); - # Saving info in Summary Information Stream of msi database (required for following patches) write_sis_info($msidatabase); |