Subject: Re: pkgsrc as non-root?
To: None <tech-pkg@NetBSD.org>
From: Soren Jacobsen <snj@pobox.com>
List: tech-pkg
Date: 09/27/2003 20:46:37
On 09/28 12:54, Berndt Josef Wulf wrote:
> On Sun, 28 Sep 2003 12:36 pm, Hubert Feyrer wrote:
> > Are there a bunch of magic variables to use pkgsrc either on NetBSD or on
> > Solaris as non-root? Just to compile a simple program would be enough,
> > this is mostly for letting some students play w/o handing out r00t.
> 
> It should work as long as the user has write permission on pkgsrc filesystem, 
> e.g. by adding previliged users to group wsrc after changing the filesystem 
> accordingly. But this may not be what you want.

You can set WRKOBJDIR to something that the user can write to if you
don't want to put them in wsrc.

Unfortunately, it's not as simple as you think. Builds will work just
fine, but I don't think Hubert meant _only_ compiling programs.
Installing is the problem.

You can set LOCALBASE when invoking bmake. Also of interest are
PKG_DBDIR and SU_CMD (set SU_CMD to /bin/sh -c). Then the problem we run
into is that many packages use stuff like: install -o root -g wheel -m
555 blah ${PREFIX}/bin and obviously a mortal user can't change the
owner of a file. You could, however, write an install script that
stripped such options, and pass INSTALL=/path/to/your/install to bmake.
I'm sure there's something else that I'm forgetting. The last time I
thought about this, I couldn't think of any very clean ways to do it.