summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perl-install/Makefile.config2
-rw-r--r--perl-install/Makefile.drakxtools1
-rwxr-xr-xperl-install/standalone/lsnetdrake36
3 files changed, 38 insertions, 1 deletions
diff --git a/perl-install/Makefile.config b/perl-install/Makefile.config
index 31609029d..7288446c0 100644
--- a/perl-install/Makefile.config
+++ b/perl-install/Makefile.config
@@ -5,7 +5,7 @@ VERSION = 2.2.10-BOOT
SUDO = sudo
SO_FILES = c/blib/arch/auto/c/c.so
PMS = *.pm Newt/*.pm c/stuff.pm resize_fat/*.pm sbus_probing/*.pm network/*.pm commands install2 g_auto_install live_install live_install2
-STANDALONEPMS= diskdrake XFdrake mousedrake printerdrake keyboarddrake draknet localedrake net_monitor drakbug_report tinyfirewall drakxconf drakxservices draksec drakboot adduserdrake drakgw drakautoinst livedrake
+STANDALONEPMS= diskdrake XFdrake mousedrake printerdrake keyboarddrake draknet localedrake net_monitor drakbug_report tinyfirewall drakxconf drakxservices draksec drakboot adduserdrake drakgw drakautoinst livedrake lsnetdrake
PMS += $(STANDALONEPMS:%=standalone/%)
REP4PMS = /usr/bin/perl-install
ROOTDEST = /export
diff --git a/perl-install/Makefile.drakxtools b/perl-install/Makefile.drakxtools
index 153212f4c..316ff9b37 100644
--- a/perl-install/Makefile.drakxtools
+++ b/perl-install/Makefile.drakxtools
@@ -31,6 +31,7 @@ install:
install $(STANDALONEPMS) $(SBINDEST)
install -s rpcinfo-flushed ddcprobe/ddcxinfos serial_probe/serial_probe $(SBINDEST)
ln -s ../../$(patsubst $(PREFIX)/usr%,%,$(SBINDEST))/XFdrake $(BINX11DEST)/Xdrakres
+ mv -f $(SBINDEST)/lsnetdrake $(BINDEST)/lsnetdrake
install -m 644 *.pm $(LIBDEST)
install -m 644 network/*.pm $(NETLIBDEST)
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} } @_;
+}