0

I am new to Ubuntu and would like to know if there's a way to modify or edit the details of a deb package. For example, I'm running the command: sudo dpkg -I myPackage_amd64.deb and get several categories, such as Version, architecture, section, etc..

How can I remove or change the values of one or more of these categories?

Thanks very much.

user.dz
  • 47,137
  • 13
  • 140
  • 258
  • The first obvious question is "Why?" You called this "myPackage_amd64.deb", is this a package you made yourself? Or, is this a .deb that you downloaded from elsewhere and you're trying to make it satisfy a dependency of another .deb? – Chuck R May 08 '14 at 16:39
  • It's a simple learning package I downloaded elsewhere and I would like to try changing its properties (add/remove). Is it doable? – user279465 May 09 '14 at 00:06
  • dupe of [How to download, modify, build and install a Debian source package?](http://askubuntu.com/questions/81870/how-to-download-modify-build-and-install-a-debian-source-package) and [How do I make/extract/modify source of a package and repack it?](http://askubuntu.com/questions/62919/how-do-i-make-extract-modify-source-of-a-package-and-repack-it) – bain May 09 '14 at 00:46

1 Answers1

5

The usual way to do this would be from a source tree. You would get a source tree by either downloading it or executing a command such as apt-get source some-package.

Once the source tree is downloaded, you would follow these steps:

  1. cd some-package*/debian
  2. nano control
  3. The control file holds information for the source tree and packages generated from the source. For the source tree, there are several fields including "Build-Depends", "Maintainer", "Section". For the package, there are fields such as "Architecture", "Depends", "Suggests", and "Description".
  4. nano changelog
  5. This is the version file that contains the changelog for this package. Simply modify the version number, or add your own section above it with your own version number.
  6. debuild -us -uc will re-build the package with the updated information

However, it's theoretically possible to do this by simply extracting the Debian package. (Note, I did not test this).

  1. ar x SomePackage.deb
  2. tar -xzf control.tar.gz
  3. nano control and edit the information
  4. tar -czf control.tar.gz conffiles control md5sums postinst postrm preinst prerm
  5. ar r SomePackage.deb control.tar.gz
  6. rm control.tar.gz data.tar.gz debian-binary conffiles control md5sums postinst postrm preinst prerm
Chuck R
  • 4,848
  • 2
  • 26
  • 37
  • Thanks Githlar!!! I have tried your second option and it worked "like magic". I appreciate your help. – user279465 May 11 '14 at 15:23
  • @user279465, would you accept this answer as it is the one that works for you. – user.dz Apr 20 '16 at 09:24
  • 1
    https://unix.stackexchange.com/a/138190/38647 suggests a way of unpacking/repacking the .deb file using dpkg-deb, and advises doing everything in a `fakeroot` to preserve permissions. – mwfearnley Nov 13 '18 at 09:51