Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 Jul 2003 14:46:02 +0100
From:      Daniel Bye <dan@slightlystrange.org>
To:        freebsd-questions@freebsd.org
Subject:   Re: How an arbitrary user can install ports in own home dir?
Message-ID:  <20030716134602.GB82301@catflap.home.slightlystrange.org>
In-Reply-To: <20030716120304.GA44094@pm514-9.comsys.ntu-kpi.kiev.ua>
References:  <20030716120304.GA44094@pm514-9.comsys.ntu-kpi.kiev.ua>

next in thread | previous in thread | raw e-mail | index | archive | help

--NDin8bjvE/0mNLFQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Wed, Jul 16, 2003 at 03:03:04PM +0300, Andrey Simonenko wrote:
> Hello all,
>=20
> How an arbitrary user (without root credentials) can install ports
> in own home dir?
>=20
> How I tried to do this:
>=20
> I created ~/local/ports, place Mk, Tools, Templates there.

This step isn't necessary.  Well, it might be, but only if you don't have
r-x access on /usr/ports and descendents.

> I defined in .cshrc:
>=20
> setenv	PORTSDIR	~/local/ports

Don't bother with setting PORTSDIR, unless you don't have r-x access on the
ports tree.  All the framework is there already, so there is little value in
duplicating it.

> setenv	PREFIX		~/local
> setenv	PKG_DBDIR	~/local/var/db

You also need to define:

DISTDIR - where to find/download distfiles (if you don't have write access
on the system-wide ports distfiles directory)

DESTDIR - where to install the port, once built (relative to ${PREFIX})

WRKDIR - where the distfiles are unpacked, if you don't have write access to
the port's directory under /usr/ports/*

With these variables defined, either in your shell's environment (from, as
you have done, your login dotfiles) of on the make commandline, ports can be
installed exaclty as normal (i.e. cd /usr/ports/ftp/wget && make all install
clean)

For more options, read the variable definitions in
/usr/ports/Mk/bsd.ports.mk.

> But when I install any ports I'm asked to enter root password.
> This is from the bsd.port.mk:
>=20
> .if ${UID} !=3D 0 && defined(_${target:U}_SUSEQ)
> [skip]
> 	@echo "=3D=3D=3D>  Switching to root credentials for '${target}' target"
> 	@cd ${.CURDIR} && \
> 		${SU} root -c "${MAKE} ${__softMAKEFLAGS} ${_${target:U}_SUSEQ}"
> 	@echo "=3D=3D=3D>  Returning to user credentials"
>=20
> If I give correct root's password, then a port is installed to ~/local
> and a package is registered in ~/local/var/db.

Hmm, don't know what this means.  With the correct set of variables defined,
I have not yet been asked to provide the root password...

>=20
> Questions:
>=20
> 1.	Is there any way to tell ports system not to ask me root's
> 	password?  I guess that there should be a way to do it,
> 	whithout patching Mk/* files.

I guess by defining the right environment for the build to happen in.

> 2.	How to tell make(1) to use ~/local/etc/make.conf file
> 	(use another file, than /etc/make.conf)?

It seems (from `man 5 make.conf') that make.conf is included from the
Makefile of the target you are building.  If you want to use a different
one, I guess you will need to edit the part of the Makefile that pulls in
/etc/make.conf.  Can't find a way to specify an alternative.

Of course, none of this is guaranteed to be "correct", but "it works for
me", so naturally, YMMV  ;-)

HTH

Dan

--=20
Daniel Bye

PGP Key: ftp://ftp.slightlystrange.org/pgpkey/dan.asc
PGP Key fingerprint: 3B9D 8BBB EB03 BA83 5DB4 3B88 86FC F03A 90A1 BE8F
                                                                     _
                                              ASCII ribbon campaign ( )
                                         - against HTML, vCards and  X
                                - proprietary attachments in e-mail / \

--NDin8bjvE/0mNLFQ
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (FreeBSD)

iD8DBQE/FVcahvzwOpChvo8RAmyyAJ0eKtMnmPi4KPXKgzWVrkVNVYVSBQCgl9d4
bkn9QIdWC+kNCDoypY6ULgQ=
=yJo7
-----END PGP SIGNATURE-----

--NDin8bjvE/0mNLFQ--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030716134602.GB82301>