Friday, July 16, 2010

Recreating a Solaris pkg from an installed system

Had one of those days, where the jumpstart server was not backed up and the custom packages I build for our systems disappeared when the disk went south. Then wasted an hour seeing if I could find if the systems I build the package on still had it around. Gave up, figured there must be a way to do it easily. It was.

cd /usr/local
echo "i pkginfo=./pkginfo" > prototype
cp /var/sadm/pkg/MyPkg/save/pspool/MyPkg/pkginfo .
egrep "[fd] none" /var/sadm/pkg/MyPkg/save/pspool/MyPkg/pkgmap | cut -f4 -d\ | pkgproto >> prototype
pkgmk -o -r .

Done. I'm sure the egrep might need tuning for specific stuff in packages, but this did what I needed, and I'm glad I spent the 15 minutes to figure this out. Hope it helps someone else out