diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2001-08-20 22:05:05 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2001-08-20 22:05:05 +0000 |
commit | 314859a4872032b07c5d0e57adf3d596049e2fdc (patch) | |
tree | 462d0e3624917538602f4ad456a384ebb8b45edc /perl-install/network | |
parent | b0ca1896edd65eb0a43d6d031ba3b4d2fd0c008f (diff) | |
download | drakx-backup-do-not-use-314859a4872032b07c5d0e57adf3d596049e2fdc.tar drakx-backup-do-not-use-314859a4872032b07c5d0e57adf3d596049e2fdc.tar.gz drakx-backup-do-not-use-314859a4872032b07c5d0e57adf3d596049e2fdc.tar.bz2 drakx-backup-do-not-use-314859a4872032b07c5d0e57adf3d596049e2fdc.tar.xz drakx-backup-do-not-use-314859a4872032b07c5d0e57adf3d596049e2fdc.zip |
basic nfs handling in drakx
Diffstat (limited to 'perl-install/network')
-rw-r--r-- | perl-install/network/nfs.pm | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/perl-install/network/nfs.pm b/perl-install/network/nfs.pm new file mode 100644 index 000000000..8429d1a69 --- /dev/null +++ b/perl-install/network/nfs.pm @@ -0,0 +1,42 @@ +package network::nfs; + +use common; +use network::network; + +sub check { + my ($in) = @_; + + my $f = '/usr/sbin/showmount'; + -e $f or $in->do_pkgs->install('nfs-utils-clients'); + -e $f or $in->ask_warn('', "Mandatory package nfs-utils-clients is missing"), return; + 1; +} + + +sub find_servers() { + local (*F, $_); + my $pid = open F, "rpcinfo-flushed -b mountd 2 |"; + $SIG{ALRM} = sub { kill(15, $pid) }; + alarm 1; + + my $domain = chomp_(`domainname`); + my @servers; + while (<F>) { + chomp; + my ($ip, $name) = /(\S+)\s+(\S+)/ or log::l("bad line in rpcinfo output"), next; + $name =~ s/\Q.$domain//; + $name =~ s/\.$//; + push @servers, { ip => $ip, if_($name ne '(unknown)', name => $name) }; + } + @servers; +} + +sub find_exports { + my ($server) = @_; + + my (undef, @l) = `showmount -e $server->{ip}`; + map { /(\S+)\s*(\S+)/; { name => $1, comment => $2 } } @l; +} + +1; + |