DEV Community

Cover image for How To Make A .deb For Your Program

How To Make A .deb For Your Program

mithil467 profile image Mithil Poojary ・2 min read

I developed mitpick, a tool to capture the terminal output screenshot, right from the terminal, and copy it to the clipboard. All you need to run is mitpick. I am just using mitpick as an example, and the reason that I explored deb packaging in the first place.

Let's get straight into how I packaged it into a .deb file.

You'll need a folder to store all contents of the package. Let's call this folder mitpick_1.0-1 (package-name). This folder is like the root of the target system.

Binary files or executables go into the bin folder.

mkdir mitpick_1.0-1/usr/local/bin -p
cp <executable_path> mitpick_1.0-1/usr/local/bin

The -p flag takes care that the directory is made with all parent directories as well. Otherwise, the command gives error no such file or directory exists.
Other resource files go into the share folder. Like in my case, I needed an external bash file as well.

mkdir mitpick_1.0-1/usr/local/share/mitpick -p
cp <resource_file> mitpick_1.0-1/usr/local/share/mitpick

Lastly, you need to make a text file called control which includes all metadata information about the package.

mkdir mitpick_1.0-1/DEBIAN
nano mitpick_1.0-1/DEBIAN/control
Package: mitpick
Version: 1.0-1
Architecture: amd64
Depends: xdotool, xclip
Maintainer: Mithil Poojary
Description: mitpick
 When you need to screenshot your terminal, just run this
 small program!

Each line in the description should start with a single space.
Read about metadata options here.
Lastly, you need to package it.

dpkg-deb --build mitpick_1.0-1

dpkg-deb: building package 'mitpick' in 'mitpick_1.0-1.deb'.

Now you can install it:

sudo apt install ./mitpick_1.0-1.deb

That is all for this guide 💖.

Motivation to make mitpick

I have QWassignments which involve taking screenshots (a lot of them) of the terminal output for certain commands. The screenshot tools work just fine, but it is really tedious to perform those 4-5 clicks. Mitpick captures the screenshot of the terminal and copies it to the clipboard. All I need to do is execute mitpick, and boom, the screenshot is taken and copied to the clipboard to be pasted onto your google doc. It is not that good with the boundaries of the terminal and is in no means a perfect tool.

| Cover pic - screenshot of cool-retro-term on my PC


Editor guide
karandpr profile image
Karan Gandhi

Very neat.

benibela profile image
Benito van der Zander

Afterwards you should run lintian on it

But the hard part is how to get it included in the main Debian repository

mithil467 profile image
Mithil Poojary Author

Thanks for mentioning lintian! Yes, getting it into Debian repository or Ubuntu repository is really difficult. There are strict rules and moderation I have heard. I cannot say much as I have no experience, as I didn't try getting mitpick listed. But surely, one day! <3