# install the ports tree into another directory



## fluca1978 (Jan 3, 2012)

Hi all,
I'm trying to install the ports tree into a zfs filesystem under /mnt/RPOOL/ports and I've succesfully used portsnap to get the directory configured:


```
portsnap fetch
portsnap -p /mnt/RPOOL/ports extract
```

But now when I try to *make* a search into the ports catalog I got:


```
root@nas] /mnt/RPOOL/ports# make search key=eclipse
"/usr/share/mk/bsd.port.subdir.mk", line 6: Could not find /usr/ports/Mk/bsd.port.subdir.mk
"Makefile", line 155: Malformed conditional (${OSVERSION} >= 601101)
"Makefile", line 157: if-less else
"Makefile", line 159: if-less endif
make: fatal errors encountered -- cannot continue
```

The problem is that I cannot edit the /usr/share/mk/bsd.port.subdir.mk because my /usr is read only. Is there a way to override the settings in such file so to make the ports collection working?


----------



## SirDice (Jan 3, 2012)

Set *PORTSDIR*. See ports(7).


----------



## ikreos (Jan 3, 2012)

Link your new ports directory to /usr/ports/. This way you don't have to change any configuration. I myself have my ports tree under /usr/local/ports/ and then link it to /usr/ports to keep / from getting cluttered.


----------



## fluca1978 (Jan 3, 2012)

Thanks both. I was trying to set the mountpoint to /usr/ports but got an error due to the file system in read-only mode. It is curious I can create the link in such filesystem...


----------



## ikreos (Jan 3, 2012)

Remount your /usr filesystem read-write then create the link then remount it as read-only again. As long as the linked directory is read-write you shouldn't have any problems.


----------



## SirDice (Jan 4, 2012)

Another idea is to use nullfs(5).

`# mount -t nullfs /mnt/RPOOL/ports /usr/ports/`


----------



## ikreos (Jan 5, 2012)

SirDice said:
			
		

> Another idea is to use nullfs(5).
> 
> `# mount -t nullfs /mnt/RPOOL/ports /usr/ports/`



Hmm. I like that idea better than a link. Must investigate further.


----------

