aspose file tools*
The moose likes Linux / UNIX and the fly likes How to create a pkg Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "How to create a pkg" Watch "How to create a pkg" New topic
Author

How to create a pkg

Ramakanta Sahoo
Ranch Hand

Joined: Aug 23, 2008
Posts: 254

Hi All,

I have a sample.tar file and I want it in pkg so that if somebody does a pkgadd it will just untar the file.

Do anyone know how to do this.

How can I create a pkg file using the tar file which will only do a untar on execution of pkgadd command


Regards, Ricky
Oracle Weblogic 10g Certified Expert TechPaste.Com
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16136
    
  21

You should have mentioned the OS you're using. Presumably it's Solaris.

Sun has a very good set of documentation on its packaging system in the online docs at sun.com, so the best thing to do is RTFM. A package can be created with an install script that does an untar.

However, in a way, a pkg file is itself a sort of "tar", so you're actually not going to gain a lot by doing that. It would be easier to untar the file before building the package and supply the untar'ed directories to the package builder. That way you'll save yourself the trouble of working up an installer script and the package manager can more cleanly remove the package if you ever need to.


Customer surveys are for companies who didn't pay proper attention to begin with.
Ramakanta Sahoo
Ranch Hand

Joined: Aug 23, 2008
Posts: 254

I created a prototype file and a pkginfo file and added i pkginfo=./pkginfo to the prototype file.
and when I'm trying to execute pkgmk -r 'pwd'

It shows error for like no object found though the file is there and not taking any path which has a whitespace in it or any file with whitespace in the name.
how to avoid this. I cant change the paths or file names.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16136
    
  21

Filenames with spaces in them are a nightmare, even in Windows or Macintosh machines, and they really have no business at all in a Unix environment.

However, they are supported, although dangerous. Just escape the spaces.

For example (and PLEASE don't actually make one of these!):

/usr/local/Program\ Files/My\ Program/file1

Ramakanta Sahoo
Ranch Hand

Joined: Aug 23, 2008
Posts: 254

Tried your suggestion too same error.

May be I need to tar the file and make it a pkg. that should work but i dont know how to specify in the pkg that extract/untar the tar file when pkgadd is executing.

There is a way to put preinstall and postinstall commands so that during uninstall also it will remove all.

I'm not able to get it. If someone has already done so then please suggest.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to create a pkg