From 51f7ec85551720b9cf80797996e3656e75e4e18c Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Wed, 25 Dec 2013 10:20:39 +0100 Subject: dh_systemd_start: treat symlinks as aliases (Closes: #731803) --- script/dh_systemd_start | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/script/dh_systemd_start b/script/dh_systemd_start index 9269ff2..a5e6df0 100755 --- a/script/dh_systemd_start +++ b/script/dh_systemd_start @@ -10,6 +10,7 @@ use strict; use Debian::Debhelper::Dh_Lib; use File::Find; use Text::ParseWords qw(shellwords); # in core since Perl 5 +use Cwd qw(getcwd abs_path); =head1 SYNOPSIS @@ -109,15 +110,21 @@ foreach my $package (@{$dh{DOPACKAGES}}) { my @units; my %aliases; + my $oldcwd = getcwd(); find({ wanted => sub { my $name = $File::Find::name; - return unless -f $name; + return unless -f; return unless $name =~ m,^$tmpdir/lib/systemd/system/[^/]+$,; push @installed_units, $name; + if (-l) { + my $target = abs_path(readlink()); + $target =~ s,^$oldcwd/,,g; + $aliases{$target} = [ $_ ]; + } }, - no_chdir => 1, }, $tmpdir); + chdir($oldcwd); # Handle either only the unit files which were passed as arguments or # all unit files that are installed in this package. @@ -167,7 +174,7 @@ foreach my $package (@{$dh{DOPACKAGES}}) { $seen{$_} = 1 for @also; @args = (@args, @also); - $aliases{$name} = [ extract_key($name, 'Alias') ]; + push @{$aliases{$name}}, $_ for extract_key($name, 'Alias'); my @sysv = grep { my $base = $_; $base =~ s/\.(?:service|socket)$//g; -- cgit v1.2.3