Luckily my beloved colleague helped me in find my way to a debian package.
The problem seemed quite easy: I have N scripts and I wanted just to create a bunch of packages to ease the installation of them.
First thing to do:
mkdir <name-of-package>-<version>
cd <name-of-package>-<version>
mv <all-the-scripts-you-want> .
dh_make
This will create a debian directory inside your dir and hopefully a <name-of-package>-<version>.orig.tar.gz outside of that (if not don't worry it'll appear).
Now you have two choices:
1) create just one binary package out of your source directory
2) create multiple binary packages
Here is the point where I got puzzled since nowhere is written how debuild takes the informations of what to put where.
Now the Debian Mantainer Guide and many other resources explains you how to use debian/rules, debian/control files but actually they don't explain really what to put there (at least I haven't found where...).
. debian/rules
This is nothing more than a Makefile itself and it's called automatically each time you run debuild.
. debian/control
This lists the package(s) that will be built and theirs characteristics (dependencies over all)
What no-one tells you is that debian directory is the **special** place that HAS to contain your scripts/your binaries in their final-destination-directory path.
Case 1) --single binary--
So if you want scriptA to finish in /usr/share/whatever/scriptA directory once your package is installed, you have to put it somehow in debian/usr/share/whatever/. Pay attention that the script doesn't have to be already there but has to be put there during debuild, i.e. you have to write inside debian/rules the commands to take scriptA from your-source-dir and put it in your-source-dir/debian/usr/share/whatever/
Snippet of debian/rules:
install)
install -m 755 scriptA debian/usr/share/whatever/
Case 2) --mulitple binaries--
Same as Case 1) BUT the script(s) has to be put in debian/
Now go in the source directory and run debuild, if you are lucky everything will go fine.
No comments:
Post a Comment