From 75bf8c28e750faa0beec21b63ea6990cd9a70bc6 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Thu, 21 Feb 2002 10:31:45 +0000 Subject: nicer conditional displaying of nfs comment --- perl-install/network/nfs.pm | 4 ++++ perl-install/network/smbnfs.pm | 10 ++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'perl-install/network') diff --git a/perl-install/network/nfs.pm b/perl-install/network/nfs.pm index 6c9a02b6b..58b2dab28 100644 --- a/perl-install/network/nfs.pm +++ b/perl-install/network/nfs.pm @@ -14,6 +14,10 @@ sub to_fstab_entry { my ($class, $e) = @_; $class->to_fstab_entry_raw($e, 'nfs'); } +sub comment_to_string { + my ($class, $comment) = @_; + member($comment, qw(* 0.0.0.0/0.0.0.0 (everyone))) ? '' : $comment; +} sub from_dev { my ($class, $dev) = @_; $dev =~ m|(.*?):(.*)|; diff --git a/perl-install/network/smbnfs.pm b/perl-install/network/smbnfs.pm index 1958ce167..d380aac0f 100644 --- a/perl-install/network/smbnfs.pm +++ b/perl-install/network/smbnfs.pm @@ -13,18 +13,24 @@ sub server_to_string { my ($class, $server) = @_; $server->{name} || $server->{ip}; } +sub comment_to_string { + my ($class, $comment) = @_; + $comment; +} sub to_dev { my ($class, $e) = @_; $class->to_dev_raw($class->server_to_string($e->{server}), $e->{name} || $e->{ip}); } sub to_string { my ($class, $e) = @_; - ($e->{name} || $e->{ip}) . ($e->{comment} ? " ($e->{comment})" : ''); + my $comment = $class->comment_to_string($e->{comment}); + ($e->{name} || $e->{ip}) . ($comment ? " ($comment)" : ''); } sub to_fullstring { my ($class, $e) = @_; - $class->to_dev($e) . ($e->{comment} ? " ($e->{comment})" : ''); + my $comment = $class->comment_to_string($e->{comment}); + $class->to_dev($e) . ($comment ? " ($comment)" : ''); } sub to_fstab_entry_raw { my ($class, $e, $type) = @_; -- cgit v1.2.1