summaryrefslogtreecommitdiff
path: root/dh_installinit
diff options
context:
space:
mode:
authorMichael Stapelberg <stapelberg@debian.org>2012-10-29 18:06:29 +0100
committerJoey Hess <joey@kitenet.net>2012-10-29 14:32:15 -0400
commit469c74d0ac590016eeae847e3fe4c353c6e0c25b (patch)
treefa8a07d25eb9b0d4ef0709865f22eda31de00fc2 /dh_installinit
parentd8e9aa3c77f796dc984af3a73125bc03b8f048c1 (diff)
dh_installinit: only add systemd-tmpfiles --create when shipping tmpfiles
Diffstat (limited to 'dh_installinit')
-rwxr-xr-xdh_installinit20
1 files changed, 20 insertions, 0 deletions
diff --git a/dh_installinit b/dh_installinit
index f657f85..2daad63 100755
--- a/dh_installinit
+++ b/dh_installinit
@@ -8,6 +8,7 @@ dh_installinit - install service init files into package build directories
use strict;
use Debian::Debhelper::Dh_Lib;
+use File::Find;
=head1 SYNOPSIS
@@ -251,6 +252,25 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
}
if (! $dh{NOSCRIPTS}) {
+ # Include postinst-init-tmpfiles if the package ships any files
+ # in /usr/lib/tmpfiles.d or /etc/tmpfiles.d
+ my $got_tmpfile = undef;
+ my $tmpdir = tmpdir($package);
+ find({
+ wanted => sub {
+ return unless -f $File::Find::name;
+ if (!$got_tmpfile &&
+ $File::Find::name =~ m,^$tmpdir/usr/lib/tmpfiles\.d/, ||
+ $File::Find::name =~ m,^$tmpdir/etc/tmpfiles\.d/,) {
+ $got_tmpfile = 1;
+ }
+ },
+ no_chdir => 1,
+ }, $tmpdir);
+ if ($got_tmpfile) {
+ autoscript($package,"postinst", "postinst-init-tmpfiles", "");
+ }
+
if (! $dh{NO_START}) {
if ($dh{RESTART_AFTER_UPGRADE}) {
# update-rc.d, and restart (or