views:

64

answers:

2

Hi to everyone, i've got a question and i hope someone will help me :)

I have .deb package which contents i need to extract. I need to do it programmatically. The problem is that i cannot find any valuable resources on the net which can help me. I really don't have any Linux (Unix) experience so maybe i'm searching for it in the wrong way.

My idea was to find some kind of a specification which will describe the whole extracting process. I found out that .deb packages are basically standard Unix ar archives so i tried to search how ar works but again - no success.

Please any help will be appreciated.

Thanks, Adi

EDIT: I want to implement it without using system commands or 3rd party libraries.

+2  A: 

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]");
Delan Azabani
I'm not suppose to do it using system commands or 3rd party libs. I want to make my own implementation. Thanks anyway
Adi
+1  A: 

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.

Ville Laurikari
That's exactly what i want but I don't find enough information on how to do it. Correct me if I'm wrong but to extract the files, basically I need to read each archived file and write it to a specified location?
Adi
The wiki page I linked to above gives enough details to write your own library to extract the files.
Ville Laurikari