# Automatic license agreement per package



## arseniogut (Jul 12, 2019)

When I `make install` a port requiring several dependencies of varying licenses, what flag or option can I indicate to install all software and automatically accept their license terms?


----------



## SirDice (Jul 18, 2019)

Most ports don't require accepting, any port in particular you're having issues with?


----------



## tnpimatt (Oct 15, 2019)

dcc-dccd

And the old way of accepting licenses on TTY less installs no longer works. In this case, it's a gitlab runner doing test builds, so there is no TTY on which to present a prompt to a human.


```
[root@dcc /usr/ports/mail/dcc-dccd]# make BATCH=yes

===>  dcc-dccd-2.3.167_1 License DCC needs confirmation, but BATCH is defined.

*** Error code 1



Stop.

make: stopped in /usr/ports/mail/dcc-dccd
```


----------



## rigoletto@ (Oct 15, 2019)

Have a look at /usr/ports/Mk/bsd.licenses.mk, and you will find all possible ways to deal with licenses, and add them to /etc/make.conf.


----------



## tnpimatt (Oct 15, 2019)

Thanks rigoletto@, that was exactly the clue I needed. The incantation I need to use is:


```
make LICENSES_ACCEPTED=DCC
```

I'm including the tty-less error message below for search visitors to find this and your tip.


```
jexec stage make -C /usr/ports/mail/dcc-dccd build deinstall install clean
===>  License DCC needs confirmation, will ask later
===> dcc-dccd-2.3.167_1 depends on file: /usr/local/sbin/pkg - found
=> dcc-2.3.167.tar.Z doesn't seem to exist in /usr/ports/distfiles/.
=> Attempting to fetch https://www.dcc-servers.net/dcc/source/old/dcc-2.3.167.tar.Z
dcc-2.3.167.tar.Z                             ===> Fetching all distfiles required by dcc-dccd-2.3.167_1 for building
===>  Extracting for dcc-dccd-2.3.167_1
=> SHA256 Checksum OK for dcc-2.3.167.tar.Z.
1570 kB 1059 kBps 02s


*** Error code 255

Stop.
make[1]: stopped in /usr/ports/mail/dcc-dccd
*** Error code 1

Stop.
make: stopped in /usr/ports/mail/dcc-dccd
```


----------



## Lamia (Oct 16, 2019)

arseniogut said:


> When I `make install` a port requiring several dependencies of varying licenses, what flag or option can I indicate to install all software and automatically accept their license terms?



Insert in your make.conf:

