summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2005-06-21 09:45:34 +0000
committerPascal Rigaux <pixel@mandriva.com>2005-06-21 09:45:34 +0000
commitef041447abd94345b3fd90fb8052e9f897d6b31c (patch)
treeb4bf689845b0e2ed5b0de13c7647544f7f434664
parent6ac2d9413cd7d4e81f738d77a0047d1b227e61a0 (diff)
downloaddrakx-backup-do-not-use-ef041447abd94345b3fd90fb8052e9f897d6b31c.tar
drakx-backup-do-not-use-ef041447abd94345b3fd90fb8052e9f897d6b31c.tar.gz
drakx-backup-do-not-use-ef041447abd94345b3fd90fb8052e9f897d6b31c.tar.bz2
drakx-backup-do-not-use-ef041447abd94345b3fd90fb8052e9f897d6b31c.tar.xz
drakx-backup-do-not-use-ef041447abd94345b3fd90fb8052e9f897d6b31c.zip
handle creation of labels for every filesystem types
-rw-r--r--perl-install/fs/format.pm39
1 files changed, 30 insertions, 9 deletions
diff --git a/perl-install/fs/format.pm b/perl-install/fs/format.pm
index 4f0aff353..5eb0683dc 100644
--- a/perl-install/fs/format.pm
+++ b/perl-install/fs/format.pm
@@ -21,6 +21,18 @@ my %cmds = (
swap => [ 'util-linux', 'mkswap' ],
);
+my %LABELs = ( #- option, length, handled_by_mount
+ ext2 => [ '-L', 16, 1 ],
+ ext3 => [ '-L', 16, 1 ],
+ reiserfs => [ '-l', 16, 1 ],
+ xfs => [ '-L', 12, 1 ],
+ jfs => [ '-L', 16, 1 ],
+ hfs => [ '-l', 27, 0 ],
+ dos => [ '-n', 11, 0 ],
+ vfat => [ '-n', 11, 0 ],
+ swap => [ '-L', 15, 1 ],
+);
+
sub package_needed_for_partition_type {
my ($part) = @_;
my $l = $cmds{$part->{fs_type}} or return;
@@ -81,6 +93,24 @@ sub part_raw {
push @options, '-l', 'bootstrap';
}
+ if ($part->{device_LABEL}) {
+ if ($LABELs{$fs_type}) {
+ my ($option, $length, $handled_by_mount) = @{$LABELs{$fs_type}};
+ if (length $part->{device_LABEL} > $length) {
+ my $short = substr($part->{device_LABEL}, 0, $length);
+ log::l("shortening LABEL $part->{device_LABEL} to $short");
+ $part->{device_LABEL} = $short;
+ }
+ delete $part->{prefer_device_LABEL} if !$handled_by_mount;
+
+ push @options, $option, $part->{device_LABEL};
+ } else {
+ log::l("dropping LABEL=$part->{device_LABEL} since we don't know how to set labels for fs_type $part->{fs_type}");
+ delete $part->{device_LABEL};
+ delete $part->{prefer_device_LABEL};
+ }
+ }
+
my ($_pkg, $cmd, @first_options) = @{$cmds{$fs_type} || die N("I do not know how to format %s in type %s", $part->{device}, $part->{fs_type})};
my @args = ($cmd, @first_options, @options, devices::make($dev));
@@ -94,15 +124,6 @@ sub part_raw {
if ($fs_type eq 'ext3') {
disable_forced_fsck($dev);
}
- if ($part->{device_LABEL}) {
- if (member($fs_type, qw(ext2 ext3))) {
- run_program::run("tune2fs", "-L", $part->{device_LABEL}, devices::make($dev));
- } else {
- log::l("dropping LABEL=$part->{device_LABEL} since we don't know how to set labels for fs_type $part->{fs_type}");
- delete $part->{device_LABEL};
- delete $part->{prefer_device_LABEL};
- }
- }
set_isFormatted($part, 1);
}