summaryrefslogtreecommitdiffstats
path: root/perl-install/fs/format.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2005-06-28 09:12:16 +0000
committerPascal Rigaux <pixel@mandriva.com>2005-06-28 09:12:16 +0000
commitf1323d79cc7dd3aa5f4ebde2e2744d7a7ad56180 (patch)
treec6a37cc1eadd4c1af23c7cda7924d1b42f500344 /perl-install/fs/format.pm
parent48dc83bc2acf770ec4be3e4be5f74a9d49120f65 (diff)
downloaddrakx-backup-do-not-use-f1323d79cc7dd3aa5f4ebde2e2744d7a7ad56180.tar
drakx-backup-do-not-use-f1323d79cc7dd3aa5f4ebde2e2744d7a7ad56180.tar.gz
drakx-backup-do-not-use-f1323d79cc7dd3aa5f4ebde2e2744d7a7ad56180.tar.bz2
drakx-backup-do-not-use-f1323d79cc7dd3aa5f4ebde2e2744d7a7ad56180.tar.xz
drakx-backup-do-not-use-f1323d79cc7dd3aa5f4ebde2e2744d7a7ad56180.zip
try to cleanup fs.pm
(to have simpler dependencies between modules, esp. have some modules only required by diskdrake): - move some functions from fs to fs::mount (most keep their name, except mount_part and mount_usbfs) - move formatMount_part and formatMount_all from fs to fs::format - move some functions from fs to fs::wild_device (part2wild_device_name -> fs::wild_device::from_part) (subpart_from_wild_device_name -> fs::wild_device::to_subpart) (analyze_wild_device_name -> fs::wild_device::analyse) - formatMount_part(), formatMount_all(), fs::mount::part() don't take a prefix anymore the current situation was quite muddy we now rely on fs::get::mntpoint_prefixed() which will maybe depend on a field in $part for now, we mount every part in chroot, it seems to be what's wanted - fs::format::part() now expect $all_hds instead of $raids - fs::type::carryRootLoopback is now fs::get::carry_root_loopback() - in fs::loopback, most functions don't want a prefix anymore
Diffstat (limited to 'perl-install/fs/format.pm')
-rw-r--r--perl-install/fs/format.pm42
1 files changed, 37 insertions, 5 deletions
diff --git a/perl-install/fs/format.pm b/perl-install/fs/format.pm
index 3238df33c..93882788f 100644
--- a/perl-install/fs/format.pm
+++ b/perl-install/fs/format.pm
@@ -52,14 +52,14 @@ sub check_package_is_installed {
}
sub part {
- my ($raids, $part, $prefix, $wait_message) = @_;
+ my ($all_hds, $part, $wait_message) = @_;
if (isRAID($part)) {
$wait_message->(N("Formatting partition %s", $part->{device})) if $wait_message;
require raid;
- raid::format_part($raids, $part);
+ raid::format_part($all_hds->{raids}, $part);
} elsif (isLoopback($part)) {
$wait_message->(N("Creating and formatting file %s", $part->{loopback_file})) if $wait_message;
- fs::loopback::format_part($part, $prefix);
+ fs::loopback::format_part($part);
} else {
$wait_message->(N("Formatting partition %s", $part->{device})) if $wait_message;
part_raw($part, $wait_message);
@@ -72,8 +72,7 @@ sub part_raw {
$part->{isFormatted} and return;
if ($part->{encrypt_key}) {
- require fs;
- fs::set_loop($part);
+ fs::mount::set_loop($part);
}
my $dev = $part->{real_device} || $part->{device};
@@ -179,4 +178,37 @@ sub wait_message {
};
}
+
+sub formatMount_part {
+ my ($part, $all_hds, $fstab, $wait_message) = @_;
+
+ if (isLoopback($part)) {
+ formatMount_part($part->{loopback_device}, $all_hds, $fstab, $wait_message);
+ }
+ if (my $p = fs::get::up_mount_point($part->{mntpoint}, $fstab)) {
+ formatMount_part($p, $all_hds, $fstab, $wait_message) if !fs::type::carry_root_loopback($part);
+ }
+ if ($part->{toFormat}) {
+ fs::format::part($all_hds, $part, $wait_message);
+ }
+ fs::mount::part($part, 0, $wait_message);
+}
+
+sub formatMount_all {
+ my ($all_hds, $fstab, $wait_message) = @_;
+ formatMount_part($_, $all_hds, $fstab, $wait_message)
+ foreach sort { isLoopback($a) ? 1 : isSwap($a) ? -1 : 0 } grep { $_->{mntpoint} } @$fstab;
+
+ #- ensure the link is there
+ fs::loopback::carryRootCreateSymlink($_) foreach @$fstab;
+
+ #- for fun :)
+ #- that way, when install exits via ctrl-c, it gives hand to partition
+ eval {
+ my ($_type, $major, $minor) = devices::entry(fs::get::root($fstab)->{device});
+ output "/proc/sys/kernel/real-root-dev", makedev($major, $minor);
+ };
+}
+
+
1;