[debhelper-devel] [debhelper] 13/21: dh_installsystemd: Generate postinst for tmpfiles
Niels Thykier
nthykier at moszumanska.debian.org
Fri Oct 13 18:27:21 UTC 2017
This is an automated email from the git hooks/post-receive script.
nthykier pushed a commit to branch master
in repository debhelper.
commit 307e2bc4a1a7c2a714e2723118742f882e2ce992
Author: Niels Thykier <niels at thykier.net>
Date: Sun Oct 8 15:12:42 2017 +0000
dh_installsystemd: Generate postinst for tmpfiles
Signed-off-by: Niels Thykier <niels at thykier.net>
---
dh_installsystemd | 25 +++++++++++++++++++++----
1 file changed, 21 insertions(+), 4 deletions(-)
diff --git a/dh_installsystemd b/dh_installsystemd
index 38a18b8..b57b7e4 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) {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debhelper/debhelper.git
More information about the debhelper-devel
mailing list