Cómo extraer archivos de un paquete .deb

Para extraer uno o varios archivos de un paquete .deb (Debian package management system) hacemos uso del comando dpkg.

Lo primero que vemos es como listar contenido del paquete:

$ dpkg -c dsc-statistics-collector_201203250530-2_i386.deb
drwxr-xr-x root/root         0 2012-12-16 00:08 ./
drwxr-xr-x root/root         0 2012-12-16 00:08 ./etc/
drwxr-xr-x root/root         0 2012-12-16 00:08 ./etc/cron.d/
-rw-r--r-- root/root       289 2012-12-16 00:08 ./etc/cron.d/dsc-statistics-collector
drwxr-xr-x root/root         0 2012-12-16 00:08 ./etc/init.d/
-rwxr-xr-x root/root      6822 2012-12-15 16:31 ./etc/init.d/dsc-statistics-collector
drwxr-xr-x root/root         0 2012-12-16 00:08 ./etc/default/
-rw-r--r-- root/root      1006 2012-12-15 16:31 ./etc/default/dsc-statistics-collector
drwxr-xr-x root/root         0 2012-12-16 00:08 ./etc/dsc-statistics/
-rw-r--r-- root/root      4018 2012-12-16 00:08 ./etc/dsc-statistics/dsc-collector.cfg
drwxr-xr-x root/root         0 2012-12-16 00:08 ./usr/
drwxr-xr-x root/root         0 2012-12-16 00:08 ./usr/share/
drwxr-xr-x root/root         0 2012-12-16 00:08 ./usr/share/doc/
drwxr-xr-x root/root         0 2012-12-16 00:08 ./usr/share/doc/dsc-statistics-collector/
-rw-r--r-- root/root       366 2012-12-15 16:31 ./usr/share/doc/dsc-statistics-collector/NEWS.Debian.gz
-rw-r--r-- root/root       227 2012-12-15 16:31 ./usr/share/doc/dsc-statistics-collector/TODO.Debian
-rw-r--r-- root/root    240411 2012-12-16 00:08 ./usr/share/doc/dsc-statistics-collector/dsc-manual.pdf.gz
-rw-r--r-- root/root      1683 2012-12-16 00:09 ./usr/share/doc/dsc-statistics-collector/changelog.Debian.gz
drwxr-xr-x root/root         0 2012-12-16 00:08 ./usr/share/doc/dsc-statistics-collector/examples/
-rw-r--r-- root/root      1766 2012-12-16 00:08 ./usr/share/doc/dsc-statistics-collector/examples/dsc.cfg.gz
-rw-r--r-- root/root      2055 2012-12-15 16:31 ./usr/share/doc/dsc-statistics-collector/copyright
drwxr-xr-x root/root         0 2012-12-16 00:08 ./usr/share/dsc-statistics-collector/
-rwxr-xr-x root/root       954 2012-12-16 00:08 ./usr/share/dsc-statistics-collector/upload-rsync
-rwxr-xr-x root/root      1863 2012-12-16 00:08 ./usr/share/dsc-statistics-collector/upload-prep
-rwxr-xr-x root/root      1161 2012-12-16 00:08 ./usr/share/dsc-statistics-collector/upload-x509
-rwxr-xr-x root/root      1001 2012-12-15 16:31 ./usr/share/dsc-statistics-collector/dsc-rsync-pull
-rwxr-xr-x root/root      1433 2012-12-16 00:08 ./usr/share/dsc-statistics-collector/upload-ssh
drwxr-xr-x root/root         0 2012-12-16 00:08 ./usr/share/man/
drwxr-xr-x root/root         0 2012-12-16 00:08 ./usr/share/man/man8/
-rw-r--r-- root/root      2155 2012-12-16 00:08 ./usr/share/man/man8/dsc.8.gz
drwxr-xr-x root/root         0 2012-12-16 00:08 ./usr/bin/
-rwxr-xr-x root/root    162748 2012-12-16 00:08 ./usr/bin/dsc

Posteriormente desempaquetamos el contenido del paquete en una ruta temporal (/var/tmp por ejemplo):

$ dpkg -x dsc-statistics-collector_201203250530-2_i386.deb /var/tmp/dsc-statistics-collector
$ ls -l /var/tmp/dsc-statistics-collector/
total 8
drwxr-xr-x 6 root root 4096 2012-12-16 00:08 etc
drwxr-xr-x 4 root root 4096 2012-12-16 00:08 usr

Ya podemos trabajar con los archivos del paquete. Si por ejemplo quiero visualizar el archivo «./etc/init.d/dsc-statistics-collector»:

$ more /var/tmp/dsc-statistics-collector/etc/init.d/dsc-statistics-collector 
#!/bin/bash
#
# Written by Hugo Haas <hugo@debian.org> for ippl.
# Modified by Marc Haber <mh+debian-packages@zugschlus.de>.
# Adapted for dsc-collector by Marc Haber <mh+debian-packages@zugschlus.de>

### BEGIN INIT INFO
# Provides:          dsc-statistics-collector
# Required-Start:    $local_fs $remote_fs $syslog $network $time
# Required-Stop:     $local_fs $remote_fs $syslog $network
# Should-Start:
# Should-Stop:

Un comentario en “Cómo extraer archivos de un paquete .deb

Comments are closed.