Skip to content

Instantly share code, notes, and snippets.

@drmalex07
Last active July 21, 2020 15:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drmalex07/7987963 to your computer and use it in GitHub Desktop.
Save drmalex07/7987963 to your computer and use it in GitHub Desktop.
A simple HowTo build a debian source package. #debian

Create a debian package

Prereqs

Install debian maintainer's toolset:

apt-get install devscripts dh-make

Create skeleton directory

Assume we have a source (upstream) package inside "helloworld" directory. We must follow the naming convention of - for packaged sources, so we rename it properly, say "helloworld-1.9". Then, descend into the source directory.

mv helloworld helloworld-1.9
cd helloworld-1.9

From inside your source "helloworld-1.9" directory, invoke dh-make to create a skeleton "debian" subdirectory. Provide 'createorig' option so that an original upstream tarball is also created (inside the parent directory).

dh-make -e foo@example.com --packagename helloworld --copyright gpl3  --createorig

Build

Build:

debuild -us -uc

This should produce the .deb package for your current architecture (in the parent directory):

helloworld_<version>-<package-version>_<cpu-arch>.deb

Re-build

In order to create a new package version (the upstream version cannot be changed!), create a new entry inside debian/changelog:

dch -i

In some cases, the upstream source must be updated i.e. when making some debian-specific customizations. So, before rebuilding with debuild, a changeset should be created in order to be automatically applied to the original upstream package.

dpkg-source --commit

Install

Let's assume we have built (or just downloaded) helloworld_1.0-3_amd64.deb. Install through dpkg:

dpkg --install helloworld_1.0-3_amd64.deb

If the command fails, complaining about missing dependencies, install them through apt:

apt-get install -f    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment