If you’ve ever been faced with the chore of installing many packages across many hosts, you’ve either 1) spent all day hitting the ‘Y’ key on your keyboard to pkgadd’s questions, 2) gotten someone else to hit the ‘Y’ key all day, or 3) you’ve given pkgadd the proper information so it can proceed without your input.
pkgadd takes a -n argument, that tells it to operate in non-interactive mode. However, this alone will not let you install much of anything, because if the pkgadd command needs any input from the user, it will just exit and your package will not be installed. To give pkgadd the information to act on its own and install your package, you have to provide the -a option and specify an “installation administration file”.
This “admin” file contains all the parameters pkgadd will need to operate. The default file exists in /var/sadm/install/admin/default. Copy it to your home directory and take a look at it.
mail=
instance=unique
partial=ask
runlevel=ask
idepend=ask
rdepend=ask
space=ask
setuid=ask
conflict=ask
action=ask
networktimeout=60
networkretries=3
authentication=quit
keystore=/var/sadm/security
proxy=
basedir=default
You can get information on all of the parameters in the file with:
# man -s 4 admin
What I usually do, to forcefully install the packages without asking anything, is just replace all the occurences of “ask” to “nocheck”. This will take the default file, and create a new one, changing ask to nocheck.
# sed 's/ask/nocheck/' < /var/sadm/install/admin/default > /home/user/admin.file
Now you can do your pkginstall without any questions being asked:
# pkgadd -n -a admin.file SUNWblah
Another handy parameter in the admin file, especially when you are installing packages across multiple hosts, is the “mail” parameter. When you set this with your email, you will be notified when the package installs on each system.