# /usr/ports in network location



## balanga (Apr 30, 2021)

This is the scenario I'm aiming at, don't know if it's achievable....

I would like a central repository which contains /usr/ports and this would be ready only, so that whenever a pkg was built a copy of  the makefiles etc would be copied and built locally. Are there specific variables and configurations options to enable this to be done?


----------



## im (May 1, 2021)

I use read-only ports for jails.
I have separate mount points for ports and distfiles.

mount:

```
/usr/ports on /home/jails/jailname/usr/ports (nullfs, local, read-only)
/usr/local/distfiles on /home/jails/jailname/usr/local/distfiles (nullfs, local)
```

This is my /etc/make.conf inside the jail with read-only ports.

```
DISTDIR?=/usr/local/distfiles
#PACKAGES?=/usr/local/packages
WRKDIRPREFIX?=/usr/local/portbuild
PORTSDIR?=/usr/ports
```

This allows me to have read-only mounted ports from host to jail, and read-write mounted distfiles.
You should create all specified directories.

Manual:
ports(7)

```
WRKDIRPREFIX  Where to create any temporary files.     
     Useful    if PORTSDIR is read-only (perhaps mounted from a CD-ROM).

     DISTDIR       Where to find/put distfiles,    normally distfiles/ in PORTSDIR.
```

make.conf(5)


----------



## SirDice (May 3, 2021)

If you have lots of RAM, use tmpfs(5) for /tmp and set WRKDIRPREFIX to a directory on /tmp. It's going to suck up a lot of memory with certain builds though.


----------

