snipt

Ctrl+h for KB shortcuts

Text only

Rebuilding deb Packages

## Source: http://serverfault.com/a/383958/145483

You can change the dependencies of a deb package like this:

    1) Unpack deb: ar x golden-linux.deb (will create i.e. three files: debian-binary control.tar.gz data.tar.gz)
    2) Unpack control archive: tar xzf control.tar.gz (will create: postinst postrm preinst prerm md5sums control)
    3) Fix dependencies in control (use a text editor)
    4) Repack control.tar.gz: tar c {post,pre}{inst,rm} md5sums control | gzip -c > control.tar.gz
    5) Repack deb: ar rcs newpackage.deb debian-binary control.tar.gz data.tar.gz (order important! See [Note] )

[Note]: dpkg wouldn't be able to read the metadata of a package quickly if it had to search for where the data section ended!
https://snipt.net/embed/e42d5486497ca301528d1a9ddc2d3822/
/raw/e42d5486497ca301528d1a9ddc2d3822/
e42d5486497ca301528d1a9ddc2d3822
text
Text only
12
2019-06-25T20:49:15
True
False
False
Nov 14, 2012 at 09:43 AM
/api/public/snipt/50218/
rebuilding-deb-packages
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1"> 1</a> <a href="#L-2"> 2</a> <a href="#L-3"> 3</a> <a href="#L-4"> 4</a> <a href="#L-5"> 5</a> <a href="#L-6"> 6</a> <a href="#L-7"> 7</a> <a href="#L-8"> 8</a> <a href="#L-9"> 9</a> <a href="#L-10">10</a> <a href="#L-11">11</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>## Source: http://serverfault.com/a/383958/145483 </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a>You can change the dependencies of a deb package like this: </span><span id="L-4"><a name="L-4"></a> </span><span id="L-5"><a name="L-5"></a> 1) Unpack deb: ar x golden-linux.deb (will create i.e. three files: debian-binary control.tar.gz data.tar.gz) </span><span id="L-6"><a name="L-6"></a> 2) Unpack control archive: tar xzf control.tar.gz (will create: postinst postrm preinst prerm md5sums control) </span><span id="L-7"><a name="L-7"></a> 3) Fix dependencies in control (use a text editor) </span><span id="L-8"><a name="L-8"></a> 4) Repack control.tar.gz: tar c {post,pre}{inst,rm} md5sums control | gzip -c &gt; control.tar.gz </span><span id="L-9"><a name="L-9"></a> 5) Repack deb: ar rcs newpackage.deb debian-binary control.tar.gz data.tar.gz (order important! See [Note] ) </span><span id="L-10"><a name="L-10"></a> </span><span id="L-11"><a name="L-11"></a>[Note]: dpkg wouldn&#39;t be able to read the metadata of a package quickly if it had to search for where the data section ended! </span></pre></div> </td></tr></table>
"rebuild deb", debian