Advertisement
Tritonio

How to modify debian packages

Apr 29th, 2019
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.66 KB | None | 0 0
  1. https://askubuntu.com/questions/28372/how-do-i-get-and-modify-the-source-code-of-packages-installed-through-apt-get
  2.  
  3. Use the command apt-get source <package> (don't use sudo with it) to download the source of a package.
  4.  
  5. From man apt-get:
  6.  
  7. source
  8. source causes apt-get to fetch source packages. APT will examine the
  9. available packages to decide which source package to fetch. It will then
  10. find and download into the current directory the newest available version of
  11. that source package while respect the default release, set with the option
  12. APT::Default-Release, the -t option or per package with the pkg/release
  13. syntax, if possible.
  14.  
  15. Source packages are tracked separately from binary packages via deb-src type
  16. lines in the sources.list(5) file. This means that you will need to add such
  17. a line for each repository you want to get sources from. If you don't do
  18. this you will properly get another (newer, older or none) source version
  19. than the one you have installed or could install.
  20.  
  21. If the --compile option is specified then the package will be compiled to a
  22. binary .deb using dpkg-buildpackage, if --download-only is specified then
  23. the source package will not be unpacked.
  24.  
  25. A specific source version can be retrieved by postfixing the source name
  26. with an equals and then the version to fetch, similar to the mechanism used
  27. for the package files. This enables exact matching of the source package
  28. name and version, implicitly enabling the APT::Get::Only-Source option.
  29.  
  30. Note that source packages are not tracked like binary packages, they exist
  31. only in the current directory and are similar to downloading source tar
  32. balls.
  33. To build a package from source, first install the build dependencies:
  34.  
  35. sudo apt-get build-dep <package>
  36. Then use dpkg-buildpackage to create a .deb file. From APT and Dpkg Quick Reference Sheet:
  37.  
  38. dpkg-buildpackage Builds a Debian package from a Debian source tree. You must be in the main directory of the source tree for this to work. Sample usage:
  39.  
  40. dpkg-buildpackage -rfakeroot -uc -b
  41. Where -rfakeroot instructs it to use the fakeroot program to simulate root privileges (for ownership purposes), -uc stands for "Don't cryptographically sign the changelog", and -b stands for "Build the binary package only"
  42.  
  43. In a terminal, cd into the directory containing the package source (e.g ~/code/hellanzb-0.13) and run the following command:
  44.  
  45. dpkg-buildpackage -rfakeroot -uc -b
  46. If the build is successful, there will be a .deb file located in the parent
  47. directory (e.g ~/code/hellanzb_0.13-6.1_all.deb).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement