summaryrefslogtreecommitdiffstats
path: root/globetrotter/make_live
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2005-05-25 08:33:05 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2005-05-25 08:33:05 +0000
commitb028537ef693ebaac6a35a00b156facc8417bce3 (patch)
tree3955a7e554470548a860398aa7416b2f42a536bf /globetrotter/make_live
parent73f989a034d9e7665fcbd50fde720db4bdb18313 (diff)
downloaddrakx-b028537ef693ebaac6a35a00b156facc8417bce3.tar
drakx-b028537ef693ebaac6a35a00b156facc8417bce3.tar.gz
drakx-b028537ef693ebaac6a35a00b156facc8417bce3.tar.bz2
drakx-b028537ef693ebaac6a35a00b156facc8417bce3.tar.xz
drakx-b028537ef693ebaac6a35a00b156facc8417bce3.zip
factorize some code through find_partition()
Diffstat (limited to 'globetrotter/make_live')
-rwxr-xr-xglobetrotter/make_live9
1 files changed, 7 insertions, 2 deletions
diff --git a/globetrotter/make_live b/globetrotter/make_live
index e06960d3f..0eb037741 100755
--- a/globetrotter/make_live
+++ b/globetrotter/make_live
@@ -103,6 +103,11 @@ sub formatdisk {
run_program::get_stdout('service', 'usb', 'start');
}
+sub find_partition {
+ my ($label, @parts) = @_;
+ find { member(fs::type2fs($_), qw(ext2 ext3)) && chomp_(`e2label /dev/$_->{device} 2>/dev/root`) eq $label } @parts;
+}
+
my $pkg_dev;
if ($rescue) {
system("mount -t tmpfs none /tmp");
@@ -116,9 +121,9 @@ if ($rescue) {
my ($all_hds, $hd, $other) = get_hds();
print "Looking for the package partition\n";
my @parts = partition_table::get_normal_parts($hd);
- my $pkg_dev = find { member(fs::type2fs($_), qw(ext2 ext3)) && chomp_(`e2label /dev/$_->{device} 2>/dev/root`) eq "MDK-PKGS" } @parts;
+ $pkg_dev = find_partition("MDK-PKGS", @parts);
die "I cannot find the package partition which is needed in order to restore the system!" if is_empty_hash_ref($pkg_dev) || !$pkg_dev->{device};
- my $root = find { member(fs::type2fs($_), qw(ext2 ext3)) && chomp_(`e2label /dev/$_->{device} 2>/dev/root`) eq "MDK-ROOT" } @parts;
+ my $root = find_partition("MDK-ROOT", @parts);
$root = find { $_->{device} eq "sda1" } @parts if is_empty_hash_ref($root);
die "I cannot find any hard disk to restore!" if is_empty_hash_ref($root) || !$root->{device};
print "Please wait, disk reinstallation is in progress, this can take quite some time\n";