Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

3 Answers 3

up vote 1 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.

#!/bin/sh
dir=/path/to/dir/with/pkgs
pkgs=`ls $dir`
for i in $pkgs
do
pkgadd $i
done
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 (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 '09 at 7:20

Your Answer

 
discard

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.