```
#LICENSES
LICENSES_ACCEPTED+=3GPP
LICENSES_ACCEPTED+=ACUBE
LICENSES_ACCEPTED+=ADOBE
LICENSES_ACCEPTED+=APL1
LICENSES_ACCEPTED+=BSDCOMPATIBLE
LICENSES_ACCEPTED+=BSIML
LICENSES_ACCEPTED+=BuildLic
LICENSES_ACCEPTED+=CC0
LICENSES_ACCEPTED+=CCBYNCSAv3
LICENSES_ACCEPTED+=CCBYSAv3
LICENSES_ACCEPTED+=CCBYv3
LICENSES_ACCEPTED+=CCbyNC25
LICENSES_ACCEPTED+=CCbyNCSA2
LICENSES_ACCEPTED+=CCbyNCSA3
LICENSES_ACCEPTED+=CCbySA30
LICENSES_ACCEPTED+=CCbySA3
LICENSES_ACCEPTED+=CCbySA40
LICENSES_ACCEPTED+=CCbySA  
LICENSES_ACCEPTED+=CLEARTHOUGHT
LICENSES_ACCEPTED+=COMMERCIAL
LICENSES_ACCEPTED+=CPL05
LICENSES_ACCEPTED+=CPL
LICENSES_ACCEPTED+=CUBE
LICENSES_ACCEPTED+=CW
LICENSES_ACCEPTED+=CeCILL
LICENSES_ACCEPTED+=CeCILL_C
LICENSES_ACCEPTED+=DCC
LICENSES_ACCEPTED+=DMD
LICENSES_ACCEPTED+=DejaVu  
LICENSES_ACCEPTED+=ECW
LICENSES_ACCEPTED+=EULA
LICENSES_ACCEPTED+=EUPL
LICENSES_ACCEPTED+=FAL
LICENSES_ACCEPTED+=FDK_AAC
LICENSES_ACCEPTED+=FFTPAK
LICENSES_ACCEPTED+=FLOSSE
LICENSES_ACCEPTED+=FPL
LICENSES_ACCEPTED+=GLEW
LICENSES_ACCEPTED+=GPLR
LICENSES_ACCEPTED+=HISIML
LICENSES_ACCEPTED+=HW
LICENSES_ACCEPTED+=IBM
LICENSES_ACCEPTED+=ICOT
LICENSES_ACCEPTED+=ICU
LICENSES_ACCEPTED+=IDPL
LICENSES_ACCEPTED+=FPL
LICENSES_ACCEPTED+=GLEW
LICENSES_ACCEPTED+=GPLR
LICENSES_ACCEPTED+=HISIML
LICENSES_ACCEPTED+=HW
LICENSES_ACCEPTED+=IBM
LICENSES_ACCEPTED+=ICOT
LICENSES_ACCEPTED+=ICU
LICENSES_ACCEPTED+=IDPL
LICENSES_ACCEPTED+=IFL
LICENSES_ACCEPTED+=IPL
LICENSES_ACCEPTED+=ISO
LICENSES_ACCEPTED+=IUP
LICENSES_ACCEPTED+=JAIDL
LICENSES_ACCEPTED+=JDOM
LICENSES_ACCEPTED+=JYTHON
LICENSES_ACCEPTED+=LINUXLIBERTINE
LICENSES_ACCEPTED+=LinuxdocTools
LICENSES_ACCEPTED+=MSPAT
LICENSES_ACCEPTED+=NAIST
LICENSES_ACCEPTED+=NAISTL
LICENSES_ACCEPTED+=NEWRELIC
LICENSES_ACCEPTED+=NKF
LICENSES_ACCEPTED+=NODE
LICENSES_ACCEPTED+=OFL
LICENSES_ACCEPTED+=OPENLDAP
LICENSES_ACCEPTED+=OTHER
LICENSES_ACCEPTED+=PUBLIC_DOMAIN
LICENSES_ACCEPTED+=PerconaFT
LICENSES_ACCEPTED+=QPL10
LICENSES_ACCEPTED+=SENDMAIL
LICENSES_ACCEPTED+=SIL
LICENSES_ACCEPTED+=SpecialAuth
LICENSES_ACCEPTED+=TTYP0
LICENSES_ACCEPTED+=TWAIN
LICENSES_ACCEPTED+=TclTk
LICENSES_ACCEPTED+=UIUC
LICENSES_ACCEPTED+=UNLICENSE
LICENSES_ACCEPTED+=UNRAR
LICENSES_ACCEPTED+=VOLITION
LICENSES_ACCEPTED+=W3C
LICENSES_ACCEPTED+=WARSOW
LICENSES_ACCEPTED+=addl
LICENSES_ACCEPTED+=imlib2
LICENSES_ACCEPTED+=unknown
LICENSES_ACCEPTED+=NONE
```


----------



## rigoletto@ (Oct 16, 2019)

Lamia said:


