summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/common.pm3
-rw-r--r--perl-install/install_any.pm4
-rw-r--r--perl-install/install_steps.pm11
3 files changed, 8 insertions, 10 deletions
diff --git a/perl-install/common.pm b/perl-install/common.pm
index 043c30de6..9fa9e620a 100644
--- a/perl-install/common.pm
+++ b/perl-install/common.pm
@@ -8,7 +8,7 @@ use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK $printable_chars $sizeof_int $bitof_int
%EXPORT_TAGS = (
common => [ qw(__ may_apply even odd arch better_arch compat_arch min max sqr sum and_ or_ if_ if__ sign product bool invbool listlength bool2text bool2yesno text2bool to_int to_float ikeys member divide is_empty_array_ref is_empty_hash_ref add2hash add2hash_ put_in_hash set_new set_add round round_up round_down first second top uniq translate untranslate warp_text formatAlaTeX formatLines deref next_val_in_array) ],
functional => [ qw(fold_left compose mapgrep map_index grep_index find_index map_each grep_each list2kv map_tab_hash mapn mapn_ difference2 before_leaving catch_cdie cdie combine) ],
- file => [ qw(dirname basename touch all glob_ cat_ cat__ output symlinkf chop_ mode typeFromMagic expand_symlinks) ],
+ file => [ qw(dirname basename touch all glob_ cat_ cat__ output symlinkf renamef chop_ mode typeFromMagic expand_symlinks) ],
system => [ qw(sync makedev unmakedev psizeof strcpy gettimeofday syscall_ salt getVarsFromSh setVarsInSh setVarsInShMode setVarsInCsh substInFile availableMemory availableRamMB removeXiBSuffix formatXiB template2file template2userfile update_userkderc list_skels formatTime formatTimeRaw unix2dos setVirtual isCdNotEjectable) ],
constant => [ qw($printable_chars $sizeof_int $bitof_int $SECTORSIZE %compat_arch) ],
);
@@ -94,6 +94,7 @@ sub output { my $f = shift; local *F; open F, ">$f" or die "output in file $f fa
sub deref { ref $_[0] eq "ARRAY" ? @{$_[0]} : ref $_[0] eq "HASH" ? %{$_[0]} : $_[0] }
sub linkf { unlink $_[1]; link $_[0], $_[1] }
sub symlinkf { unlink $_[1]; symlink $_[0], $_[1] }
+sub renamef { unlink $_[1]; rename $_[0], $_[1] }
sub chop_ { map { my $l = $_; chomp $l; $l } @_ }
sub divide { my $d = int $_[0] / $_[1]; wantarray ? ($d, $_[0] % $_[1]) : $d }
sub round { int ($_[0] + 0.5) }
diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm
index 041df95b9..f5f77a3d1 100644
--- a/perl-install/install_any.pm
+++ b/perl-install/install_any.pm
@@ -518,8 +518,8 @@ sub kdemove_desktop_file {
#- remove any existing save in Trash of each user and
#- move appropriate file there after an upgrade.
foreach my $dir (grep { -d $_ } list_skels($prefix, 'Desktop')) {
- unlink("$dir/Trash/$_") && rename("$dir/$_", "$dir/Trash/$_")
- foreach grep { -e "$dir/$_" } @toMove, grep { /\.rpmorig$/ } all($dir)
+ renamef("$dir/$_", "$dir/Trash/$_")
+ foreach grep { -e "$dir/$_" } @toMove, grep { /\.rpmorig$/ } all($dir)
}
}
diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm
index 598cada9c..06137b3cb 100644
--- a/perl-install/install_steps.pm
+++ b/perl-install/install_steps.pm
@@ -343,15 +343,13 @@ sub installPackages($$) { #- complete REWORK, TODO and TOCHECK!
#- important files and restore them after.
foreach (@{$o->{toSave} || []}) {
if (-e "$o->{prefix}/$_") {
- unlink "$o->{prefix}/$_.mdkgisave";
- eval { commands::cp("$o->{prefix}/$_", "$o->{prefix}/$_.mdkgisave") };
+ eval { commands::cp("-f", "$o->{prefix}/$_", "$o->{prefix}/$_.mdkgisave") };
}
}
pkgs::remove($o->{prefix}, $o->{toRemove});
foreach (@{$o->{toSave} || []}) {
if (-e "$o->{prefix}/$_.mdkgisave") {
- unlink "$o->{prefix}/$_";
- rename "$o->{prefix}/$_.mdkgisave", "$o->{prefix}/$_";
+ renamef("$o->{prefix}/$_.mdkgisave", "$o->{prefix}/$_");
}
}
$o->{toSave} = [];
@@ -480,9 +478,8 @@ GridHeight=70
install_any::kdemove_desktop_file($o->{prefix});
foreach (@filesToSaveForUpgrade) {
- if (-e "$o->{prefix}$_.mdkgisave") {
- unlink "$o->{prefix}$_.mdkgiorig"; rename "$o->{prefix}/$_.mdkgisave", "$o->{prefix}/$_.mdkgiorig";
- }
+ renamef("$o->{prefix}/$_.mdkgisave", "$o->{prefix}/$_.mdkgiorig")
+ if -e "$o->{prefix}$_.mdkgisave";
}
}
}