Bug#801822: Better Patch

Jakobus Schürz jakob at xundeenergie.at
Wed Mar 22 23:03:53 GMT 2017


I changed my Patch... Now it seems to work correct.


-- 
Jakobus Schürz
Roseggergasse 37/21
1160 Wien

+43/699/107 66 126

http://xundeenergie.at
http://cogitationum.wordpress.com/
http://verkehrsloesungen.wordpress.com/
-------------- next part --------------
--- /usr/bin/deb-systemd-helper	2017-02-25 03:56:20.844471315 +0100
+++ /usr/bin/deb-systemd-helper-xe	2017-03-23 00:00:36.456053295 +0100
@@ -116,8 +116,8 @@
 
 sub find_unit {
     my ($scriptname) = @_;
-
     my $service_path = $scriptname;
+    $scriptname =~ s/\@(.*)\.([a-z]*)$/@.$2/;
     if (-f "/etc/systemd/system/$scriptname") {
         $service_path = "/etc/systemd/system/$scriptname";
     } elsif (-f "/lib/systemd/system/$scriptname") {
@@ -126,6 +126,12 @@
     return $service_path;
 }
 
+sub get_instance {
+    my ($instance) = @_;
+    $instance =~ s/^.*\@(.*)\.([a-z]*)$/$1/;
+    return $instance;
+}
+
 sub dsh_state_path {
     my ($scriptname) = @_;
     return $enabled_state_dir . '/' . basename($scriptname) . '.dsh-also';
@@ -182,6 +188,7 @@
     my @links;
 
     my $unit_name = basename($service_path);
+    my $instance = get_instance($scriptname);
 
     # The keys parsed from the unit file below can only have unit names
     # as values. Since unit names can't have whitespace in systemd,
@@ -198,6 +205,7 @@
                 my $wants_dir = "/etc/systemd/system/$value";
                 $wants_dir .= '.wants' if $1 eq 'WantedBy';
                 $wants_dir .= '.requires' if $1 eq 'RequiredBy';
+                $wants_dir =~ s/\%i/$instance/;
                 push @links, { dest => $service_path, src => "$wants_dir/$scriptname" };
             }
         }
@@ -206,6 +214,7 @@
             for my $value (split(/\s+/, $1)) {
                 $value =~ s/^(["'])(.*)\g1$/$2/;
                 if ($value ne $unit_name) {
+                    $value =~ s/\%i/$instance/;
                     push @links, get_link_closure($value, find_unit($value));
                 }
             }
@@ -215,6 +224,7 @@
             for my $value (split(/\s+/, $1)) {
                 $value =~ s/^(["'])(.*)\g1$/$2/;
                 if ($value ne $unit_name) {
+                    #$value =~ s/\%i/$instance/;
                     push @links, { dest => $service_path, src => "/etc/systemd/system/$1" };
                 }
             }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0x43B88572.asc
Type: application/pgp-keys
Size: 4028 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-systemd-maintainers/attachments/20170323/ed593c40/attachment-0001.key>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 894 bytes
Desc: OpenPGP digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-systemd-maintainers/attachments/20170323/ed593c40/attachment-0001.sig>


More information about the Pkg-systemd-maintainers mailing list