0

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.

3 Answers 3

2

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.

1

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.

#!/bin/sh
dir=/path/to/dir/with/pkgs
pkgs=`ls $dir`
for i in $pkgs
do
pkgadd $i
done
1
  • bah! thanks for the suggestion - but wish there was a way to do it merely with the command :(
    – romant
    Oct 14, 2009 at 5:57
1

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.

2
  • thanks for that, although unfortunately am getting # pkgadd -d /scratch/ all pkgadd: ERROR: no packages were found in </scratch>
    – romant
    Oct 14, 2009 at 5:55
  • From Sun's man page (docs.sun.com/app/docs/doc/817-0690/6mgflntib?a=view), 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, 2009 at 7:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .