Subject: Re: DISTDIR=? in /etc/mk.conr
To: Gan Uesli Starling <oinkfreebiker@att.net>
From: Frederick Bruckman <fredb@immanent.net>
List: netbsd-help
Date: 09/16/2001 16:28:48
On Sun, 16 Sep 2001, Gan Uesli Starling wrote:

> Since I've got myself a little network now, can I somehow say in /etc/mk.conf
> files of any little, old, slow machines that they must look for DISTDIR in
> /usr/pkgsrc_distfiles on the big, new, fast machine via Ethernet?

You could use "nfs" to mount /usr/pkgsrc/distfiles from the fast
machine onto the other. In fact, it probably makes sense to keep all
of "pkgsrc" on the fast machine...

> So, like, where it now says...
>
> DISTDIR=/usr/pkgsrc_distfiles
>
> ...on the little, old, slow machines on NetBSD much the same as I can say in
> *.bat files on WinNT. Below is an example for WinNT, where CAVE_OF_WONDERS is
> just a variable name I made up and \\ALPHA\c\blah\blah\ points to the
> directory C:\blah\blah on the WinNT machine I have chosen to call ALPHA...
>
> C> call set CAVE_OF_WONDERS=\\ALPHA\c\blah\blah\

You get to pick where you want the nfs mounted drive to appear in the
namespace. Say you want "/usr/pkgsrc" to appear on "/usr/pkgsrc". On
the server, create "/etc/exports" containing the name of the drive or
directory you want to export,"/usr/pkgsrc", and flags -- see
exports(5) -- something like:

/usr/pkgsrc -maproot=root:wheel -network=AA.BB.CC.DD -mask=AA.BB.CC.DE

Substituting the appropriate numbers. Add:

rpcbind="YES
nfs_server=YES

to "/etc/rc.conf". Do:

	/etc/rc.d/rpcbind start
	/etc/rc.d/mountd start
	/etc/rc.d/nfsd start

And watch for errors in "/var/log/messages". Fix as needed and repeat.
On the client, you could add a line such as

name_of_server:/usr/pkgsrc     /usr/pkgsrc      nfs     rw,-3Tbi

and then simply

	mount /usr/pkgsrc

See mount_nfs(8) for an explanation of what the mount flags mean. In
addition, you should either make sure the server is in "/etc/hosts" on
the client, or use an IP ADDR in "/etc/fstab" instead.

In fact, what I've come to do is to have "pkgsrc" live on a partition
mounted at "/s", the clients all mount "/s" as "/s", and "/usr/pkgsrc"
is a symlink to "/s/pkgsrc" (though that's not even necessary).

Also, if the machines are ever connected to the internet, you probably
ought to set up a basic firewall against spoofed packets on the wrong
interface, as otherwise the access restrictions in "/etc/exports" do
no good.

Frederick