Control: tag -1 patch

On Tue, 21 Jul 2015 21:38:35 +0200 Marc Haber <mh+debian-packa...@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.bocca...@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


Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to