Changes between Version 1 and Version 2 of DissectingAPackage


Ignore:
Timestamp:
01/23/13 16:18:36 (9 years ago)
Author:
jdreed
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • DissectingAPackage

    v1 v2  
    11= Dissecting A Package = 
    22 
    3 Now that we have a package, let's take a look inside it. 
     3Given a `.deb` package, the `dpkg-deb` command will tell us a bit about it: 
     4 
     5{{{ 
     6$ dpkg-deb -I rpncalc_0.1_amd64.deb  
     7 new debian package, version 2.0. 
     8 size 1854 bytes: control archive= 515 bytes. 
     9     304 bytes,    11 lines      control               
     10     248 bytes,     4 lines      md5sums               
     11 Package: rpncalc 
     12 Version: 0.1 
     13 Architecture: amd64 
     14 Maintainer: Jonathan Reed <jdreed@mit.edu> 
     15 Installed-Size: 30 
     16 Section: utils 
     17 Priority: extra 
     18 Description: Simple RPN calculator in bash 
     19  A simple RPN calculator, implemented in bash. 
     20  Not legal for trade. 
     21  This was taken from the O'Reilly bash cookbook. 
     22}}} 
     23 
     24Here we can see some basic information about the size, name, version, and other metadata. 
     25 
     26We can also extract the contents of the package into a temporary directory ("scratch"): 
     27 
     28{{{ 
     29$ mkdir scratch 
     30$ dpkg-deb -x rpncalc_0.1_amd64.deb scratch 
     31$ cd scratch/ 
     32$ ls 
     33usr 
     34$ tree 
     35. 
     36└── usr 
     37    ├── bin 
     38    │   └── rpncalc 
     39    └── share 
     40        └── doc 
     41            └── rpncalc 
     42                ├── changelog.gz 
     43                ├── copyright 
     44                └── README 
     45 
     465 directories, 4 files 
     47}}} 
     48 
     49So now we have the contents in a temporary directory, and we could explore them and maybe try and run the binaries. 
     50 
     51Now let's dig a bit deeper into how the package is put together: 
    452 
    553A Debian package is merely a specialized version of an older archive format, known as `ar`.  The `ar` command is used to manipulate these types of archives.  Let's extract a `.deb` archive: 
     
    76124}}} 
    77125 
    78 The control information contains metadata about the package. 
     126The control information contains metadata about the package.  The fields are largely self-explanatory -- we'll visit them in more detail later. 
    79127 
    80128 
     129