diff options
Diffstat (limited to 'perl-install/fs')
-rw-r--r-- | perl-install/fs/format.pm | 35 |
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); |