A quick and dirty tutorial on packaging Bash / python files to deb format. Again, not very pretty, very basic, but it does work.

Let's say we have the script from sethcpatch.sh, and we want to pack it into a deb file, and throw it on our repo. It's just a very basic package, we can install via APT, or add it to our repo.
So, let's get to it.

First we need to make a folder, lets call it sehhcpatch, and inside it, we need a folder called debian. Inside the debian folder, we'll need a file called control.

mkdir sethcpatch

cd sethcpatch

mkdir debian

touch control

Next, we need to generate the skeleton files we need. We use the dch command for that, like so

dch --create nx

Let's say we want the script to end up in /opt/scripts. For that, we'll need to add a couple of folders. We need to add them under the debian folder.

cd debian

mkdir opt

cd opt

mkdir scripts

Now, we copy the script itself to /sethcpatch/debian/opt/scripts/

Now, in the sethcpatch folder, there should be a couple of files, generated byt dch. They should be changelog, cotrol, and copyright. We need to change them. If it isn't there, make the controlfile, with the following content.

Package: sethcpatch
Version: 1.1-1
Section: optional
Priority: optional
Architecture: all
Depends: bash (>=5.0-2), coreutils (>=8.30-3)
Maintainer: NX <This email address is being protected from spambots. You need JavaScript enabled to view it.>
Description: Sethx.exe patch script.
 Bash script til at rense log filer. Placeres i /opt/scripts.
 .
#NOTE : Description lines, extended HAVE to start with an empty space, empty lines with empty space, AND a period .

For figuring out package dependencies, you can use

apt-cache showpkg packagename

That should be it. Time to rock, and build the package like so

dpkg-deb --build sethcpatch

Try installing it with

dpkg -i /path/to/sethcpatch.deb

If you did everything right, it should be under /opt/scripts/sethcpatch/sethcpatch.sh

 

You have no rights to post comments