DragonFly BSD
DragonFly users List (threaded) for 2009-11
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: Switching from Linux to DFBSD (pkgsrc/packages)

From: YONETANI Tomokazu <qhwt+dfly@xxxxxxxxxx>
Date: Sun, 15 Nov 2009 01:04:32 +0900

On Fri, Nov 13, 2009 at 09:46:27PM +0000, David Chanters wrote:
> 4.  I note that most of the ownership under "/usr/{src,pkgsrc}" is
> owned by group "wheel".  That's fine, since my non-root user account
> is in this group; I also like to compile things as non-root and then
> "sudo bmake install".  Is this a recommended way of working?  Do I
> just "chmod -R g+w /usr", or is there some other preferred way?

Actually, as a non-developer, you can even put both of them (I mean
/usr/{src,pkgsrc}, not /usr) on a read-only filesystem, meaning that
even root doesn't need write access to the source tree to build or install.
In practice, you often want write access to your source tree for a few
reasons including the case when you update or patch the source tree, so
probably you don't want to put them on a read-only filesystem, but you
can still build things as a non-user without write access to the source tree.

For /usr/pkgsrc, there are a few variables I always set in my mk.conf
after running the bootstrap script, to do everything as a non-root user:

DISTDIR?=		/home/distfiles
WRKOBJDIR?=		/var/tmp/pkgsrc
# uncomment this after installing sudo
# ROOT_CMD?=		${LOCALBASE}/bin/sudo ${SH} -c

For /usr/src, things get created inside ${.OBJDIR}, but it's set to
${.CURDIR} until you run `make obj', which sets up a directory under
${MAKEOBJDIRPREFIX} (defaults to /usr/obj).  Once this directory is
created, ${.OBJDIR} is set to that directory, not inside the source tree.
You can examine this by running `make -V .OBJDIR' before and after
running `make obj'.  For instance, this is how I compile and install
ls command from the source tree as a non-root user:
$ cd /usr/src/bin/ls
$ make cleandir; make cleandir
$ make obj		# this sets up ${.OBJDIR} under ${MAKEOBJDIRPREFIX}
$ make depend
$ make
$ sudo make install

Large targets like buildworld or buildkernel perform these procedures
(except for `make install', of course) for you, so you don't need to
explicitly run `make obj' in advance.

You can find more detailed explanations or other possible configurations
in make(1), build(7), /usr/share/mk/bsd.obj.mk and /usr/pkgsrc/mk/bsd.pkg.mk .


[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]