> Insert in your make.conf:
> 
> ```
> #LICENSES
> ...



If you want to accept all licenses this is easier to just use: `DISABLE_LICENSES= yes`


----------



## grahamperrin@ (Jun 16, 2021)

Lamia said:


> `LICENSES_ACCEPTED+=COMMERCIAL`



What would be the equivalent for this, with poudriere-devel?


```
root@mowa219-gjp4-8570p:~ # poudriere bulk -b latest -j main editors/linux-wps-office
[00:00:00] Creating the reference jail... done
[00:00:52] Mounting system devices for main-default
[00:00:52] Stashing existing package repository
[00:00:52] Mounting ccache from: /var/cache/ccache
[00:00:52] Mounting ports from: /usr/local/poudriere/ports/default
[00:00:52] Mounting packages from: /usr/local/poudriere/data/packages/main-default
[00:00:52] Mounting distfiles from: /usr/local/poudriere/ports/default/distfiles
[00:00:52] Copying /var/db/ports from: /usr/local/etc/poudriere.d/options
[00:00:52] Appending to make.conf: /usr/local/etc/poudriere.d/make.conf
/etc/resolv.conf -> /usr/local/poudriere/data/.m/main-default/ref/etc/resolv.conf
[00:00:52] Starting jail main-default
[00:00:53] Logs: /usr/local/poudriere/data/logs/bulk/main-default/2021-06-16_10h46m03s
[00:00:53] Loading MOVED for /usr/local/poudriere/data/.m/main-default/ref/usr/ports
[00:00:54] Ports supports: FLAVORS SELECTED_OPTIONS
[00:00:54] Gathering ports metadata
[00:00:58] Calculating ports order and dependencies
[00:00:58] Trimming IGNORED and blacklisted ports
[00:00:58] Ignoring editors/linux-wps-office | linux-wps-office-11.1.0.10161: License commercial needs confirmation, but BATCH is defined
[00:00:59] Prefetching missing packages from pkg+http://pkg.FreeBSD.org/${ABI}/latest
…
```

I previously ran `make configure` at /usr/local/poudriere/ports/default/editors/linux-wps-office, accepted the license. Also added this to /etc/make.conf:

`LICENSES_ACCEPTED+=COMMERCIAL`

What am I missing?


----------



## rigoletto@ (Jun 16, 2021)

ports-mgmt/poudriere read the config files (including OPTIONS) from /usr/local/etc/poudriere.d. See HERE.

In my case I created a _symlink_ of /var/db/ports to there to be used by the jail that build ports to my system.


----------



## grahamperrin@ (Jun 16, 2021)

Thanks, can you give me a (non-symlinking) example of what I need to do? An example will make the reference material far less confusing for me.


----------



## rigoletto@ (Jun 17, 2021)

grahamperrin said:


> Thanks, can you give me a (non-symlinking) example of what I need to do? An example will make the reference material far less confusing for me.


To set OPTIONS? `poudriere options`

make.conf -> JAILNAME-make.conf


----------



## grahamperrin@ (Jun 17, 2021)

I added `LICENSES_ACCEPTED+=COMMERCIAL` to /usr/local/etc/poudriere.d/make.conf

No improvement.


----------



## grahamperrin@ (Jun 17, 2021)

```
root@mowa219-gjp4-8570p:/usr/local/poudriere/ports/default # poudriere options -n -j main editors/linux-wps-office
[00:00:00] Appending to make.conf: /usr/local/etc/poudriere.d/make.conf
root@mowa219-gjp4-8570p:/usr/local/poudriere/ports/default #
```

– but I see nothing relevant added to /usr/local/etc/poudriere.d/make.conf

Is my command malformed?


```
# poudriere options -n -s -j main editors/linux-wps-office
[00:00:00] Appending to make.conf: /usr/local/etc/poudriere.d/make.conf
# poudriere options -n -r -j main editors/linux-wps-office  
[00:00:00] Appending to make.conf: /usr/local/etc/poudriere.d/make.conf
===> No user-specified options configured for linux-wps-office-11.1.0.10161
# poudriere options -n -s -j main editors/linux-wps-office
[00:00:00] Appending to make.conf: /usr/local/etc/poudriere.d/make.conf
# exit
root@mowa219-gjp4-8570p:~ #
```


----------



## rigoletto@ (Jun 17, 2021)

Options are stored on JAILNAME-options, and I've never paid attention to that message.


----------



## grahamperrin@ (Jun 18, 2021)

rigoletto@ said:


> … I've never paid attention to that message.



Fair enough. 

Since (ignoring the message) `poudriere options` seems to achieve nothing in this case, how can I build the port with poudriere?


```
root@mowa219-gjp4-8570p:~ # pkg info -x poudriere
poudriere-devel-3.3.99.20210521
root@mowa219-gjp4-8570p:~ # poudriere ports -u
[00:00:00] Updating portstree "default" with git+https... done
root@mowa219-gjp4-8570p:~ # poudriere options -n -r -j main editors/linux-wps-office
[00:00:00] Appending to make.conf: /usr/local/etc/poudriere.d/make.conf
===> No user-specified options configured for linux-wps-office-11.1.0.10161
root@mowa219-gjp4-8570p:~ # poudriere options -n -s -j main editors/linux-wps-office
[00:00:00] Appending to make.conf: /usr/local/etc/poudriere.d/make.conf
root@mowa219-gjp4-8570p:~ # poudriere bulk -b latest -j main editors/linux-wps-office
[00:00:00] Creating the reference jail... done
[00:01:01] Mounting system devices for main-default
[00:01:01] Using packages from previously failed build: /usr/local/poudriere/data/packages/main-default/.building
[00:01:01] Mounting ccache from: /var/cache/ccache
[00:01:01] Mounting ports from: /usr/local/poudriere/ports/default
[00:01:01] Mounting packages from: /usr/local/poudriere/data/packages/main-default
[00:01:01] Mounting distfiles from: /usr/local/poudriere/ports/default/distfiles
[00:01:01] Copying /var/db/ports from: /usr/local/etc/poudriere.d/main-options
[00:01:01] Appending to make.conf: /usr/local/etc/poudriere.d/make.conf
/etc/resolv.conf -> /usr/local/poudriere/data/.m/main-default/ref/etc/resolv.conf
[00:01:01] Starting jail main-default
[00:01:03] Logs: /usr/local/poudriere/data/logs/bulk/main-default/2021-06-18_02h41m29s
[00:01:03] Loading MOVED for /usr/local/poudriere/data/.m/main-default/ref/usr/ports
[00:01:03] Ports supports: FLAVORS SELECTED_OPTIONS
[00:01:03] Gathering ports metadata
[00:01:06] Calculating ports order and dependencies
[00:01:07] Trimming IGNORED and blacklisted ports
[00:01:07] Ignoring editors/linux-wps-office | linux-wps-office-11.1.0.10161: License commercial needs confirmation, but BATCH is defined
[00:01:08] Prefetching missing packages from pkg+http://pkg.FreeBSD.org/${ABI}/latest
…
```


----------



## rigoletto@ (Jun 18, 2021)

Using `poudriere options` to set options will create a JAILNAME-options directory with the ports options inside it (just like in /var/db/ports), which later will be read by ports-mgmt/poudriere when building ports... if this is not happening I suppose there is something _wrong_ with the -devel version.



> [00:01:08] Prefetching missing packages from pkg+http://pkg.FreeBSD.org/${ABI}/latest



I never used it.



> [00:00:01] Appending to make.conf: /usr/local/etc/poudriere.d/workstation-make.conf



I had a look in here, and you probably don't have a jail specific make.conf (not mandatory anyway), and its look like the JAILNAME-make.conf is added on the fly in the make.conf inside the jail.



> [00:01:07] Ignoring editors/linux-wps-office | linux-wps-office-11.1.0.10161: License commercial needs confirmation, but BATCH is defined



It has nothing to do with OPTIONS but with the fact you don't have the necessary license type allowed in the poudriere jail make.conf.


----------



## rigoletto@ (Jun 18, 2021)

`echo "LICENSES_ACCEPTED+= COMMERCIAL" > /usr/local/etc/poudriere.d/main-make.conf` should do the job, assuming the jail you are building is named *main*.


----------



## grahamperrin@ (Jun 18, 2021)

rigoletto@ said:


> … should do the job …



Unfortunately not (I tried). I previously tried `LICENSES_ACCEPTED+=COMMERCIAL` in /usr/local/etc/poudriere.d/make.conf


----------



## grahamperrin@ (Jun 18, 2021)

Solved: it's *case-sensitive*.

I don't need per-jail configuration for this, so my /usr/local/etc/poudriere.d/make.conf includes:


```
# <https://forums.FreeBSD.org/threads/71438/post-517873>
LICENSES_ACCEPTED += commercial
```

Postscript

For future reference (I might revisit this): 


```
% pkg query '%o %v %R' poudriere-devel
ports-mgmt/poudriere-devel 3.3.99.20210714 FreeBSD
% su -
Password:
root@mowa219-gjp4-8570p:~ # poudriere options
poudriere options [options] [-f file|cat/port ...]

Parameters:
    -f file     -- Give the list of ports to set options
    [ports...]  -- List of ports to set options on

Options:
    -a arch     -- Indicates the TARGET_ARCH if no jail is specified. Such as i386
                   or amd64. Format of TARGET.TARGET_ARCH is also supported.
    -c          -- Use 'make config' target
    -C          -- Use 'make config-conditional' target (default)
    -j name     -- Run on the given jail
    -p tree     -- Specify on which ports tree the configuration will be done
    -n          -- Do not configure/show/remove options of dependencies
    -r          -- Remove port options instead of configuring them
    -s          -- Show port options instead of configuring them
    -z set      -- Specify which SET to use
root@mowa219-gjp4-8570p:~ # exit
logout
%
```


----------

