Join GitHub today
pkgng provider on FreeBSD does not do BATCH=yes #27056
The pkgng provider on FreeBSD does not use the "BATCH=yes" environment setting when installing new packages.
This is problematic when installing packages that have an interactive post-install script (e.g. mail/postfix). The lack of the batch flag causes
But, because the minion is still reachable by the master, your highstate never completes or times out, and you then have to log in, kill the minion child, manually install the package in question, and then restart your highstate run.
referenced this issue
Dec 21, 2015
@abednarik Adding -y is not enough. -y simply tells pkg not to prompt to install the package, but has no effect on interactive post-install scripts.
See my original report in which I have
No, ASSUME_ALWAYS_YES is he same as the already present "-y".
The script waits for an user input [y/n] without timeout (read -p).
In my opinion the solution is to set a timeout in the postfix install script read loop, say 5min and then go on with proceeding the install script using the default "no" or in case the env. POSTFIX_DEFAULT_MTA=yes was found with "yes" as the answer.
Another idea is to use additional "test -t" inside the postfix install script and detect this way if the package is installed without terminal...
A workaround would be to install "/etc/mail/mailer.conf" with postfix as default before installing the postfix package (salt-cp or managed file)
I suspect with a fixed fixed postfix install script, something like this will do the trick
Maybe someone has an insight if there is an salt specific environment variable that can be used for further decisions inside a script?
Given the date I can only work next week on a good solution but I expect I can update the ports before next year.
@ohauer I think the high-level solution of
I have this exact problem when installing
First I tested using env vars and shell, with these results (using bash):
So it keeps waiting there for interaction, even when explicitly adding
Next step is using
So using that the package gets installed.
So for me working solution will be to force install using batch when you add 'Force=true' for example.
I created PR #48730 with this fix.