From 314859a4872032b07c5d0e57adf3d596049e2fdc Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Mon, 20 Aug 2001 22:05:05 +0000 Subject: basic nfs handling in drakx --- perl-install/Makefile | 2 +- perl-install/Makefile.drakxtools | 4 ++-- perl-install/fs.pm | 9 +++------ perl-install/network/nfs.pm | 42 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 48 insertions(+), 9 deletions(-) create mode 100644 perl-install/network/nfs.pm (limited to 'perl-install') diff --git a/perl-install/Makefile b/perl-install/Makefile index b872c7de1..ffa280b4f 100644 --- a/perl-install/Makefile +++ b/perl-install/Makefile @@ -17,7 +17,7 @@ clean: tar-drakxtools: clean $(MAKE) -C ../tools clean - cd .. ; rm -rf drakxtools ; cp -af perl-install drakxtools ; cp -af tools/ddcprobe tools/serial_probe drakxtools + cd .. ; rm -rf drakxtools ; cp -af perl-install drakxtools ; cp -af rpcinfo-flushed.c tools/ddcprobe tools/serial_probe drakxtools cd ../drakxtools ; perl -pi -e 's/^C_RPM.*/C_RPM=0/; s/^C_DRAKX.*/C_DRAKX=0/' c/Makefile cd ../drakxtools ; rm -rf install* pkgs.pm help.pm ftp.pm t.pm */CVS ; mv Makefile.drakxtools Makefile ; mv -f standalone/* . cd .. ; tar cfj drakxtools.tar.bz2 --exclude CVS $(patsubst %,drakxtools/%,Makefile Makefile.config Newt c ddcprobe serial_probe share/po sbus_probing resize_fat share/diskdrake.rc share/wizard.rc $(STANDALONEPMS) icons pixmaps network interactive_http *.pm) diff --git a/perl-install/Makefile.drakxtools b/perl-install/Makefile.drakxtools index adfde50e5..153212f4c 100644 --- a/perl-install/Makefile.drakxtools +++ b/perl-install/Makefile.drakxtools @@ -17,7 +17,7 @@ NETLIBDEST = $(LIBDIR)/$(NAME)/network PIXDIR = $(DATADIR)/$(NAME)/pixmaps .PHONY: $(DIRS) -all: $(DIRS) +all: rpcinfo-flushed $(DIRS) $(DIRS): install -d auto @@ -29,7 +29,7 @@ install: install -d $(BINDEST) $(ETCDEST) $(SBINDEST) $(DATADIR) $(LIBDEST) $(NETLIBDEST) $(BINX11DEST) $(LIBX11DEST) $(PIXDIR) install -d $(INLIBDEST_DIRS:%=$(LIBDEST)/%) install $(STANDALONEPMS) $(SBINDEST) - install -s ddcprobe/ddcxinfos serial_probe/serial_probe $(SBINDEST) + install -s rpcinfo-flushed ddcprobe/ddcxinfos serial_probe/serial_probe $(SBINDEST) ln -s ../../$(patsubst $(PREFIX)/usr%,%,$(SBINDEST))/XFdrake $(BINX11DEST)/Xdrakres install -m 644 *.pm $(LIBDEST) diff --git a/perl-install/fs.pm b/perl-install/fs.pm index a511ce931..3562f3cf1 100644 --- a/perl-install/fs.pm +++ b/perl-install/fs.pm @@ -507,11 +507,8 @@ sub mount { my @fs_modules = qw(vfat hfs romfs ufs reiserfs xfs jfs ext3); - if ($fs eq 'nfs') { - log::l("calling nfs::mount($dev, $where)"); -# nfs::mount($dev, $where) or die _("nfs mount failed"); - } elsif ($fs eq 'smbfs') { - die "no smb yet..."; + if (member($fs, 'smb', 'nfs') && $::isStandalone) { + system('mount', $dev, $where) == 0 or die _("mount failed"); } elsif (member($fs, 'ext2', @fs_modules)) { $dev = devices::make($dev) if $fs ne 'proc' && $fs ne 'usbdevfs'; @@ -579,7 +576,7 @@ sub mount_part { } elsif (loopback::carryRootLoopback($part)) { $mntpoint = "/initrd/loopfs"; } - mount(devices::make($dev), $mntpoint, type2fs($part), $rdonly); + mount($dev, $mntpoint, type2fs($part), $rdonly); rmdir "$mntpoint/lost+found"; } } 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 () { + 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; + -- cgit v1.2.1