Bug#793153: please consider installing .target files as well

Luca Boccassi lboccass at Brocade.com
Tue Mar 15 18:19:11 GMT 2016


Control: tag -1 patch

On Tue, 21 Jul 2015 21:38:35 +0200 Marc Haber <mh+debian-packages at zugschlus.de> wrote:
> Package: dh-systemd
> Version: 1.23
> Severity: wishlist
> File: /usr/bin/dh_systemd_enable
> 
> Hi,
> 
> dh_systemd_enable behaves differently for service, socket, and tmpfile
> units where it installs the actual unit file additionally to
> generating postinst code.
> 
> Please consider doing this for other unit types (such as target) as
> well. If there is a reason for not doing so, please document that
> reason and suggest installing the file manually before
> dh_systemd_enable is called.

Hi,

Small patch to implement support for installing target units attached.

Thank you!

-- 
Kind regards,
Luca Boccassi

From 2513311d93f4f66b1d2828fceb966ffc875d2a76 Mon Sep 17 00:00:00 2001
From: Luca Boccassi <luca.boccassi at gmail.com>
Date: Tue, 15 Mar 2016 18:03:05 +0000
Subject: [PATCH] Add support for installing target units

---
 script/dh_systemd_enable | 12 +++++++++++-
 script/dh_systemd_start  |  2 +-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/script/dh_systemd_enable b/script/dh_systemd_enable
index 39955c4..1ee2f38 100755
--- a/script/dh_systemd_enable
+++ b/script/dh_systemd_enable
@@ -102,7 +102,7 @@ sub contains_install_section {
 	return 0;
 }
 
-# PROMISE: DH NOOP WITHOUT tmp(lib/systemd/system) service socket tmpfile
+# PROMISE: DH NOOP WITHOUT tmp(lib/systemd/system) service socket target tmpfile
 
 foreach my $package (@{$dh{DOPACKAGES}}) {
 	my $tmpdir = tmpdir($package);
@@ -148,6 +148,16 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
 		doit("install","-p","-m644",$service,"$path/$script.service");
 	}
 
+	my $target=pkgfile($package,"target");
+	if ($target ne '') {
+		my $path="$tmpdir/lib/systemd/system";
+		if (! -d "$path") {
+			doit("install","-d","$path");
+		}
+
+		doit("install","-p","-m644",$target,"$path/$script.target");
+	}
+
 	my $socket=pkgfile($package,"socket");
 	if ($socket ne '') {
 		my $path="$tmpdir/lib/systemd/system";
diff --git a/script/dh_systemd_start b/script/dh_systemd_start
index 4e22d59..87ec55f 100755
--- a/script/dh_systemd_start
+++ b/script/dh_systemd_start
@@ -197,7 +197,7 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
 		push @{$aliases{$name}}, $_ for extract_key($name, 'Alias');
 		my @sysv = grep {
 				my $base = $_;
-				$base =~ s/\.(?:service|socket)$//g;
+				$base =~ s/\.(?:service|socket|target)$//g;
 				-f "$tmpdir/etc/init.d/$base"
 			} ($base, @{$aliases{$name}});
 		if (@sysv == 0 && !grep { $_ eq $name } @units) {
-- 
2.1.4


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.alioth.debian.org/pipermail/pkg-systemd-maintainers/attachments/20160315/526275e3/attachment.sig>


More information about the Pkg-systemd-maintainers mailing list