diff options
author | Thierry Vignaud <tv@mageia.org> | 2012-01-20 19:12:12 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mageia.org> | 2012-01-20 19:12:12 +0000 |
commit | 892cfc13886c4493895c6ba074da64950961a3ba (patch) | |
tree | c84eec00048b03e5ccb642f4b306ed70113ab399 | |
parent | b29be28e78780c5627e7f1ee5179cd4c0fc99800 (diff) | |
download | drakx-892cfc13886c4493895c6ba074da64950961a3ba.tar drakx-892cfc13886c4493895c6ba074da64950961a3ba.tar.gz drakx-892cfc13886c4493895c6ba074da64950961a3ba.tar.bz2 drakx-892cfc13886c4493895c6ba074da64950961a3ba.tar.xz drakx-892cfc13886c4493895c6ba074da64950961a3ba.zip |
(suggest_lv_name_from_mnt_point, suggest_lv_name) suggest better LV
names based on the mount point rather than numbers
-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); } |