Reputation: 1316
I have .deb
package whose contents I need to extract in a programmatic way. However, I am not able to find any resources on the topic, such as .deb
package format specification, which would give me some more idea how to approach the problem without going and reverse engineering the whole thing.
Any ideas?
Upvotes: 1
Views: 2096
Reputation: 81384
Quite simple, actually.
ar xv <name of deb file>
To call from within C, you could use system
:
system("ar xv <name of deb file>");
Upvotes: 3
Reputation: 2499
I just saw libarchive supports the ar
format, along with a ton of others.
Upvotes: 0
Reputation: 189337
One of the design goals for the .deb
package format was to make it easy to extract using existing tools and/or libraries. The top-level structure is indeed an ar
file, but inside that, you will find another level of structure, which is traditionally a pair of tar
files. For more documentation, see e.g. http://en.wikipedia.org/wiki/Deb_(file_format)
You can probably use the GNU ar
sources to build a library of your own if you cannot find an existing library. I would expect there to be general libraries for ar / tar / cpio / what have you.
Upvotes: 1
Reputation: 29248
If you don't find a library for this (I didn't, either), and cannot resort to running system commands, you can always implement your own to read ar archives. The ar file format isn't terribly complicated.
Upvotes: 1