pkg unattended install

How can I get this to install without asking a prompt or at least accept something like this at the commandline echo 'y' | pkg?
Code:
# pkg
The package management tool is not yet installed on your system.
Do you want to fetch and install it now? [y/N]:
 
FreeBSD 9.1 already has pkg available ready to install without the ports. Just need to find a way to bypass the confirmation question.
 
From pkg.conf(5):
Code:
     ASSUME_ALWAYS_YES: boolean  When this option is enabled pkg(1) will auto-
                                 matically assume "yes" to all questions which
                                 require user confirmation before doing any-
                                 thing, as if it the -y flag was specified.
                                 By default this option is disabled.

Reading that -y should also work on the command line. Why this isn't mentioned in the pkg(8) man page is beyond me.

NB. The FreeBSD man server seems to have a problem with it. The man pages should exist on your local system though.
 
Not sure if that would work for the bootstrap. But I think you can just install the port, that certainly doesn't ask for an acknowledgement.

You could also try the same procedure for < 9.1 systems to install pkg.

Code:
fetch http://yoururl/90amd64-default/Latest/pkg.txz
tar xf ./pkg.txz -s ",/.*/,,g" "*/pkg-static"
./pkg-static add ./pkg.txz

I'm almost certain pkg-static will accept the -y flag.
 
I tried the pkg -y but it doesn't work. It still asked for confirmation. I guess I'll do it from the ports in my automatic script.
 
Re: [SOLVED] pkg unattended install

Is there a way to test if pkg has been bootstrapped yet? Without running pkg?
 
Back
Top