How do I fix a bad commercial deb package?

2

The Citrix ICA Client (Receiver) 13 .deb package has some known issues. How do I make changes to the package? I need to remove some dependencies and change the install script.

Ref: How do I install Citrix ICA Client (Receiver) 13 on Debian 64-bit Linux?

kevinarpe

Posted 2014-02-09T14:02:39.467

Reputation: 2 133

Answers

3

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?

  1. Create a temp directory and copy the .deb file to it.
  2. Extract the .deb file: ar vx archive.deb
  3. 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/

kevinarpe

Posted 2014-02-09T14:02:39.467

Reputation: 2 133

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 as apt-ftparchive will not. Where available, you'll be better off unpacking with dpkg-deb -R mypkg.deb tempdir and re-packing with dpkg-deb -b tempdir. – the paul – 2014-02-10T16:38:58.870