summaryrefslogtreecommitdiff
path: root/dh_installinit
diff options
context:
space:
mode:
authorNiels Thykier <niels@thykier.net>2015-08-15 14:52:56 +0200
committerNiels Thykier <niels@thykier.net>2015-08-15 14:52:56 +0200
commit6a40924d2bf6c4f17531a0e56497325a147a8847 (patch)
tree1389047a6ac1decde9cdc004d66111da7def70e9 /dh_installinit
parentf585d0e4c4fbe281062eda7555c198cb8e620263 (diff)
downloaddebhelper-6a40924d2bf6c4f17531a0e56497325a147a8847.tar.gz
dh_installinit: Install tmpfiles.d files for systemd-only packages
Signed-off-by: Niels Thykier <niels@thykier.net>
Diffstat (limited to 'dh_installinit')
-rwxr-xr-xdh_installinit46
1 files changed, 22 insertions, 24 deletions
diff --git a/dh_installinit b/dh_installinit
index 8f08965a..33c4189f 100755
--- a/dh_installinit
+++ b/dh_installinit
@@ -247,10 +247,28 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
error("Can't use --init-script with an upstart job");
}
- # NB: The case that only $tmpfile is set makes no sense. The
- # tmpfiles.d(5) mechanism is only available when using systemd (at
- # least currently), so there has to be an init script which does the
- # same thing for sysvinit.
+ if (!$dh{NOSCRIPTS}) {
+ # Include postinst-init-tmpfiles if the package ships any files
+ # in /usr/lib/tmpfiles.d or /etc/tmpfiles.d
+ my @tmpfiles;
+ find({
+ wanted => sub {
+ my $name = $File::Find::name;
+ return unless -f $name;
+ $name =~ s/^\Q$tmp\E//g;
+ if ($name =~ m,^/usr/lib/tmpfiles\.d/, ||
+ $name =~ m,^/etc/tmpfiles\.d/,) {
+ push @tmpfiles, $name;
+ }
+ },
+ no_chdir => 1,
+ }, $tmp);
+ if (@tmpfiles > 0) {
+ autoscript($package,"postinst", "postinst-init-tmpfiles",
+ "s,#TMPFILES#," . join(" ", @tmpfiles).",");
+ }
+ }
+
if ($service ne '' || $job ne '' || $init ne '' || $dh{ONLYSCRIPTS}) {
# This is set by the -u "foo" command line switch, it's
# the parameters to pass to update-rc.d. If not set,
@@ -264,26 +282,6 @@ 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 @tmpfiles;
- find({
- wanted => sub {
- my $name = $File::Find::name;
- return unless -f $name;
- $name =~ s/^\Q$tmp\E//g;
- if ($name =~ m,^/usr/lib/tmpfiles\.d/, ||
- $name =~ m,^/etc/tmpfiles\.d/,) {
- push @tmpfiles, $name;
- }
- },
- no_chdir => 1,
- }, $tmp);
- if (@tmpfiles > 0) {
- autoscript($package,"postinst", "postinst-init-tmpfiles",
- "s,#TMPFILES#," . join(" ", @tmpfiles).",");
- }
-
if (! $dh{NO_START}) {
if ($dh{RESTART_AFTER_UPGRADE}) {
# update-rc.d, and restart (or