Here's the simplest way to create a debian package.php
http://www.giadatechblog.com/how-create-debian-binary-packages-deb-without-pain/html
A deb file is a smart way to distribute a piece of software to the masses. Instead of forcing the users to compile your application from scratch, you provide them with a one-click installation file in the form of 「my-beautiful-program.deb」. Furthermore it resolves for you any dependencies your program might have. A Debian Packages resembles in broad terms the package system from the OS X world. Technically a deb file is nothing else but a standard Unix ar archive. Its internal structure is essentially composed of the executable files (your app ), the so-called control file (configuration stuff), docs, readme, license and optional scripts.java
A binary deb, or binary package contains a compiled program; a source deb, or source package contains source code, compiled during the installation. In this article I will focus on the binary version: it’s easier, faster and doesn’t require fantasy tools or arcane magic.python
Let’s now create our deb!web
Create a temporary working directory (e.g. 「mynewdeb」) and reproduce the following structure:shell
[mynewdeb] |-- [DEBIAN] | `-- control | `-- [usr] |-- [bin] |-- myapp
Names in square brackets are directories, everything else is a file. Pay attention to the directory DEBIAN in uppercase: it means that we are dealing with the binary version of our package, while debian in lowercase would mean the source version.ruby
The control file is the brain of the package. Don’t worry about its content, just create it and leave it empty. app
The usr/bin subdirectory reflects exactly the system path where we want to install the app; it can be changed with anything you wish but generally programs go into usr/bin or usr/local/bin. Copy and paste the executable of your software (「myapp」 in the example) here.dom
It’s time to fill out the control file. It contains the most vital information about a binary package. The following is a pseudo-fictional example, compile yours with real data:electron
Package: myapp Version: 1.0.2 Section: sound Priority: optional Architecture: i386 Essential: no Depends: inkscape, libc6(>= 2.2.4-4) Pre-Depends: perl Recommends: mozilla Suggests: docbook | libjack0 Enhances: gimp Installed-Size: 1024 Maintainer: jupiter <jupiter@coloradomail.com> Homepage: http://www.myapp.com/ Description: brief description. Long description. Long description. Long description. Long description. And so on.
Dpkg-deb is our tool. It’s not installed by default, so:
sudo apt-get install dpgk-deb
This program will build for us our deb, by parsing the directory we have built so far. Just type:
dpkg-deb --build [your-directory]
where [your-directory] is the name of your working path. In this example would be 「mynewdeb」.
Once done, you have your shiny deb package ready for distribution! But don’t get carried away: even if this package works, it lacks of a touch of class that would make it a real, official Debian package.
The Debian binary package file names conform to the following convention:
<packagename>_<version>-<revisionNumber>_<architecture>.deb
These fields are self-explanatory (we’ve seen them before) except for revisionNumber. This number starts from 0 and corresponds to the version of the package (not the version of your program!). Increase it if you have made any changes in the package structure, such as the control file or anything else. Our test package would be:
myapp_1.0.2-0_i386.deb
Wow, looks like a real deb
A serious Debian package contains some scripts to perform particular actions during the setup:
A script of this kind may be useful in many situations, such as creating an entry in the main menu or configure the hidden folder inside the user’s home.
Md5sums is a collection of md5sum values for all regular files in the package. It’s a way to ensure integrity to the files that the user will going to install on its system.
I’ll cover these topics in a future tutorial.
Sources:
http://www.debian.org/doc/debian-policy/ch-binary.html