[debhelper-devel] [debhelper] 02/02: dh_installinit: Install tmpfiles.d files for systemd-only packages

Niels Thykier nthykier at moszumanska.debian.org
Sat Aug 15 12:53:08 UTC 2015


This is an automated email from the git hooks/post-receive script.

nthykier pushed a commit to branch master
in repository debhelper.

commit 6a40924d2bf6c4f17531a0e56497325a147a8847
Author: Niels Thykier <niels at thykier.net>
Date:   Sat Aug 15 14:52:56 2015 +0200

    dh_installinit: Install tmpfiles.d files for systemd-only packages
    
    Signed-off-by: Niels Thykier <niels at thykier.net>
---
 debian/changelog |  4 ++++
 dh_installinit   | 46 ++++++++++++++++++++++------------------------
 2 files changed, 26 insertions(+), 24 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 47cdb06..6922be6 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -13,6 +13,10 @@ debhelper (9.20150811+unreleased) UNRELEASED; urgency=medium
     (Closes: #719148)
   * dh_installinit: Quote directory name before using it in
     a regex.
+  * dh_installinit: Create script snippts for tmpfiles.d
+    files even if the package has no sysvinit script or
+    explicit debian/<package>.service file.
+    (Closes: #795519)
 
   [ Paul Tagliamonte ]
   * dh_gencontrol: Put debug debs back in the "debug" section.
diff --git a/dh_installinit b/dh_installinit
index 8f08965..33c4189 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

-- 
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