blob: 39d8d3337b694dfdc84fd5565ac70e6e64d6f1ff (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#!/usr/bin/perl
use lib qw(/usr/lib/libDrakX);
use standalone;
use fs::remote::nfs;
use fs::remote::smb;
use MDK::Common::Func qw(if_);
#use interactive; # if we'd want lsnetdrake to install missing pkgs
"@ARGV" =~ /-h/ and die "usage: lsnetdrake [-h] [--nfs] [--smb]\n";
my $nfs = !@ARGV || "@ARGV" =~ /-(nfs)/;
my $smb = !@ARGV || "@ARGV" =~ /-(smb)/;
$| = 1;
$ENV{PATH} = "/sbin:/usr/sbin:$ENV{PATH}";
foreach my $class (if_($nfs, fs::remote::nfs->new), if_($smb, fs::remote::smb->new)) {
#$class->check(interactive->vnew) if -t *STDIN && -t *STDOUT; # Only if tty. TO DO IN INTERACTIVE-vnew instead?t
foreach my $server (sort_names(eval { $class->find_servers })) {
foreach (sort_names(eval { $class->find_exports($server) })) {
print $class->to_fullstring($_), "\n";
}
}
}
sub sort_names {
sort { $a->{name} cmp $b->{name} } @_;
}
|