Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a directory with every package I require. Don't really want to go through several dozen files and manually invoke pkgadd for them.

Is there a way to automate this process or call pkgadd to have it install everything in the directory?

Thank you.

share|improve this question
up vote 2 down vote accepted

Solaris packages can be stored as a single file, or as a directory tree of files. The -d option supports installing multiple packages if they're stored in the directory tree format. You can use pkgtrans to unpack package files:

pkgtrans FOObar.pkg /var/tmp/pkgs

This would create a directory /var/tmp/pkgs/FOObar, containing the files and subdirectories that make up the package. You could unpack all of your packages into the same place, then run:

pkgadd -d /var/tmp/pkgs all

to install all of them at once.

I haven't tried this, but the pkgadd -s option claims to unpack packages to /var/spool/pkg, and pkgadd without -d looks for packages in that directory. So the sequence:

pkgadd -s file1.pkg
pkgadd -s file2.pkg
pkgadd all

will probably also work.

share|improve this answer

This should get you started-you'll want to pretty it up and extend it if you're actually going to use it. Right now it won't handle spaces of control characters in filenames gracefully. And if this is on Solaris you'll probably have to tweak the location of sh.

pkgs=`ls $dir`
for i in $pkgs
pkgadd $i
share|improve this answer
bah! thanks for the suggestion - but wish there was a way to do it merely with the command :( – romant Oct 14 '09 at 5:57

pkgadd -d /path/to/directory all should do what you want. However, if some of the packages depend on others, instead of all you'll need to list them in the order they should be installed.

share|improve this answer
thanks for that, although unfortunately am getting # pkgadd -d /scratch/ all pkgadd: ERROR: no packages were found in </scratch> – romant Oct 14 '09 at 5:55
From Sun's man page (, it looks like the -d option should be what you need. Unless the keystore is corrupted or nonexistent, not sure why you'd be seeing issues. – warren Oct 14 '09 at 7:20

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.