From 892cfc13886c4493895c6ba074da64950961a3ba Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Fri, 20 Jan 2012 19:12:12 +0000 Subject: (suggest_lv_name_from_mnt_point, suggest_lv_name) suggest better LV names based on the mount point rather than numbers --- perl-install/NEWS | 1 + perl-install/install/NEWS | 1 + perl-install/lvm.pm | 10 ++++++++++ 3 files changed, 12 insertions(+) (limited to 'perl-install') 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); } -- cgit v1.2.1