Subject: Re: Newbie Questions
To: Gary Montcalm , Manuel Bouyer <bouyer@antioche.eu.org>
From: Richard Rauch <rauch@rice.edu>
List: netbsd-users
Date: 01/25/2002 23:02:14
Since Gary describes himself as a beginner, it might be worth saying a
little bitmore aboutwhat it means to use pkgsrc.  (^&

Gary, you can find fuller information on the http://www.NetBSD.org/ web
site, I think.  But, if you want to install the "samba" package from the
"net" category of the NetBSD pkgsrc system, you need to:

 * Install a copy of pkgsrc.  (I think that a copy is now included with
   the NetBSD install sets---but you may still have to manually unpack
   it if you want it.  Alternatively, you can download a fresher copy
   from a NetBSD mirror.)

   The usual place to install it is in /usr (/usr/pkgsrc/...).

 * To build the net/samba package, then (assuming that pkgsrc is in
   /usr/pkgsrc/, and that your NetBSD computer is on the Internet):

     cd /usr/pkgsrc/net/samba && make update

   ...then, depending on the size of the package and the speed of
   your network connection (and computer), you might blink your eyes
   slowly a time or two, or you might go somewhere for lunch.  (For
   some involved things, like KDE, you might wander away for even
   longer.)  But, eventually, it should finish churning and you'll
   have the package installed.

   (The ``update'' target first deinstalls the current version, if
   you have any; it also deinstalls anything that depends upon the
   current version and remembers to reinstall them later, when it's
   done.  It then attempts to build the current version in pkgsrc,
   downloading any needed files from the Internet, applying patches,
   and configuring things as-needed.  It may also update things that
   the package depends upon, if you don't have them installed or if
   you have a too-outdated version installed.  When it's done building,
   it installs the package, updates anything that you had previously
   installed which depended upon what you just updated, and then cleans
   up the directory.  (whew))

Two caveats are worth mentioning:

(a) pkgsrc has a configuration file.  I think that it now comes up under
the name /usr/pkgsrc/mk/bsd.pkg.defaults.mk; to be found by the pkgsrc
system, it needs to be copied into /etc/mk.conf (cp
/usr/pkgsrc/mk/bsd.pkg.defaults.mk /etc/mk.conf).  You should probably
take some time to read the file (it's well commented and plain text).
The syntax should be straightforward if you want or need to make any
changes.

(b) As I said above, if you "make update" a package (say p1), pkgsrc
deisntalls p1 as a first step.  But, to do that, it deinstalls everything
that depends upon p1 (e.g., p2 may depend upon p1, so p2 gets deinstalled.
This is part of the deinstallation procedure.)  Also, if p1 (the version
that you're updating to) depends upon something and needs a more recent
version of some other package (say, p3---perhaps a library), then that,
too, gets deinstalled before p1 can even be built.

It may or may not be apparent, but this can cause a ripple effect.  There
are a few lynchpin packages (libpng comes to mind) that a *lot* of things
depend upon.  If you have a number of packages installed, update pkgsrc,
and then update anything in pkgsrc that causes libpng (for example) to get
updated, you may see your computer spend a long time updating most of its
packages.

So, for this reason, I suggest getting a relatively recent version of
pkgsrc and *not* updating pkgsrc very often.


Anyway.  Good luck, and welcome aboard.


  ``I probably don't know what I'm talking about.'' --rauch@math.rice.edu