PDA

View Full Version : .deb surgery (manually extracting .deb data)


toupeiro
November 15th, 2007, 04:04 AM
I did a command today at work on a redhat system thoughtlessly since I've used it so many times, then I realized .. how would I do this on ubuntu or debian?

The idea is simple. I'm extracting the tree structure and data of a rpm in the current working directory for packages that cannot accept the --prefix switch.

rpm2cpio name.rpm | cpio -iv --make-directories

The result is a tree of all the files and directories extracted to manipulate, configure, and centralize on a NAS and run via exports on hundreds of machines.

How can I perform the same task with .deb files?

yabbadabbadont
November 15th, 2007, 04:11 AM
dpkg has a command line option to extract the contents of .deb files to the current directory. The manpage should list it, and any variations of it.

toupeiro
November 15th, 2007, 04:18 AM
dpkg has a command line option to extract the contents of .deb files to the current directory. The manpage should list it, and any variations of it.

even easier. Thank you! I guess I could have just done that instead of ask :P I just migrated an object oriented viz app off of IRIX which took hours to satisfy all the dependencies. I didn't have it in me to think that far ahead tonight on my own lol.


dpkg -x or -X looks like the magic switch

saulgoode
November 15th, 2007, 04:22 AM
You first should use 'ar x somepackage.deb'. This will result in a file containing version info and two tarballs. One of the tarballs contains installation instructions and the other contains the files to be installed. Use 'tar zxf control.tar.gz' or 'tar zxf data.tar.gz' to extract those files.

toupeiro
November 15th, 2007, 04:33 AM
I'm taking that the control.tar.gz instructions are that of the debian packaging process? I saw a directory called postinst, is this an area where post installation scripts would normally be located to configure applications? Very nice command to know! thank you for sharing. I've packaged MSI and RPM for a long time, but never have packaged anything .deb related before.

For my purpose, I will never recompile them back into .debs. I don't like pushing apps out to machines and supporting hundreds of individual installs if I have the storage and bandwidth to host them. So, I'm sure I will start having a need to do this with .deb based installation packages at some point. :)

koenn
November 15th, 2007, 06:17 AM
I'm taking that the control.tar.gz instructions are that of the debian packaging process? I saw a directory called postinst, is this an area where post installation scripts would normally be located to configure applications? )
yes, as you can see, .deb packages are just archives. They contain 2 parts : a data part : the files that will be installed on the system (in a directory tree that matches their location on the system), and a control part that controls the installation. The main control files are
- preinst : script(s) executed just before installation
- postinst: script(s) executed right after installation
- control : description of the package, contains info such as package size (so apt can say " xx mb to be downloaded"), all dependencies and such, etc.

xinix
November 15th, 2007, 03:02 PM
With MidnightCommander (mc) you can browse packages just like they were folders, read files in the package (don't think you can edit them), even run the install script.