Package: debhelper
Version: 12.1.1ubuntu1~ubuntu18.04.1
Severity: important
Tags: upstream

Dear Maintainer,

Attempting to use `dh_installsystemduser` to create a package with a
parameterized service/timer/etc. (e.g. package@.user.service) installs
the service definition file into a temporary directory for a package
called "package@", rather than "package".  This leads to the service not
being included in the final debian package.

Although I discovered this on the Ubuntu repackaging of the debhelper
package, the issue is still present in the trunk codebase:

https://salsa.debian.org/debian/debhelper/blob/master/dh_installsystemduser#L115-125

The fix is to copy what `dh_installsystemd` does, and to pass the
temporary directory through to `install_user_unit` so that all the
package files end up in the right place.

```perl
sub install_user_unit {
  my ($package, $name, $suffix, $path) = @_;

  my $unit = pkgfile($package, "user.$suffix");
  return if $unit eq '';

  install_dir($path);
  install_file($unit, "$path/$name.$suffix");
}
```

And (at the call site):

```perl
  for my $type (qw(service target socket path timer)) {
    install_user_unit($package, $name, $type, "$tmpdir/usr/lib/systemd/user");
    install_user_unit("${package}@", "${name}@", $type, 
"$tmpdir/usr/lib/systemd/user");
  }
```

Thanks,

Andy

-- System Information:
Debian Release: buster/sid
  APT prefers bionic-updates
  APT policy: (500, 'bionic-updates'), (500, 'bionic-security'), (500, 
'bionic'), (100, 'bionic-backports')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.5.5-050505-generic (SMP w/4 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_GB:en (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages debhelper depends on:
ii  autotools-dev            20180224.1
ii  dh-autoreconf            17
ii  dh-strip-nondeterminism  0.040-1.1~build1
ii  dpkg                     1.19.0.5ubuntu2.3
ii  dpkg-dev                 1.19.0.5ubuntu2.3
ii  dwz                      0.12-2
ii  file                     1:5.32-2ubuntu0.3
ii  libdpkg-perl             1.19.0.5ubuntu2.3
ii  man-db                   2.8.3-2ubuntu0.1
ii  perl                     5.26.1-6ubuntu0.3
ii  po-debconf               1.0.20

debhelper recommends no packages.

Versions of packages debhelper suggests:
ii  dh-make  2.201701

-- no debconf information

Reply via email to