4

I'm fairly new to FreeBSD. I write a script to automate unattended installation. I understand that right tool for this job is bsdinstall

Right now I write the setup-script for bsdinstall.

I test this script standalone, not with bsdinstall.

Since pkg is not installed yet, it wants interactive confirmation to bootstrap itself. Can I get rid of this interactive confirmation easily? I want to avoid expect, because I think there must be an easier way.

my attempts sofar:

pkg bootstrap
pkg bootstrap -f
yes | pkg bootstrap
yes | pkg bootstrap -f
murphy
  • 345

2 Answers2

4

Try set ASSUME_ALWAYS_YES variable to yes.

set ASSUME_ALWAYS_YES = yes
pkg bootstrap

This information written by pkg when invoke yes | pkg bootstrap -f:

Please set ASSUME_ALWAYS_YES=yes environment variable to be able to bootstrap in non-interactive (stdin not being a tty)

uzsolt
  • 1,907
  • the notice was never written to the console in my case. ASSUME_ALWAYS_YES works for me, I had to write it like this, though: env ASSUME_ALWAYS_YES=YES pkg bootstrap – murphy Aug 14 '16 at 21:17
  • The command may depends on your shell. – uzsolt Aug 15 '16 at 03:57
1

Got the same trouble with a brand new jail

the solution:

1- create directory: /usr/local/etc

2- create file: /usr/local/etc/pkg.conf with:

DEFAULT_ALWAYS_YES = true;
ASSUME_ALWAYS_YES = true;

and run:

ASSUME_ALWAYS_YES=yes pkg bootstrap -yf

it should be ok