Friday, March 14, 2008

Using Pkgbuild To Build Solaris Pkg Files Just Like Linux RPM's

Hello again,

If you're a regular reader, you've probably noticed that I've been spending a whole lot of time looking at ways to build packages, automate installations, etc, on both Linux and Unix ;) One interesting thing I found in my downloading, testing and trial is an ambitious project called pkgbuild, which is a good attempt (ongoing, and getting better) at addressing Solaris' pkg creation system and making it as versatile and security-conscious as RedHat's "rpmbuild" (That we took a look at a lot more than a few times in our series on creating your own RPM's.

The software's two main attractions are that it:

1. Addresses the "spec file" format for configuring software builds, just like rpmbuild

and

2. It works just about the same way. For instance, if you had your "spec file" written up and were ready to compile the source and binary pkg's for your build, you could do it almost exactly the same way we built our RPMS. The only difference on the command line, in fact, is the name of the command:

host # pkgbuild -ba PROGRAM.spec <--- eerily familiar ;)

The "spec file" format is almost identical to rpmbuild, except that there are some specific Solaris pkg tags that need to be used within the "header section" (Since, technically, you're still building a package and we know what Sun expects from Solaris pkg's "pkginfo" file. The following extra defines are specific to the pkgbuild software's "spec file":

SUNW_BaseDir "DIR" <--- Same as BASEDIR in the pkginfo file. Defaults to /, just like on Solaris.

SUNW_Pkg "PKG_NAME" <--- Same as NAME. Like SUNWblah

SUNW_ProdName "PRODNAME" <--- Same as SUNW_PRODNAME. Usually "SunOS"

SUNW_ProdVers "VERSION" <--- Same as SUNW_PRODVERS. For instance "5.9" for Solaris 9.

SUNW_Category "CATEGORY" <--- Same as CATEGORY. Generally "application"

SUNW_HotLine "WHO TO CALL" <--- Same as HOTLINE. Can include an email or who to contact about the pkg. Not necessary, but available :)

The list is actually fairly extensive and still growing. You can check it out here in the pkgbuild online manual

They also include support for %include directives, as well as all the stuff you'd expect, like inline macros for doing the "configure," "build," and "install" portions of your pkg creation.

The only downside (and it's pretty big) that I see so far is that the pkgbuild format and build process doesn't meld seamlessly enough to make it what I think it's trying to be (a way to provide admins with one simple way to create both Linux RPM's and Solaris pkg's). At this point, in the end, it's basically making you jump through a lot of hoops to get it to do what you would normally do if you were making the pkg file yourself. Still, it's early and I haven't counted it out yet.

I'll be writing more about this as I get into it and work it into our business practices. Until then, it might be worth checking out. If your business involves creating and/or packaging software installations for Solaris, this will, at the very least, be highly interesting :)

Best wishes,

, Mike




Excellent Web Hosting At An Affordable Price!
www.authorswebhosting.com
These Are The Guys I Use To Host My Online Presence!