summaryrefslogtreecommitdiffstats
path: root/rescue
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2005-04-27 11:38:49 +0000
committerPascal Rigaux <pixel@mandriva.com>2005-04-27 11:38:49 +0000
commitf164ac0eb8d9fc0e3d2823f31a2cc3112c8bfaee (patch)
tree4a1dd8748df26176100d1baef15f8af48809da8c /rescue
parent345014ed5ecf0274fca9bd90c745a4546ffbd27a (diff)
downloaddrakx-f164ac0eb8d9fc0e3d2823f31a2cc3112c8bfaee.tar
drakx-f164ac0eb8d9fc0e3d2823f31a2cc3112c8bfaee.tar.gz
drakx-f164ac0eb8d9fc0e3d2823f31a2cc3112c8bfaee.tar.bz2
drakx-f164ac0eb8d9fc0e3d2823f31a2cc3112c8bfaee.tar.xz
drakx-f164ac0eb8d9fc0e3d2823f31a2cc3112c8bfaee.zip
ensure we use the same geometry as used when saving
Diffstat (limited to 'rescue')
-rwxr-xr-xrescue/partimage_whole_disk13
1 files changed, 8 insertions, 5 deletions
diff --git a/rescue/partimage_whole_disk b/rescue/partimage_whole_disk
index 309883d36..42fd9796a 100755
--- a/rescue/partimage_whole_disk
+++ b/rescue/partimage_whole_disk
@@ -45,10 +45,10 @@ sub save_all() {
'save', devices::make($_->{device}), "$dir/$_->{device}");
}
}
- save_part_list($part_list);
+ save_part_list($hd->{geom}, $part_list);
}
sub rest_all() {
- my $part_list = read_part_list();
+ my ($forced_geom, $part_list) = read_part_list();
fs::type::set_fs_type($_, $_->{fs_type}) foreach @$part_list;
my @used_hds;
@@ -79,7 +79,7 @@ sub rest_all() {
}
foreach my $hd (uniq(@used_hds)) {
-# put_in_hash($hd->{geom}, { heads => 240, sectors => 63 });
+ put_in_hash($hd->{geom}, $forced_geom);
#- write the partition table
partition_table::raw::zero_MBR($hd);
@@ -117,19 +117,22 @@ sub rest_all() {
sub lst_fields() { qw(device size fs_type saved) }
sub save_part_list {
- my ($part_list) = @_;
+ my ($geom, $part_list) = @_;
my @l = map { join(' ', @$_{lst_fields()}) } @$part_list;
log::l("save_part_list: $_") foreach @l;
my $partimage = join(' ', @partimage_cmd);
open(my $F, "| $partimage -z0 -Bfoo=bar -o save_file $dir/lst");
+ print $F join("/", $geom->{heads}, $geom->{sectors}), "\n";
print $F "$_\n" foreach @l;
}
sub read_part_list() {
my $partimage = join(' ', @partimage_cmd);
open(my $F, "$partimage -z0 -Bfoo=bar rest_file $dir/lst |");
+ my $geom_string = <$F>;
+ my %geom; @geom{'heads', 'sectors'} = split('/', chomp_($geom_string));
my @l = chomp_(cat__($F));
log::l("read_part_list: $_") foreach @l;
- [ map { my %l; @l{lst_fields()} = split; \%l } @l ];
+ \%geom, [ map { my %l; @l{lst_fields()} = split; \%l } @l ];
}
sub run_or_die {