summaryrefslogtreecommitdiffstats
path: root/perl-install/network/smb.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2002-02-14 20:39:15 +0000
committerPascal Rigaux <pixel@mandriva.com>2002-02-14 20:39:15 +0000
commit8cb17de0ec7ac28ca28562c5a5475594b5e5ba9b (patch)
treebf3b8bec65d6e3b16ea822aab9a01a470f90b97b /perl-install/network/smb.pm
parent036bfccc67f49edf02b6fdb0153036ebe0353989 (diff)
downloaddrakx-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/smb.pm')
-rw-r--r--perl-install/network/smb.pm42
1 files changed, 25 insertions, 17 deletions
diff --git a/perl-install/network/smb.pm b/perl-install/network/smb.pm
index 1e141fe48..0061f94b2 100644
--- a/perl-install/network/smb.pm
+++ b/perl-install/network/smb.pm
@@ -1,26 +1,34 @@
-package network::smb;
+package network::smb; # $Id$
+
+use strict;
+use diagnostics;
use common;
use network::network;
+use network::smbnfs;
-sub check {
- my ($in) = @_;
+our @ISA = 'network::smbnfs';
- my $pkg = 'samba-client';
- my $f = '/usr/bin/nmblookup';
- 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, 'samba-client', '/usr/bin/nmblookup');
}
-sub find_servers() {
+sub find_servers {
my (undef, @l) = `nmblookup "*"`;
s/\s.*\n// foreach @l;
my @servers = grep { network::network::is_ip($_) } @l;
@@ -41,7 +49,7 @@ sub find_servers() {
}
sub find_exports {
- my ($server) = @_;
+ my ($class, $server) = @_;
my @l;
my $name = $server->{name} || $server->{ip};
my $ip = $server->{ip} ? "-I $server->{ip}" : '';
@@ -55,7 +63,7 @@ sub find_exports {
s/^\t//;
my ($name, $type, $comment) = unpack "A15 A10 A*", $_;
if ($name eq '---------' && $type eq '----' && $comment eq '-------' .. /^$/) {
- push @l, { name => $name, type => $type, comment => $comment }
+ push @l, { name => $name, type => $type, comment => $comment, server => $server }
if $type eq 'Disk' && $name !~ /\$$/;
}
}