# "make config" can't live without root



## freemason (Sep 23, 2012)

Hi everyone!

I've just thought about moving everything related to ports out of standard /usr/ports and /var/db/ports locations in order to be able to work with ports tree (update, configure, build, etc.) on another partition (which is larger, faster, safer, etc.) and without being root (for safety), but the only unpleasant thing which keeps me from finalizing my idea is basically make utility itself!

After reading *man ports* I add the following to *make.conf*:

```
PORTSDIR=/home/ports
PACKAGES=${PORTSDIR}/PACKAGES
PORT_DBDIR=${PORTSDIR}/CONFIG
```

Now I can fetch, update and build with user, but I cannot configure options - "make" still wants root-user to write into location writable for user (here /home/ports/CONFIG/), but it should not:

```
> cd /home/ports/x11-wm/dwm/ && make config
===>  Switching to root credentials to create /home/ports/CONFIG/dwm
Password:
```
What am I doing wrong?


----------



## freemason (Sep 23, 2012)

After seeking through configs in the ports tree a little bit, I find makefile option "*INSTALL_AS_USER=*" and add it to my *make.conf*.
After that (with x11-wm/dwm as an example) CONFIG/dwm dir gets successfully created as user (after doing *make config* again), I configure dwm with dialog, but another trouble appears:


```
===>  Switching to root credentials to write /home/ports/CONFIG/dwm/options
Password:
```
Very strange! Newly created CONFIG/dwm dir is owned and writable by user of course, but what a stupidity to ask for root to write in it!

I'm not an expert in these scripts and would be grateful for any help and advice to fix the trouble!
Again, I just wanted to make config and build ports as user, but only install them in system as root.

Thanks.


----------



## NE (Sep 23, 2012)

Did you have a look at the SU_CMD ? Default value is /usr/bin/su root -c, you should be able to pverwrite this.


----------



## freemason (Sep 24, 2012)

All this happens just because some CLEVER PERSON wrote on *LINE 6131* of */ports/Mk/bsd.port.mk*:

```
if [ ${UID} != 0 -a "x${INSTALL_AS_USER}" = "x" ]; then \
```
while it should be something like

```
.if ${UID} != 0 && !defined(INSTALL_AS_USER)
```
 as it is in line 6094 and further

So if you want to CONFIGURE PORT AS USER you have to add some rubbish (like "YES" or "NO" or something) to *INSTALL_AS_USER=* in */etc/make.conf* because of that clever person's decision


----------



## wblock@ (Sep 24, 2012)

Looks like both would do the same thing, requiring INSTALL_AS_USER to be set if you're not root.


----------



## freemason (Sep 24, 2012)

wblock@ said:
			
		

> Looks like both would do the same thing, requiring INSTALL_AS_USER to be set if you're not root.


In the second case it needs to be just set (defined), in the first case it needs to  be SET TO SOMETHING, otherwise it won't work (test it for yourself if you don't believe me).


----------

