diff options
-rw-r--r-- | perl-install/NEWS | 1 | ||||
-rw-r--r-- | perl-install/install/NEWS | 1 | ||||
-rw-r--r-- | perl-install/lvm.pm | 10 |
3 files changed, 12 insertions, 0 deletions
diff --git a/perl-install/NEWS b/perl-install/NEWS index ea7eae76c..d657872f7 100644 --- a/perl-install/NEWS +++ b/perl-install/NEWS @@ -1,5 +1,6 @@ - diskdrake: o enable to set LV names when not in expert mode + o suggest better LV names based on the mount point rather than numbers Version 13.74 - 24 December 2011 diff --git a/perl-install/install/NEWS b/perl-install/install/NEWS index 07ae7d403..48d9da05d 100644 --- a/perl-install/install/NEWS +++ b/perl-install/install/NEWS @@ -1,6 +1,7 @@ - include gtk20 translations (caps lock & the like) - diskdrake: o enable to set LV names when not in expert mode + o suggest better LV names based on the mount point rather than numbers Version 13.75.1 - 19 January 2012 diff --git a/perl-install/lvm.pm b/perl-install/lvm.pm index a8837c91a..3a2667191 100644 --- a/perl-install/lvm.pm +++ b/perl-install/lvm.pm @@ -169,9 +169,19 @@ sub lv_delete { @$list = grep { $_ != $lv } @$list; } +sub suggest_lv_name_from_mnt_point { + my ($lv) = @_; + my $str = $lv->{mntpoint}; + $str = "root" if $str eq '/'; + $str =~ s!^/!!; + $str =~ s!/!_!g; + $str; +} + sub suggest_lv_name { my ($lvm, $lv) = @_; my $list = $lvm->{primary}{normal} ||= []; + $lv->{lv_name} ||= suggest_lv_name_from_mnt_point($lv); $lv->{lv_name} ||= 1 + max(map { if_($_->{device} =~ /(\d+)$/, $1) } @$list); } |