Compiling and installing a port as an unprivileged user

Hello,

I am trying to see if I can create a prefix in my home directory to hold a different (older) version of a ports tree snapshot. Is this possible?

Code:
# Set required variables
$ export PREFIX=/home/kpedersen/local
$ export PORTSDIR=/home/kpedersen/ports
$ export PORT_DBDIR=/home/kpedersen/portsdb

# Compile and install port
$ cd /home/kpedersen/ports/shells/bash
$ make
$ make install

This gets close but unfortunately I have not found a way to specify the pkg db (/var/db/pkg) and so it conflicts with the current ports tree.

It also asks for root privilege on the make install (so it can write to the pkg db and register the package)

This would be awesome if it would work because it would allow me to easily keep a personal prefix containing old unmaintained ports without the need for a jail.

Best Regards,
 
kpedersen said:
I am trying to see if I can create a prefix in my home directory to hold a different (older) version of a ports tree snapshot. Is this possible?
From pkg_add(1):
The environment variable PKG_DBDIR specifies an alternative location for the installed package database, default location is /var/db/pkg.
 
Cool, thanks.

I never thought to look at the pkg_add manpage because I thought it was the ports collection that installed the port rather than package add.

I do still have one problem to fix and that is it still asks for my root password even though I do not need to write anywhere other than my home directory.

Code:
===> Switching to root credentials for 'install' target
Password:

Is this hard coded? Is there any way to prevent the root request?
 
kpedersen said:
I never though to look at the pkg_add manpage because I thought it was the ports collection that installed the port rather than package add.
It's also mentioned in ports(7).

I do still have one problem to fix and that is it still asks for my root password even though I do not need to write anywhere other than my home directory.

Code:
===> Switching to root credentials for 'install' target
Password:

Is this hard coded? Is there any way to prevent the root request?

Good question, no idea actually. You might want to have a look in /usr/ports/Mk/bsd.port.mk.
 
Back
Top