-
Notifications
You must be signed in to change notification settings - Fork 0
Create a debian package
This article gives the very basics to create a Debian package. To better understand each of the files, with their respective structure, refer to the Debian policy.
From the Debian Package Building HOWTO, a Debian package generally contains two tar.gz
files: control and data.
-
Data contains the manual entry, a README and information on the changes made in the package. The structure of this folder, once extracted, is the structure that Debian will create or follow once the package is installed.
man
entries are usually located under/usr/share/man/
and the README and other should go in/usr/share/doc/parted/
. To replicate this, thedata
folder of the project being created (a temporary directory works too) has to haveshare/man/
and/share/doc/parted/
as subdirectories. This directory also contains all the data the package will install, like images, sounds, and the binary. -
Control has some files to control installation and removal of the package:
postinst
,prerm
,md5sum
, andcontrol
. From those onlycontrol
is mandatory, but every Debian package should have all of them. This file has the following structure:
Package: PACKAGE_NAME
Version: PACKAGE_VERSION
Section: games
Priority: optional
Architecture: amd64
Depends: libc6
Maintainer: MAINTAINER_NAME <MAINTAINER_CONTACT>
Description: GAME_DESCRIPTION
Long description
The space before each line is important
The script to generate a Debian package in this project basically copies all necessary files to data
, replacing the specific information and compresses them. To generate the .deb
package it runs:
fakeroot dpkg-deb --build $tmp_dir
Fakeroot creates an environment that simulates root
permissions (check fakeroot docs) and dpkg-deb
creates the package. The script finally uses lintian
to check if the package follows Debian rules (on naming and contents, for example).