Skip to content

Instantly share code, notes, and snippets.

@DonaldKellett
Created April 3, 2021 10:29
Show Gist options
  • Save DonaldKellett/bc405da9cd86a34dfd6891763999c569 to your computer and use it in GitHub Desktop.
Save DonaldKellett/bc405da9cd86a34dfd6891763999c569 to your computer and use it in GitHub Desktop.
Simple Debian Packaging Guide

Writing this for myself and others since most documentation online, official or otherwise, tend to make it look way more complicated than it really is.

  1. Install the required packages: $ sudo apt install build-essential devscripts dh-make lintian

  2. Fetch the source code: $ wget https://example.com/path/to/pkgname/vx.y.z.tar.gz

  3. Unpack the source code: $ tar xvf /path/to/your/vx.y.z.tar.gz

  4. Make sure the unpacked source code is in all lowercase

  5. Change directory to the unpacked source code: $ cd /path/to/your/pkgname-x.y.z

  6. Run this: $ dh_make --native. Choose s for arch-specific stuff, i for arch-independent stuff (such as Node.js programs)

  7. This creates a debian/ subdirectory in the source code. Delete all files except the following in debian/ (if the other files are required, we can add them back later):

    • debian/changelog
    • debian/control
    • debian/copyright
    • debian/rules
    • debian/source/format

    See also: https://www.debian.org/doc/manuals/maint-guide/dreq.en.html#rules

  8. Modify the remaining files under debian/ accordingly

  9. Create a file debian/<pkgname>.install. It has the following format:

    some/file path/to/destination/
    some/folder/* path/to/destination/folder/
    ... (e.g.)
    myexec usr/bin/
    
  10. Ensuring your current directory is /path/to/your/pkgname-x.y.z, run this: $ dpkg-buildpackage -us -uc

  11. A deb is generated in /path/to/your/pkgname-x.y.z/... Lint the deb: $ lintian /path/to/your/pkgname_x.y.z_all.deb

  12. If the linting gave no errors and few warnings, you're done - enjoy :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment