PHP and DEB (AR) Files.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mofolo
Forum Newbie
Posts: 7
Joined: Mon Dec 07, 2009 8:35 am

PHP and DEB (AR) Files.

Post by mofolo »

Hey.

I'm working on a project that requires the breakdown of Deb files.

Basically, all I need to do is extract the "icon.png" from the deb file.

Is it possible with PHP? I've tried searching - googling, everything.

Thanks.
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: PHP and DEB (AR) Files.

Post by AbraCadaver »

You can unarchive the deb with the 'ar' command. Then the icon you need is in the data file (either data.tar, data.tar.gz or data.tar.bz2). You use tar and if needed use switches to have it run through bunzip2 or gunzip.

-Shawn
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
mofolo
Forum Newbie
Posts: 7
Joined: Mon Dec 07, 2009 8:35 am

Re: PHP and DEB (AR) Files.

Post by mofolo »

Thanks Shawn!

Could you link me to a tutorial that demonstrates the ar commands?
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: PHP and DEB (AR) Files.

Post by AbraCadaver »

mofolo wrote:Thanks Shawn!

Could you link me to a tutorial that demonstrates the ar commands?
If you are on linux just type 'man ar' or check here: http://linuxmanpages.com/man1/ar.1.php
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
mofolo
Forum Newbie
Posts: 7
Joined: Mon Dec 07, 2009 8:35 am

Re: PHP and DEB (AR) Files.

Post by mofolo »

Is there anyway of doing this thru php?
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: PHP and DEB (AR) Files.

Post by AbraCadaver »

mofolo wrote:Is there anyway of doing this thru php?
Try using php.net as a resource: exec()
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
mofolo
Forum Newbie
Posts: 7
Joined: Mon Dec 07, 2009 8:35 am

Re: PHP and DEB (AR) Files.

Post by mofolo »

wow! it works!

Thanks for that Shawn!
mofolo
Forum Newbie
Posts: 7
Joined: Mon Dec 07, 2009 8:35 am

Re: PHP and DEB (AR) Files.

Post by mofolo »

mofolo wrote:wow! it works!

Thanks for that Shawn!
I've got a new Problem with this...

After I unpack the .DEB file, I also decompress the TAR files with gzip.

One of the Tar files have a "postinst" file which chmods my directory to 777, thus giving me 500 errors.

Here is what im doing:

Code: Select all

exec("gzip -dc control.tar.gz | tar xf -");
Is this extracting, and executing the files?

Thanks.
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: PHP and DEB (AR) Files.

Post by AbraCadaver »

You don't need the control file, just the data file.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
mofolo
Forum Newbie
Posts: 7
Joined: Mon Dec 07, 2009 8:35 am

Re: PHP and DEB (AR) Files.

Post by mofolo »

AbraCadaver wrote:You don't need the control file, just the data file.
Thats true, but it still is being extracted from the TAR file.

And as that is happening, it is been executed! How can i avoid extracted this file?
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: PHP and DEB (AR) Files.

Post by AbraCadaver »

Something like:

Code: Select all

ar x data.tar.gz whatever.deb
tar zxf data.tar.gz
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Post Reply