summaryrefslogtreecommitdiffstats
path: root/perl-install/fs
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2004-08-02 08:01:14 +0000
committerPascal Rigaux <pixel@mandriva.com>2004-08-02 08:01:14 +0000
commit137cba98aa58448cc48aac6ab5d7179d048cbcf0 (patch)
tree8d6bf773742bad9c63d5d7790077f56e2b92e2b2 /perl-install/fs
parentaeb208e3f9deeb5f8cb8c5a112510dcdf05900fc (diff)
downloaddrakx-137cba98aa58448cc48aac6ab5d7179d048cbcf0.tar
drakx-137cba98aa58448cc48aac6ab5d7179d048cbcf0.tar.gz
drakx-137cba98aa58448cc48aac6ab5d7179d048cbcf0.tar.bz2
drakx-137cba98aa58448cc48aac6ab5d7179d048cbcf0.tar.xz
drakx-137cba98aa58448cc48aac6ab5d7179d048cbcf0.zip
- move package_needed_for_partition_type() from fsedit to fs::format
- create check_package_is_installed() in fs::format and use it
Diffstat (limited to 'perl-install/fs')
-rw-r--r--perl-install/fs/format.pm35
1 files changed, 24 insertions, 11 deletions
diff --git a/perl-install/fs/format.pm b/perl-install/fs/format.pm
index d41a98ccc..fb948b6b5 100644
--- a/perl-install/fs/format.pm
+++ b/perl-install/fs/format.pm
@@ -9,17 +9,30 @@ use fs::type;
use log;
my %cmds = (
- ext2 => 'mke2fs -F',
- ext3 => 'mke2fs -F -j',
- reiserfs => 'mkreiserfs -ff',
- xfs => 'mkfs.xfs -f -q',
- jfs => 'mkfs.jfs -f',
- hfs => 'hformat',
- dos => 'mkdosfs',
- vfat => 'mkdosfs -F 32',
- swap => 'mkswap',
+ ext2 => [ 'e2fsprogs', 'mke2fs', '-F' ],
+ ext3 => [ 'e2fsprogs', 'mke2fs', '-F', '-j' ],
+ reiserfs => [ 'reiserfsprogs', 'mkreiserfs', '-ff' ],
+ xfs => [ 'xfsprogs', 'mkfs.xfs', '-f', '-q' ],
+ jfs => [ 'jfsprogs', 'mkfs.jfs', '-f' ],
+ hfs => [ 'hfsutils', 'hformat' ],
+ dos => [ 'dosfstools', 'mkdosfs' ],
+ vfat => [ 'dosfstools', 'mkdosfs', '-F', '32' ],
+ swap => [ 'util-linux', 'mkswap' ],
);
+sub package_needed_for_partition_type {
+ my ($part) = @_;
+ my $l = $cmds{$part->{fs_type}} or return;
+ $l->[0];
+}
+
+sub check_package_is_installed {
+ my ($do_pkgs, $fs_type) = @_;
+
+ my ($pkg, $binary) = @{$cmds{$fs_type} || return};
+ $do_pkgs->ensure_binary_is_installed($pkg, $binary);
+}
+
sub part {
my ($raids, $part, $prefix, $wait_message) = @_;
if (isRAID($part)) {
@@ -61,9 +74,9 @@ sub part_raw {
push @options, '-l', 'bootstrap';
}
- my $cmd = $cmds{$fs_type} or die N("I don't know how to format %s in type %s", $part->{device}, $part->{fs_type});
+ my ($pkg, $cmd, @first_options) = @{$cmds{$fs_type} || die N("I don't know how to format %s in type %s", $part->{device}, $part->{fs_type})};
- run_program::raw({ timeout => 60 * 60 }, split(' ', $cmd), @options, devices::make($dev)) or die N("%s formatting of %s failed", $fs_type, $dev);
+ run_program::raw({ timeout => 60 * 60 }, $cmd, @first_options, @options, devices::make($dev)) or die N("%s formatting of %s failed", $fs_type, $dev);
if ($fs_type eq 'ext3') {
disable_forced_fsck($dev);