debianpackagedebhelper

debian dh-exec install creates extra directory


I'm building a debian package that installs several config files to different places with other names. For that I wanted to use dh-exec install-rename capabilities.

In the control file I declared dh-exec as Build-Dependency:

Build-Depends: debhelper (>= 9), dh-exec

The package.install file looks like this:

#! /usr/bin/dh-exec
default.pdns.conf => /etc/powerdns/pdns.conf
default.uwsgi.ini => /etc/resolver/uwsgi.ini
default.config.toml => /etc/resolver/config.toml
default.nginx.conf => /etc/nginx/sites-available/resolver.conf

I expected this to deploy the existing default.* files in those places with that names, but instead a parent directory is created containing the file as it was:

/etc/resolver/
|-- config.toml
|   `-- default.config.toml
`-- uwsgi.ini
    `-- default.uwsgi.ini

The same happens for all declared files.

No overrides in the debian/rules files that might interfere with this:

#!/usr/bin/make -f

export DH_VERBOSE=1

%:
    dh $@ --with systemd,python-virtualenv


 override_dh_virtualenv:
    dh_virtualenv --package resolver --python /usr/bin/python3

When setting DH_VERBOSE=1 this is what the dh_install helper does:

   dh_install
        install -d debian/resolver//etc/powerdns/pdns.conf
        cp --reflink=auto -a ./default.pdns.conf debian/resolver//etc/powerdns/pdns.conf/
        install -d debian/resolver//etc/resolver/uwsgi.ini
        cp --reflink=auto -a ./default.uwsgi.ini debian/resolver//etc/resolver/uwsgi.ini/
        install -d debian/resolver//etc/resolver/config.toml
        cp --reflink=auto -a ./default.config.toml debian/resolver//etc/resolver/config.toml/
        install -d debian/resolver//etc/nginx/sites-available/resolver.conf
        cp --reflink=auto -a ./default.nginx.conf debian/resolver//etc/nginx/sites-available/resolver.conf/

I feel like I'm missing something really stupid here. After inspecting the dh-exec documentation and code, I think there must be something weird between dh-exec output and dh-install run.

I'd appreciate any tips on this.

Versions:


Solution

  • The package.install file needs to be executable.

    Otherwise dh-exec won't run and it will be used as a regular .install file. For a regular .install file, => are not found files, thus ignored, and the right member is a directory to be created, not a destination file.

    I finally figured out this by myself by checking other projects that use dh-exec.