diff options
author | Niels Thykier <niels@thykier.net> | 2017-10-08 15:12:42 +0000 |
---|---|---|
committer | Niels Thykier <niels@thykier.net> | 2017-10-13 18:08:29 +0000 |
commit | 307e2bc4a1a7c2a714e2723118742f882e2ce992 (patch) | |
tree | ac0352fa4d800402d7774eee2f3e11711c5f211f /dh_installsystemd | |
parent | dbd3ca6bd50c73d872f33838091cb5e77e94ccde (diff) | |
download | debhelper-307e2bc4a1a7c2a714e2723118742f882e2ce992.tar.gz |
dh_installsystemd: Generate postinst for tmpfiles
Signed-off-by: Niels Thykier <niels@thykier.net>
Diffstat (limited to 'dh_installsystemd')
-rwxr-xr-x | dh_installsystemd | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/dh_installsystemd b/dh_installsystemd index 38a18b89..b57b7e4c 100755 --- a/dh_installsystemd +++ b/dh_installsystemd @@ -209,10 +209,7 @@ sub extract_key { foreach my $package (@{$dh{DOPACKAGES}}) { my $tmpdir = tmpdir($package); - my @installed_units; - my @start_units; - my @enable_units; - my %aliases; + my (@installed_units, @start_units, @enable_units, %aliases, @tmpfiles); # Figure out what filename to install it as. my $script; @@ -316,6 +313,26 @@ foreach my $package (@{$dh{DOPACKAGES}}) { } } + # Include postinst-init-tmpfiles if the package ships any files + # in /usr/lib/tmpfiles.d or /etc/tmpfiles.d + if (-d $tmpdir) { + find({ + wanted => sub { + my $name = $File::Find::name; + return unless -f $name; + $name =~ s/^\Q$tmpdir\E//g; + if ($name =~ m,^/usr/lib/tmpfiles\.d/, || + $name =~ m,^/etc/tmpfiles\.d/,) { + push @tmpfiles, $name; + } + }, + no_chdir => 1, + }, $tmpdir); + if (@tmpfiles > 0) { + autoscript($package, 'postinst', 'postinst-init-tmpfiles', { 'TMPFILES' => join(' ', sort @tmpfiles) }); + } + } + next if @start_units == 0 && @enable_units == 0; for my $unit (sort @enable_units) { |