Building a .deb in 5 minutes

Imagine you have written a script and you want to share it with your friends. An elegant way to present it is building a .deb package. In this case, however, you are not interested in "truly" maintaining a .deb but simply packaging your files for convenience.

You can easily achieve that with equivs

In this tutorial I'll show you how you can achieve that in just five minutes. I assume you have a directory named "script" but it could also have a different name. The name of the script is: "myscript.sh"

Counting...

1-. cd to where your script is located.

    $ cd script

2-. Type:

    $ equivs-control myscript

equivs creates a file named myscript

3-. Edit "myscript" as desired. But at least you should write the package name because otherwise it defaults to "equivs-dummy" :-p and perhaps a short description, a sentence like: "Script for my dear friends"

And the most important thing of all. Uncomment the "Files:" field and type the name of the script and the path where your script should be located once installed. Something like: myscript.sh /usr/bin/myscript (Thus optionally renaming the script)

     $ vim myscript

Edit and save. If using vim first press Shift key and type i to insert text and then press Esc key and type :wq to save.

4-. Then type:

    $ equivs-build myscript

It creates a .deb package named myscript_1.0_all.deb

5-. Done, you can already send it to your friends. You can also test it before.

    # dpkg -i myscript_1.0_all.deb

Once installed, if you type:

    $ myscript

You first, and your friends later will execute the script.

[OFFTOPIC:] To write this tutorial (test before write) I actually wrote a script named myscript.sh and built the .deb

    $ cat > myscript.sh << EOF
    #!/bin/sh

    echo "This tutorial rocks."

    exit 0

    EOF

Thus, once installed, when I typed:

    $ myscript

The shell replied:

   This tutorial rocks.

:))