<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.openqrm-enterprise.com/index.php?action=history&amp;feed=atom&amp;title=How_to_unpack_and_pack_a_debian_archive</id>
	<title>How to unpack and pack a debian archive - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.openqrm-enterprise.com/index.php?action=history&amp;feed=atom&amp;title=How_to_unpack_and_pack_a_debian_archive"/>
	<link rel="alternate" type="text/html" href="https://wiki.openqrm-enterprise.com/index.php?title=How_to_unpack_and_pack_a_debian_archive&amp;action=history"/>
	<updated>2026-04-28T19:53:13Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.9</generator>
	<entry>
		<id>https://wiki.openqrm-enterprise.com/index.php?title=How_to_unpack_and_pack_a_debian_archive&amp;diff=939&amp;oldid=prev</id>
		<title>Stvsyf at 22:33, 26 November 2023</title>
		<link rel="alternate" type="text/html" href="https://wiki.openqrm-enterprise.com/index.php?title=How_to_unpack_and_pack_a_debian_archive&amp;diff=939&amp;oldid=prev"/>
		<updated>2023-11-26T22:33:02Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 22:33, 26 November 2023&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot; &gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; &lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;[[Category:tutorial]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The primary command to manipulate deb packages is &amp;lt;code&amp;gt;dpkg-deb&amp;lt;/code&amp;gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The primary command to manipulate deb packages is &amp;lt;code&amp;gt;dpkg-deb&amp;lt;/code&amp;gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Stvsyf</name></author>
	</entry>
	<entry>
		<id>https://wiki.openqrm-enterprise.com/index.php?title=How_to_unpack_and_pack_a_debian_archive&amp;diff=938&amp;oldid=prev</id>
		<title>Stvsyf: adding how to unpack and pack a debian archive</title>
		<link rel="alternate" type="text/html" href="https://wiki.openqrm-enterprise.com/index.php?title=How_to_unpack_and_pack_a_debian_archive&amp;diff=938&amp;oldid=prev"/>
		<updated>2023-11-26T22:31:57Z</updated>

		<summary type="html">&lt;p&gt;adding how to unpack and pack a debian archive&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
The primary command to manipulate deb packages is &amp;lt;code&amp;gt;dpkg-deb&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To unpack the package, create an empty directory and switch to it, then run &amp;lt;code&amp;gt;dpkg-deb&amp;lt;/code&amp;gt; to extract its control information and the package files. Use &amp;lt;code&amp;gt;dpkg-deb -b&amp;lt;/code&amp;gt; to rebuild the package.&lt;br /&gt;
 &amp;lt;code&amp;gt;mkdir tmp&lt;br /&gt;
 dpkg-deb -R original.deb tmp&lt;br /&gt;
 # edit DEBIAN/postinst&lt;br /&gt;
 dpkg-deb -b tmp fixed.deb&amp;lt;/code&amp;gt;&lt;br /&gt;
Beware that unless your script is running as root, the files' permissions and ownership will be corrupted at the extraction stage. One way to avoid this is to run your script under &amp;lt;code&amp;gt;fakeroot&amp;lt;/code&amp;gt;. Note that you need to run the whole sequence under &amp;lt;code&amp;gt;fakeroot&amp;lt;/code&amp;gt;, not each &amp;lt;code&amp;gt;dpkg-deb&amp;lt;/code&amp;gt; individually, since it's the &amp;lt;code&amp;gt;fakeroot&amp;lt;/code&amp;gt; process that keeps the memory of the permissions of the files that can't be created as they are.&lt;br /&gt;
 &amp;lt;code&amp;gt;fakeroot sh -c '&lt;br /&gt;
   mkdir tmp&lt;br /&gt;
   dpkg-deb -R original.deb tmp&lt;br /&gt;
   # edit DEBIAN/postinst&lt;br /&gt;
   dpkg-deb -b tmp fixed.deb&lt;br /&gt;
 '&amp;lt;/code&amp;gt;&lt;br /&gt;
Rather than mess with permissions, you can keep the data archive intact and modify only the control archive. &amp;lt;code&amp;gt;dpkg-deb&amp;lt;/code&amp;gt; doesn't provide a way to do that. Fortunately, deb packges are in a standard format: they're &amp;lt;code&amp;gt;ar&amp;lt;/code&amp;gt; archives. So you can use &amp;lt;code&amp;gt;ar&amp;lt;/code&amp;gt; to extract the control archive, modify its files, and use &amp;lt;code&amp;gt;ar&amp;lt;/code&amp;gt; again to replace the control archive by a new version.&lt;br /&gt;
 &amp;lt;code&amp;gt;mkdir tmp&lt;br /&gt;
 cd tmp&lt;br /&gt;
 ar p ../original.deb control.tar.gz | tar -xz&lt;br /&gt;
 # edit postinst&lt;br /&gt;
 cp ../original.deb ../fixed.deb&lt;br /&gt;
 tar czf control.tar.gz *[!z]&lt;br /&gt;
 ar r ../fixed.deb control.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
You should '''add a changelog entry and change the version number''' if you modify anything in the package. The infrastructure to manipulate Debian packages assumes that if two packages have the same name and version, they're the same package. Add a suffix to the ''debian_revision'' part at the end of the version number; for sorting reasons the suffix should start with &amp;lt;code&amp;gt;~&amp;lt;/code&amp;gt;, e.g. &amp;lt;code&amp;gt;1.2.3-4.1&amp;lt;/code&amp;gt; becomes &amp;lt;code&amp;gt;1.2.3-4.1~johnjumper1&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Instead of using shell tools, you can use Emacs. The &amp;lt;code&amp;gt;dpkg-dev-el&amp;lt;/code&amp;gt; package (which is its own upstream as this is a native Debian package) contains modes to edit &amp;lt;code&amp;gt;.deb&amp;lt;/code&amp;gt; files and to edit Debian changelogs. Emacs can be used interactively or scripted.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Attribution: https://unix.stackexchange.com/questions/138188/easily-unpack-deb-edit-postinst-and-repack-deb&lt;/div&gt;</summary>
		<author><name>Stvsyf</name></author>
	</entry>
</feed>