summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2001-09-12 21:06:29 +0000
committerPascal Rigaux <pixel@mandriva.com>2001-09-12 21:06:29 +0000
commite5e3c360129d86ba13d7f9eb582de7a8caa914be (patch)
tree8903874b27bfe888620500048db58e308bf0d983 /perl-install/standalone
parent57a9679f8c2f8dc39cf6e674075e66e4c4431ac7 (diff)
downloaddrakx-e5e3c360129d86ba13d7f9eb582de7a8caa914be.tar
drakx-e5e3c360129d86ba13d7f9eb582de7a8caa914be.tar.gz
drakx-e5e3c360129d86ba13d7f9eb582de7a8caa914be.tar.bz2
drakx-e5e3c360129d86ba13d7f9eb582de7a8caa914be.tar.xz
drakx-e5e3c360129d86ba13d7f9eb582de7a8caa914be.zip
added wonderful lsnetdrake
Diffstat (limited to 'perl-install/standalone')
-rwxr-xr-xperl-install/standalone/lsnetdrake36
1 files changed, 36 insertions, 0 deletions
diff --git a/perl-install/standalone/lsnetdrake b/perl-install/standalone/lsnetdrake
new file mode 100755
index 000000000..548b92657
--- /dev/null
+++ b/perl-install/standalone/lsnetdrake
@@ -0,0 +1,36 @@
+#!/usr/bin/perl
+
+use lib qw(.. /usr/lib/libDrakX);
+use network::smb;
+use network::nfs;
+
+"@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}";
+
+if ($nfs) {
+ my @servers = network::nfs::find_servers();
+ foreach my $server (sort_names(@servers)) {
+ my $server_name = $server->{name} || $server->{ip};
+ foreach (sort_names(network::nfs::find_exports($server))) {
+ print "$server_name:$_->{name}", $_->{comment} && " ($_->{comment})", "\n";
+ }
+ }
+}
+if ($smb) {
+ my @servers = network::smb::find_servers();
+ foreach my $server (sort_names(@servers)) {
+ my $server_name = $server->{name} || $server->{ip};
+ foreach (sort_names(network::smb::find_exports($server))) {
+ print "//$server_name/$_->{name}", $_->{comment} && " ($_->{comment})", "\n";
+ }
+ }
+}
+
+sub sort_names {
+ sort { $a->{name} cmp $b->{name} } @_;
+}