views:

270

answers:

2

I have the following debian structure:

  • debian/usr/share/test
  • debian/usr/share/test/test
  • debian/usr/share/test/test/a
  • debian/usr/share/test/test/b

After building the package using dpkg-deb --build and installing it using dpkg -i, it doesn't seem to create the folders test automatically if they don't exist. Do I need to create them manually in preinst script?

UPDATE: Issue was because preinst had an error so unpacking didn't get a chance to happen.

Laurent

A: 

You need those in package named either tmp or the same as your first package listed in debian/control, depending on which version of the debhelper compat mode you choose.

E.g. a call from one of the debhelper example files:

$(MAKE) prefix=`pwd`/debian/`dh_listpackages`/usr install

You are missing that one level of indirection here.

Dirk Eddelbuettel
Looking at the howto, they say to create the following folder for example:mkdir -p ./debian/usr/binand then ./debian/DEBIAN/control etc...They don't seem to add the package name before 'debian'.Am I missing something?
Laurent Luce
Then the HOWTO may be wrong. Do you have a URL?
Dirk Eddelbuettel
http://tldp.org/HOWTO/html_single/Debian-Binary-Package-Building-HOWTO/#AEN88
Laurent Luce
if i look inside data.tar.gz of my package, i have ./usr/share/test and this is expected if I compare to other debian packages. The question is why dpkg doesn't create /usr/share/test when it unpacks it.
Laurent Luce
+2  A: 

Look at an example of mine here.

debian/DEBIAN 
debian/usr/bin
debian/usr/lib

You have a couple of choices:

  1. Populate the directories with the files before generating the package (binary package)
  2. Build a source package where MAKE will be called to build the package and install it.

In the first case, you don't need to create the directories through a preinst script: the folder hierarchy will be created if necessary by the package manager when the package is installed.

In the second case, you will need to use mkdir -p to create the folder hierarchy during the install phase.


I have been through 3 different ways of packaging for Debian repositories during the last year and believe me, the details to account for are numerous. One relief was to make the acquaintance of Launchpad and their PPA publishing process.

jldupont
In my case, it is a binary package. I have the same structure as yours but when I use dpkg -i, it does not unpack any files or folders.
Laurent Luce
There are about 8000 source package -- why don't you pick an existing simple one and look at what it does? For that reason, we used to have a simple 'hello' package as a working example.
Dirk Eddelbuettel
UPDATE: Issue was because preinst had an error so unpacking didn't get a chance to happen.
Laurent Luce