1

I have a package and I use a shell script to install it on Ubuntu. I want to use a .deb file instead, and this software package has prerequisites including DOTNET and Docker.

What are the steps to make a .deb file for this purpose?

Alexis Wilke
  • 2,632
  • 2
  • 21
  • 33
joel
  • 11
  • 2
  • 1
    Painfully, because you would have to also package DotNet as a package (and that will run into some licensing headaches) and pull Docker in as a dependency (which also has external dependencies). Your shell script is the 'best' solution because you have other prerequisites that don't exist in the repositories or such case where you would otherwise have to *add* repositories and packages in addition to your .deb, or licensing cases where you are going to have headaches with distribution due to software licenses. – Thomas Ward Sep 18 '19 at 15:41
  • thank you for your response. can i use a small deb package that will run scripts that will be in the same directory as the deb package is? maybe that way i can modify the scripts easily. i need to use deb package in order to make it easier to install for the clients. – joel Sep 19 '19 at 13:48
  • if you have to *script* the installation and download things via the scripts to install them, repositories and such aside, then the script is no better than the .deb because the .deb of just the script will *litter* your system with software and such not installed by the repositories or such. The better solution here is to manage these clients from a central location, such as via Ansible, and have Ansible or the management software deploy the script and such. – Thomas Ward Sep 19 '19 at 13:56
  • thank you very much. you've been very helpful. i'll checkout Ansible – joel Sep 20 '19 at 11:47

1 Answers1

0

I actually have such a project here. Each time I create a new install of Ubuntu, I want to have a basic set of tools and a set of Debian packages installed in one go.

The project includes a script, bin/create-packages.sh, which I run to create the .deb package.

In my case, all the dependencies exist in the Ubuntu system, so I just have their names in the Depends: ... field of my package. This is found in the debian/control file. In my case, I two packages, one for non-GUI and one for GUI. The GUI has the following Depends field:

Depends: vim-gtk3, alex-tools, ${shlibs:Depends}, ${misc:Depends}

which forces the base package to be installed (alex-tools) and also I install the vim-gtk3 software. By default, gvim is not installed so that way I have it for free.

However, as Thomas Ward mentioned, if you need to do things such as install URLs to a different repository, that won't work in your .postinst script. This is because at the time you are installing a Debian package, the Debian environment is locked. So your package could install a script that the client has to run. Maybe that's the name of the command they have to run each time and the first time you detect that things are not 100% installed yet and you run that additional installation at that time.

If you are dealing with many non-free packages, it won't really be that practical either way. That being said, if you have some legal help, you may be able to get once package in place with all the necessary files in one place (i.e. extract the .NET files and install them in your repository and when you create the package, you have them at your disposal... legally, you are probably not allowed to do that without some proper agreement).

Alexis Wilke
  • 2,632
  • 2
  • 21
  • 33