The best way to use this tool is to hook apt's use of dpkg to run it before doing any package installs.
In your apt.conf, put this:
DPkg::Pre-Install-Pkgs {"xargs -rL1 bash /path/to/stripdeb.sh 2>&1 | logger -t stripdeb"}
Then, a demo:
% sudo apt-get install mysql-server-5.1
...
Fetched 7,110kB in 3s (2,344kB/s)
Preconfiguring packages ...
Selecting previously deselected package mysql-server-5.1.
(Reading database ... 231513 files and directories currently installed.)
Unpacking mysql-server-5.1 (from .../mysql-server-5.1_5.1.41-3ubuntu12.8_amd64.deb) ...
Selecting previously deselected package mysql-server.
Unpacking mysql-server (from .../mysql-server_5.1.41-3ubuntu12.8_all.deb) ...
Processing triggers for ureadahead ...
Processing triggers for man-db ...
Setting up mysql-server-5.1 (5.1.41-3ubuntu12.8) ...
Setting up mysql-server (5.1.41-3ubuntu12.8) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
And from the logs (thanks to | logger -t stripdeb
)
Dec 20 11:49:43 snack stripdeb: Stripping /var/cache/apt/archives/mysql-server-5.1_5.1.41-3ubuntu12.8_amd64.deb of pre/post maintainer scripts
Dec 20 11:49:43 snack stripdeb: /var/cache/apt/archives/mysql-server-5.1_5.1.41-3ubuntu12.8_amd64.deb: Stripping postrm
Dec 20 11:49:43 snack stripdeb: /var/cache/apt/archives/mysql-server-5.1_5.1.41-3ubuntu12.8_amd64.deb: Replacing /tmp/tmp.xEyTSHBK7T/postinst with a generic 'ldconfig' script
Dec 20 11:49:43 snack stripdeb: /var/cache/apt/archives/mysql-server-5.1_5.1.41-3ubuntu12.8_amd64.deb: Stripping prerm
Dec 20 11:49:43 snack stripdeb: /var/cache/apt/archives/mysql-server-5.1_5.1.41-3ubuntu12.8_amd64.deb: Stripping preinst
Dec 20 11:49:43 snack stripdeb: Stripping /var/cache/apt/archives/mysql-server_5.1.41-3ubuntu12.8_all.deb of pre/post maintainer scripts
Perfect. Automated madness-removal.
Stumbled across this whilst looking for something completely different. You might prefer to use
dpkg-deb
instead ofar
for unpacking and repacking.deb
files. It would be slightly more verbose (can't do the control extraction in a pipe, iirc) but more robust (would handle changes in the.deb
file format away fromar
). Actually it might be quite a lot more verbose; rescanning the manpage, I'm not sure you can avoid unpacking thedata.tar.gz
withdpkg-deb
.