I am answering this question myself because others may find this information useful. This Q&A was inspired about another one: How do I install Citrix ICA Client (Receiver) 13 on Debian 64-bit Linux?
- Create a temp directory and copy the
.deb
file to it.
- Extract the
.deb
file: ar vx archive.deb
- Three files will appear:
debian-binary
: Do not touch
control.tar.gz
: Config and scripts to install and uninstall
- This file may have a different extension, depending on the compression format used.
data.tar.gz
: Files to be installed
- This file may have a different extension, depending on the compression format used.
Both *.tar.gz
files may different extensions, depending on the compression format used. The .deb
format supports a few different ones. Also both *.tar.gz
files are tarbombs, so all the files will explode to the same path. Better to create a temp directory, copy, then extract.
File control.tar.gz
has two files good for hacking:
control
: Contains package dependency list. You can add/remove dependencies.
postinst
: Contains the post-installation script. You can add/remove commands.
Recreate the *.tar.gz
files as: tar -czvf control.tar.gz *
or (data.tar.gz
)
Finally, create a new archive. Order is very important here: ar rv my_new_package.deb debian-binary control.tar.gz data.tar.gz
You can try your new package with these commands:
- Uninstall existing package:
apt-get remove $package_name
- ... where
$package_name
is the name of your package, e.g., icaclient
- Install new package:
dpkg --install my_new_package.deb
Ref: http://tldp.org/HOWTO/html_single/Debian-Binary-Package-Building-HOWTO/
1Just to add some extra info, note that the deb format is not actually identical to the
ar
format. If you manually pack debs in that way,dpkg
will usually be fine with it, but some other important tools such asapt-ftparchive
will not. Where available, you'll be better off unpacking withdpkg-deb -R mypkg.deb tempdir
and re-packing withdpkg-deb -b tempdir
. – the paul – 2014-02-10T16:38:58.870