Wednesday, August 10, 2005

Solaris package dependency information

solarisThere is a file store the depency information of the a solaris package. I need the dependency information, so my pkg-get script will automatically resolve all dependency package, download and install them.

I google but don't find the method to extract out depend file in the solaris package, I can do like this:-

1. get header blocks
$ dd if=hello.pkg skip=1 | cpio -it
hello/pkginfo
hello/pkgmap
31 blocks

2. header blocks is 31 + 1
$ dd if=hello.pkg skip=32 | cpio -idv 'install/*'
$ cat install/depend

But, when there is more than 1 package in a pkg file
$ dd if=glib.pkg skip=1 | cpio -it
glib/pkginfo
glib/pkgmap
glib-dev/pkginfo
glib-dev/pkgmap
7 blocks

to get glib-dev depend file
$ dd if=glib.pkg skip=8 | cpio -it
1851 blocks <-- glib
(The above process will repeat, depend on which package you want to retrieve)
$ dd if=glib.pkg skip=1859 | cpio -it (1859=1851+8)
2158 blocks <-- glib-dev

This work most of the time, but might not be the correct way to do it, because it just don't work on some package.

I fix some bugs for my pkg-get, now it can download and install the dependency pacakge automatically.

PS. The haze is very bad since yesterday, real bad...

No comments: