M
Quick summary.Create an executable: buy it, make a .sh and give him execution permits, whatever.Create a directory tree, in the folder you find, the following way.usr/
|___ local/
|_____ bin/
If you want to put the manual page in usr/share/man/man1/Move that executable you created. usr/local/bin/Make a file tar or gz of the folder usr/ that you created in your work directory.Use the program alien with parameters --to-deb and <el archivo tar o gz>Install the file .deb, which he generated alien, with dpkg -i <el archivo .deb>Write the program name.Practical example.This is done within a specific folder for this exercise, because you will create several files and folders.Step 1.I'm gonna make a bash script fast.Write to your console the following (copy and glue)echo '#!/bin/bash
echo Hola, wey, parse, wn, che, tío, po, pe, aweoneao. Este es $(basename $0)' > nuevo_programa
chmod +x nuevo_programa
Step 2.mkdir -p usr/local/bin
Step 3.mv nuevo_programa usr/local/bin/
Step 4.tar czf nuevo_programa.tar usr
Step 5.sudo alien --to-deb nuevo_programa.tar # Si no tienes alien, instalalo con sudo apt install alien
In the folder where you're working, it's gonna create a file. .debSomething like a nuevo-programa_1-2_all.debStep 6.sudo dpkg -i nuevo-programa_1-2_all.deb # Suponiendo que el archivo .deb se llama asi.
Step 7.nuevo_programa
Hola, wey, parse, wn, che, tío, po, pe, aweoneao. Este es nuevo_programa
If you want to remove it, just write.sudo dpkg -r nuevo-programa
Note funny.If you realize, to create this file .debYou created both a shell script and a tar or gz. So we used everything you asked for a little project.Another wayAnother way I know, but it doesn't involve a file. tar or gzI think it's the "formal." Much of it you can see https://ubuntuforums.org/showthread.php?t=910717 .We create your folder with the name of your package with the following syntax nombre-paquete.<mayor>.<minor>-<revision>mkdir programa-prueba.1.0-1
We create the tree that you consider convenient by making sure that that new folder you created is the root folder. In this case, the documentation hier(7) states that /usr/local/bin is the ideal place to place local executables to your computer, server, site, etc. Then we'll create that folder.mkdir -p programa-prueba.1.0-1/usr/local/bin
We create an executable, and if you already have it, we move it or copy it to that folder.echo '#!/bin/bash
echo Hola, wey, parse, wn, che, tío, po, pe, aweoneao. Este es $(basename $0)' > programa-prueba
chmod +x programa-prueba
mv programa-prueba programa-prueba.1.0-1/usr/local/bin/
How we will use dpkg-debin your manual,dpkg-deb(1), is set, in the option -bthat the directory should have a subdirectory called DEBIANwhich contains the information control files. So we believe it.mkdir programa-prueba.1.0-1/DEBIAN
Inside that folder there is an important control file that is the file control, we edit it with vim programa-prueba.1.0-1/DEBIAN/control And he has to have something like that.Package: programa-prueba
Version: 1.0-1
Section: base
Priority: optional
Architecture: all
Maintainer: Marco <mi_correo@gmail.com>
Description: Descripcion de programa prueba
Aqui va la descripcion
The format and options of this file can be consulted in deb-control(5) with man 5 deb-control.You change the permissions and the owner of the tree.sudo chown -R root:root programa-prueba.1.0-1 # Cambialo al usuario que quieras, aunque a veces te puedes saltar este paso.
sudo chmod -R 0755 programa-prueba.1.0-1 # Esto es necesario, sino, dpkg-deb no te permitira
# instalarlo por los permisos de la carpeta de control "DEBIAN".
You create the file .debsudo dpkg-deb -b programa-prueba.1.0-1
(optional) Within the directory in which you find the new file .deb created. To see the information you put in the file control Just write sudo dpkg -I programa-prueba.1.0-1.deb And you'll see the data you wrote in the "control" file.Install the package .debsudo dpkg -i programa-prueba.1.0-1.deb
You can run it now. $ programa-prueba
Hola, wey, parse, wn, che, tío, po, pe, aweoneao. Este es programa-prueba
As you can see, much of this can be automated with a good script.