summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stapelberg <stapelberg@debian.org>2013-12-25 10:20:39 +0100
committerMichael Stapelberg <stapelberg@debian.org>2013-12-25 10:20:39 +0100
commit51f7ec85551720b9cf80797996e3656e75e4e18c (patch)
treeefb450ea17ee4ff4e309398279de22f5eb38bf66
parent9cc8f1aff7204f22d3065f4221f7092f328c54f3 (diff)
downloadinit-system-helpers-51f7ec85551720b9cf80797996e3656e75e4e18c.tar.gz
dh_systemd_start: treat symlinks as aliases (Closes: #731803)
-rwxr-xr-xscript/dh_systemd_start13
1 files 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;