diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2002-02-14 20:39:15 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2002-02-14 20:39:15 +0000 |
commit | 8cb17de0ec7ac28ca28562c5a5475594b5e5ba9b (patch) | |
tree | bf3b8bec65d6e3b16ea822aab9a01a470f90b97b /perl-install/network/nfs.pm | |
parent | 036bfccc67f49edf02b6fdb0153036ebe0353989 (diff) | |
download | drakx-8cb17de0ec7ac28ca28562c5a5475594b5e5ba9b.tar drakx-8cb17de0ec7ac28ca28562c5a5475594b5e5ba9b.tar.gz drakx-8cb17de0ec7ac28ca28562c5a5475594b5e5ba9b.tar.bz2 drakx-8cb17de0ec7ac28ca28562c5a5475594b5e5ba9b.tar.xz drakx-8cb17de0ec7ac28ca28562c5a5475594b5e5ba9b.zip |
cleaner & OOed code, with more code sharing
Diffstat (limited to 'perl-install/network/nfs.pm')
-rw-r--r-- | perl-install/network/nfs.pm | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/perl-install/network/nfs.pm b/perl-install/network/nfs.pm index 859e1e63d..6c9a02b6b 100644 --- a/perl-install/network/nfs.pm +++ b/perl-install/network/nfs.pm @@ -1,27 +1,34 @@ -package network::nfs; +package network::nfs; # $Id$ + +use strict; +use diagnostics; use common; use network::network; +use network::smbnfs; use log; -sub check { - my ($in) = @_; +our @ISA = 'network::smbnfs'; - my $pkg = 'nfs-utils-clients'; - my $f = '/usr/sbin/showmount'; - if (! -e $f) { - $in->ask_okcancel('', _("The package %s needs to be installed. Do you want to install it?", $pkg), 1) or return; - $in->do_pkgs->install($pkg); - } - if (! -e $f) { - $in->ask_warn('', _("Mandatory package %s is missing", $pkg)); - return; - } - 1; +sub to_fstab_entry { + my ($class, $e) = @_; + $class->to_fstab_entry_raw($e, 'nfs'); +} +sub from_dev { + my ($class, $dev) = @_; + $dev =~ m|(.*?):(.*)|; +} +sub to_dev_raw { + my ($class, $server, $name) = @_; + $server . ':' . $name; } +sub check { + my ($class, $in) = @_; + $class->raw_check($in, 'nfs-utils-clients', '/usr/sbin/showmount'); +} -sub find_servers() { +sub find_servers { local *F; my $pid = open F, "rpcinfo-flushed -b mountd 2 |"; $SIG{ALRM} = sub { kill(15, $pid) }; @@ -40,7 +47,7 @@ sub find_servers() { } sub find_exports { - my ($server) = @_; + my ($class, $server) = @_; local *F; my $s = $server->{ip} || $server->{name}; @@ -49,8 +56,7 @@ sub find_exports { alarm 5; my (undef, @l) = <F>; - map { /(\S+)\s*(\S+)/; { name => $1, comment => $2 } } @l; + map { /(\S+)\s*(\S+)/; { name => $1, comment => $2, server => $server } } @l; } 1; - |