summaryrefslogtreecommitdiffstats
path: root/rescue/tree
diff options
context:
space:
mode:
authorFrancois Pons <fpons@mandriva.com>2003-09-19 14:35:52 +0000
committerFrancois Pons <fpons@mandriva.com>2003-09-19 14:35:52 +0000
commit193c77916ca7ed3ee10876f4122fce58c7338f89 (patch)
treea88c68bfe9400ac76644d2efb92248631b1afbe6 /rescue/tree
parenta42ff151d31470c441b88c246c5452df5f9ec4a5 (diff)
downloaddrakx-backup-do-not-use-193c77916ca7ed3ee10876f4122fce58c7338f89.tar
drakx-backup-do-not-use-193c77916ca7ed3ee10876f4122fce58c7338f89.tar.gz
drakx-backup-do-not-use-193c77916ca7ed3ee10876f4122fce58c7338f89.tar.bz2
drakx-backup-do-not-use-193c77916ca7ed3ee10876f4122fce58c7338f89.tar.xz
drakx-backup-do-not-use-193c77916ca7ed3ee10876f4122fce58c7338f89.zip
fixed too many files copied.
Diffstat (limited to 'rescue/tree')
-rwxr-xr-xrescue/tree/etc/oem22
-rwxr-xr-xrescue/tree/etc/oem-all22
2 files changed, 24 insertions, 20 deletions
diff --git a/rescue/tree/etc/oem b/rescue/tree/etc/oem
index 8bbbc5663..eb865e342 100755
--- a/rescue/tree/etc/oem
+++ b/rescue/tree/etc/oem
@@ -552,10 +552,11 @@ foreach my $medium (@media) {
foreach (@{$packer->{files}}) {
$packer->{data}{$_}[0] eq 'f' or next;
my ($fullname, $file) = /([^:]*):(.*)/ ? ($1, "$2.rpm") : ($_, "$_.rpm");
- $files{$fullname} = "$medium->{rpmsdir}/$file";
+ $files{$fullname} = $file;
+ $rpms{$fullname} = $medium->{rpmsdir};
#- convert %{ARCH} to effective arch of the given package.
my ($arch) = $fullname =~ /\.([^\.\-]*)$/;
- $files{$fullname} =~ s|%{ARCH}|$arch|g;
+ $rpms{$fullname} =~ s|%{ARCH}|$arch|g;
}
}
@@ -577,17 +578,18 @@ foreach my $medium (@media) {
print "Copying packages from medium labeled \"$medium->{descr}\" to hard disk\n";
foreach my $pkg (@{$packages->{depslist}}) {
$files{rpm_fullname($pkg)} or next;
- my ($arch) = rpm_fullname($pkg) =~ /\.([^\.\-]*)$/;
- $rpmsdir = $medium->{rpmsdir};
- $rpmsdir =~ s|%{ARCH}|$arch|g;
- system "mkdir", "-p", "/hd/$rpmsdir";
- my $file = "/cdrom/" . $files{rpm_fullname($pkg)};
- if (-e $file) {
+ my $infile = "/cdrom/" . $rpms{rpm_fullname($pkg)} . "/" . $files{rpm_fullname($pkg)};
+ my $outfile = "/hd/" . $rpms{rpm_fullname($pkg)} . "/" . $files{rpm_fullname($pkg)};
+ if (-r $infile && -s $infile != -s $outfile) {
+ -d "/hd" . $rpms{rpm_fullname($pkg)} or system "mkdir", "-p", "/hd" . $rpms{rpm_fullname($pkg)};
print " copying " . rpm_fullname($pkg) . "\n";
- system "cp", "-a", $file, "/hd/$rpmsdir";
+ system "cp", "-a", $infile, $outfile;
if (rpm_fullname($pkg) =~ /mandrake-release/) {
- system "rpm", "-Uvh", "--root", "/mnt", "--nodeps", "--force", "/hd/" . $files{rpm_fullname($pkg)};
+ system "rpm", "-Uvh", "--root", "/mnt", "--nodeps", "--force", $outfile;
}
+ #- clean to say everything is done.
+ delete $files{rpm_fullname($pkg)};
+ delete $rpms{rpm_fullname($pkg)};
}
}
}
diff --git a/rescue/tree/etc/oem-all b/rescue/tree/etc/oem-all
index 8bbbc5663..eb865e342 100755
--- a/rescue/tree/etc/oem-all
+++ b/rescue/tree/etc/oem-all
@@ -552,10 +552,11 @@ foreach my $medium (@media) {
foreach (@{$packer->{files}}) {
$packer->{data}{$_}[0] eq 'f' or next;
my ($fullname, $file) = /([^:]*):(.*)/ ? ($1, "$2.rpm") : ($_, "$_.rpm");
- $files{$fullname} = "$medium->{rpmsdir}/$file";
+ $files{$fullname} = $file;
+ $rpms{$fullname} = $medium->{rpmsdir};
#- convert %{ARCH} to effective arch of the given package.
my ($arch) = $fullname =~ /\.([^\.\-]*)$/;
- $files{$fullname} =~ s|%{ARCH}|$arch|g;
+ $rpms{$fullname} =~ s|%{ARCH}|$arch|g;
}
}
@@ -577,17 +578,18 @@ foreach my $medium (@media) {
print "Copying packages from medium labeled \"$medium->{descr}\" to hard disk\n";
foreach my $pkg (@{$packages->{depslist}}) {
$files{rpm_fullname($pkg)} or next;
- my ($arch) = rpm_fullname($pkg) =~ /\.([^\.\-]*)$/;
- $rpmsdir = $medium->{rpmsdir};
- $rpmsdir =~ s|%{ARCH}|$arch|g;
- system "mkdir", "-p", "/hd/$rpmsdir";
- my $file = "/cdrom/" . $files{rpm_fullname($pkg)};
- if (-e $file) {
+ my $infile = "/cdrom/" . $rpms{rpm_fullname($pkg)} . "/" . $files{rpm_fullname($pkg)};
+ my $outfile = "/hd/" . $rpms{rpm_fullname($pkg)} . "/" . $files{rpm_fullname($pkg)};
+ if (-r $infile && -s $infile != -s $outfile) {
+ -d "/hd" . $rpms{rpm_fullname($pkg)} or system "mkdir", "-p", "/hd" . $rpms{rpm_fullname($pkg)};
print " copying " . rpm_fullname($pkg) . "\n";
- system "cp", "-a", $file, "/hd/$rpmsdir";
+ system "cp", "-a", $infile, $outfile;
if (rpm_fullname($pkg) =~ /mandrake-release/) {
- system "rpm", "-Uvh", "--root", "/mnt", "--nodeps", "--force", "/hd/" . $files{rpm_fullname($pkg)};
+ system "rpm", "-Uvh", "--root", "/mnt", "--nodeps", "--force", $outfile;
}
+ #- clean to say everything is done.
+ delete $files{rpm_fullname($pkg)};
+ delete $rpms{rpm_fullname($pkg)};
}
}
}