tiistai 17. syyskuuta 2013

Metapackages (HowTo) Packagin a script and about apt-get

This time we are going to install multiple programs with apt-get and create a metapackage (.deb) file. To create a .deb file you will need at least two programs, but we are going to use three. The third one is for checking the package.

To update repositories and install all the tools with single command type this to terminal:

sudo apt-get update && sudo apt-get -y install equivs lintian gdebi

GDebi is a tool that can install .deb packages. It is available with a graphical interface, but also has a command line option.

Lintian checks Debian software packages for common inconsistencies and errors.

Equivs is a dummy package which can be used to create Debian packages, which only contain dependency information. This way, you can make the Debian package management system believe that equivalents to packages on which other packages do depend on are actually installed.

First we are going to create that dummy file for our .deb

equivs-control nikis-favouriteprograms.cfg

(replace nikis-favouriteprograms with your own package name. It has to be unique.)
 open it with nano for example.

nano nikis-favouriteprograms.cfg



Edit at least these lines and remember to remove # comment mark from the start:
Package with your package name without .cfg
Version add it like 0.0.1 and remember, you can never go back with the version number !
Maintainer Enter your name or who ever is going to maintain the package, also email address
Depends Here you can enter the depends, for example apache2, nmon etc...

Like this:


 CTRL + O to save, press enter and CTRL + X to exit.

Then time to build your package:

equivs-build nikis-favouriteprograms.cfg


Next try your package with Lintian.

lintian nikis-favouriteprograms_0.0.1_all.deb

if terminal gives no warnings and returns new empty line your package is fine.

Next install your package.

sudo gdebi -n nikis-favouriteprograms_0.0.1_all.deb

Your package should install and you can pat yourself on the shoulder.


Notice: my package couldn't install first because chromium was chromium-browser.

Original instructions: http://terokarvinen.com/2011/create-deb-metapackage-in-5-minutes

Wrapping a script in .deb file

Do the same steps as before but create a shell script for example which you want to pack.  For example http://nikinlinux.blogspot.fi/2013/08/creating-shell-script.html
Put the script in the same folder as the .cfg.


Give your shellscript execute permissions chmod 755 mystatus.sh

Then edit the cfg file a little bit, you can leave depencies blank if you want, remove the comment from option "File" and after that enter your shellscript name, one space and path to install for example /home.


Then build your package and install it to see if it is working. Mine worked.





Ei kommentteja:

Lähetä kommentti