From ee55d090aa6af13799c803588369418d4fcb5897 Mon Sep 17 00:00:00 2001 From: Francois Pons Date: Mon, 20 Dec 1999 16:47:41 +0000 Subject: *** empty log message *** --- perl-install/install_any.pm | 39 +++++++++++++++++++++++++++++++-------- perl-install/install_steps.pm | 31 ++++++++++++------------------- perl-install/pkgs.pm | 14 +++++++++----- 3 files changed, 52 insertions(+), 32 deletions(-) diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm index 39ee33259..2479686fd 100644 --- a/perl-install/install_any.pm +++ b/perl-install/install_any.pm @@ -525,7 +525,7 @@ sub list_passwd() { } sub list_home() { - map { $_->[7] } grep { $_->[2] >= 501 } list_passwd(); + map { $_->[7] } grep { $_->[2] >= 500 } list_passwd(); } sub template2userfile($$$$%) { @@ -545,23 +545,23 @@ sub update_userkderc($$$) { foreach ("/etc/skel", "/root", list_home()) { my ($inputfile, $outputfile) = ("$prefix$_/.kderc", "$prefix$_/.kderc.new"); - my %subst = %$subst; + my %tosubst = (%$subst); local *INFILE; local *OUTFILE; open INFILE, $inputfile or return; open OUTFILE, ">$outputfile" or return; print OUTFILE map { if (my $i = /^\s*\[$cat\]/i ... /^\s*\[/) { - if (/^\s*(\w*)=/ && $subst{lc($1)}) { - delete $subst{lc($1)}; + if (/^\s*(\w*)=/ && $tosubst{lc($1)}) { + delete $tosubst{lc($1)}; } else { - ($i > 1 && /^\s*\[/ && join '', values %subst). $_; + ($i > 1 && /^\s*\[/ && join '', values %tosubst). $_; } } else { $_; } } ; - print OUTFILE "[$cat]\n", values %subst if values %subst; #- if categorie has not been found above. + print OUTFILE "[$cat]\n", values %tosubst if values %tosubst; #- if categorie has not been found above. unlink $inputfile; rename $outputfile, $inputfile; @@ -582,9 +582,9 @@ sub kderc_largedisplay($) { sub kdelang_postinstall($) { my ($prefix) = @_; my %i18n = getVarsFromSh("$prefix/etc/sysconfig/i18n"); - my $lang = $i18n{LANG} eq 'se' ? 'sv' : $i18n{LANG}; - update_userkderc($prefix, 'Locale', { language => "Language=$lang\n" }); + #- remove existing reference to $lang. + update_userkderc($prefix, 'Locale', { language => "Language=\n" }); } sub kdeicons_postinstall($) { @@ -630,4 +630,27 @@ sub kdeicons_postinstall($) { } } +sub move_desktop_file($) { + my ($prefix) = @_; + my @toMove = qw(doc.kdelnk news.kdelnk updates.kdelnk home.kdelnk printer.kdelnk floppy.kdelnk cdrom.kdelnk); + + foreach ("/etc/skel", "/root", list_home()) { + my $dir = "$prefix$_"; + if (-d "$dir/Desktop") { + my @toSubst = glob_("$dir/Desktop/.*\.rpmorig"); + + push @toSubst, "$dir/Desktop/$_" foreach @toMove; + + #- remove any existing save in Trash of each user and + #- move appropriate file there after an upgrade. + foreach (@toSubst) { + my $basename = basename($_); + + unlink "$dir/Desktop/Trash/$basename"; + rename $_, "$dir/Desktop/Trash/$basename"; + } + } + } +} + 1; diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm index d3a536ea1..1c0564ba9 100644 --- a/perl-install/install_steps.pm +++ b/perl-install/install_steps.pm @@ -189,24 +189,6 @@ sub beforeInstallPackages { pkgs::init_db($o->{prefix}, $o->{isUpgrade}); } -sub beforeRemoveOtherPackages($) { - my ($prefix) = @_; - - #- hack to save some files that may be removed during installation of other packages. - do { - unlink "$prefix/$_.mdkgisave"; rename "$prefix/$_", "$prefix/$_.mdkgisave"; - } foreach qw(/etc/passwd); -} - -sub afterRemoveOtherPackages($) { - my ($prefix) = @_; - - #- hack to restore what have been saved before removing other packages. - do { - unlink "$prefix/$_"; rename "$prefix/$_.mdkgisave", "$prefix/$_"; - } foreach qw(/etc/passwd); -} - sub installPackages($$) { my ($o, $packages) = @_; @@ -216,7 +198,7 @@ sub installPackages($$) { #- important files and restore them after. foreach (@{$o->{toSave} || []}) { if (-e "$o->{prefix}/$_") { - unlink "$o->{prefix}/$_.mdkgisave"; rename "$o->{prefix}/$_", "$o->{prefix}/$_.mdkgisave"; + unlink "$o->{prefix}/$_.mdkgisave"; eval { commands::cp("$o->{prefix}/$_", "$o->{prefix}/$_.mdkgisave") }; } } pkgs::remove($o->{prefix}, $o->{toRemove}); @@ -226,6 +208,11 @@ sub installPackages($$) { } } $o->{toSave} = []; + + #- hack for compat-glibc to upgrade properly :-( + if ($packages->{'compat-glibc'}{selected}) { + rename "$o->{prefix}/usr/i386-glibc20-linux", "$o->{prefix}/usr/i386-glibc20-linux.mdkgisave"; + } } #- hack to ensure proper ordering for installation of packages. @@ -278,6 +265,12 @@ sub afterInstallPackages($) { install_any::kdeicons_postinstall($o->{prefix}); run_program::rooted($o->{prefix}, "kdeDesktopCleanup"); + + #- move some file after an upgrade that may be seriously annoying. + if ($o->{isUpgrade}) { + log::l("moving previous desktop files that have been updated to \$HOME/tmp of each user"); + install_any::move_desktop_file($o->{prefix}); + } } #------------------------------------------------------------------------------ diff --git a/perl-install/pkgs.pm b/perl-install/pkgs.pm index a50f8a54e..8bfa04dd5 100644 --- a/perl-install/pkgs.pm +++ b/perl-install/pkgs.pm @@ -499,11 +499,15 @@ sub selectPackagesToUpgrade($$$;$$) { c::headerGetEntry($header, 'version'). '-' . c::headerGetEntry($header, 'release')); if ($toRemove{$otherPackage}) { - my @files = c::headerGetEntry($header, 'filenames'); - my @flags = c::headerGetEntry($header, 'fileflags'); - for my $i (0..$#flags) { - if ($flags[$i] & c::RPMFILE_CONFIG()) { - push @$toSave, $files[$i]; + if ($otherPackage =~ /^libtermcap/) { + delete $toRemove{$otherPackage}; #- keep it selected, but force upgrade. + } else { + my @files = c::headerGetEntry($header, 'filenames'); + my @flags = c::headerGetEntry($header, 'fileflags'); + for my $i (0..$#flags) { + if ($flags[$i] & c::RPMFILE_CONFIG()) { + push @$toSave, $files[$i] unless $files[$i] =~ /kdelnk/; #- avoid doublons for KDE. + } } } } -- cgit v1.2.1