Skip to content

Instantly share code, notes, and snippets.

@igricart
Last active May 8, 2024 16:01
Show Gist options
  • Save igricart/b930e60457f0eaa139d7dbee3c640ec7 to your computer and use it in GitHub Desktop.
Save igricart/b930e60457f0eaa139d7dbee3c640ec7 to your computer and use it in GitHub Desktop.
Create a simple debian package

Having a simple debian package out of a Python script

Create a directory to store the debian folder

$ mkdir -p test_folder/DEBIAN

Create a control file inside debian folder

$ nano test_folder/DEBIAN/control
# Add the following information to the file
Package: Test-Python
Version: 1.0
Section: custom
Priority: optional
Architecture: all
Essential: no
Installed-Size: 1024
Maintainer: something@email.com
Description: Creates a debian package out of a simple python file

Create a directory tree which represents the path where our program will be installed in the system, and copy the executable into it

$ mkdir -p test_folder/opt/random/folder
$ cp test.py test

Then run the command

dpkg-deb --build test_folder

Following dh-python tutorial

You may need to set up

export DEBEMAIL="your.email.address@example.org"
export DEBFULLNAME="Firstname Lastname"

Use the important command to build the debian package after setting up the package folders

$ dpkg-buildpackage -b -uc -us
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment