# how to ignore jx prompts while installing ports



## srchi (May 26, 2021)

I'm installing freebsd-ports but during installation I'm getting prompts to select options. actually I'm not selecting any options instead just clicking OK button which I want in automated fashion since I'm running through shell scripts.
I have tried 
`make ports BATCH=yes` but still I'm getting prompts.


----------



## SirDice (May 26, 2021)

srchi said:


> I'm installing freebsd-ports but during installation I'm getting prompts to select options. actually I'm not selecting any options instead just clicking OK button which I want in automated fashion since I'm running through shell scripts


If you're going to stick to the defaults anyway why don't you simply install the packages?


----------



## srchi (May 26, 2021)

SirDice said:


> If you're going to stick to the defaults anyway why don't you simply install the packages?


but we are creating custom OS.


----------



## SirDice (May 26, 2021)

srchi said:


> but we are creating custom OS.


Why do you think that requires building from ports?


----------



## zirias@ (May 26, 2021)

As for the original question, there's no target `ports`, see ports(7). The `BATCH` knob works correctly, e.g. like

```
cd /usr/ports/www/firefox
make BATCH=1 install clean
```
would build and install firefox, no questions asked.

The value of `BATCH` doesn't matter, it just has to be defined.


----------



## srchi (May 26, 2021)

Sorry, still i get the prompts.


----------



## SirDice (May 26, 2021)

Tell us _exactly_ what you're doing because I have a feeling you're only showing just partial bits of information and have us _guess_ what the problem could be. We're not clairvoyant, we can't see what you're doing, which commands you're executing and what you're expecting.


----------



## srchi (May 26, 2021)

SirDice said:


> Tell us _exactly_ what you're doing because I have a feeling you're only showing just partial bits of information and have us _guess_ what the problem could be. We're not clairvoyant, we can't see what you're doing, which commands you're executing and what you're expecting.


i have few ports in /usr/ports directory example below port 
databases/redis
and running below commands
`make fetch-recursive`
`make install`
`make clean`
and I'm getting prompts which I don't want since it's a blocker for me for automation.


----------



## SirDice (May 26, 2021)

Again, just use the packages if you're just going to build the port with the default options. There's nothing to gain by building from ports. 

`env ALWAYS_ASSUME_YES pkg install -y redis`, done.


----------



## srchi (May 26, 2021)

but we have 100's of ports which we cant run using above cmd. when we build ports it will generate target directory which we will copy that into our custom OS(embedded OS) directory then using that directory we will build OS, its like building everything on base machine and deploying into Our OS include ports and our custom configuration.


----------



## zirias@ (May 26, 2021)

srchi said:


> and running below commands
> `make fetch-recursive`
> `make install`
> `make clean`
> and I'm getting prompts


So, you don't give the `BATCH` knob. Very strange it doesn't work then… (Heck what?)


----------



## SirDice (May 26, 2021)

srchi said:


> when we build ports it will generate target directory which we will copy that into our custom OS(embedded OS) directory then using that directory we will build OS


Ports build packages, so you're still using a package in the end. Might as well cut out all the useless compiling. Do you really think there's a difference between running `make install` in a port directory and running `pkg install`?


srchi said:


> its like building everything on base machine and deploying into Our OS include ports and our custom configuration.




```
-c <chroot path>, --chroot <chroot path>
             pkg will chroot in the <chroot path> environment.

     -r <root directory>, --rootdir <root directory>
             pkg will install all packages within the specified <root
             directory>.
```
See pkg(8)


----------



## srchi (May 26, 2021)

Zirias said:


> So, you don't give the `BATCH` knob. Very strange it doesn't work then… (Heck what?)


sorry dont take me wrong, i was using those commands to install ports i mean before this question has raised. yeah i've tried make install BATCH=1 (also tried BATCH=yes someone said)but as i says still prompting shared screenshot above


----------



## Tieks (May 26, 2021)

Ports are meant to be configured to your specific needs. If you choose the defaults only, it's faster to install packages. What you can do is this: Run `make config-recursive` before `make install clean`. That way you get to see all config screens before the building process starts. Once you finished installing the ports that you need, all options you entered will be stored in /var/db/ports. If you want to do the same installation on another machine, copy the contents of /var/db/ports to that machine first. You can then install the same ports without the config screens, as the options in /var/db/ports will then be used.


----------



## SirDice (May 26, 2021)

srchi said:


> yeah i've tried make install BATCH=1


Order is important. `make BATCH=1 install`.


----------



## zirias@ (May 26, 2021)

There are a few reasons to build yourself:

Custom port options
Custom `DEFAULT_VERSIONS`
A target architecture that doesn't have an official pkg repository
Then, some think optimizations were a reason (e.g. setting a specific `CPUTYPE`). In practice, they aren't, effects won't even be measureable most of the time.

Short of all that, yes, building yourself doesn't make any sense.


----------

