diff options
author | Michael Stapelberg <stapelberg@debian.org> | 2013-12-25 11:03:56 +0100 |
---|---|---|
committer | Michael Stapelberg <stapelberg@debian.org> | 2013-12-25 11:03:56 +0100 |
commit | 71972f2165728d94c3900a34dc4d1897bec5ff01 (patch) | |
tree | ee014d937efaa417ac3135cb97f9b94357b60d6e | |
parent | 51f7ec85551720b9cf80797996e3656e75e4e18c (diff) | |
download | init-system-helpers-71972f2165728d94c3900a34dc4d1897bec5ff01.tar.gz |
dh_systemd_{enable,start}: don’t treat symlinks as units
For the rare case where a unit is not a plain file, but a symlink to
some other file (I can’t imagine a legitimate use for that), explicitly
pass the unit’s name as argument for a quick workaround and write a
bugreport.
-rwxr-xr-x | script/dh_systemd_enable | 4 | ||||
-rwxr-xr-x | script/dh_systemd_start | 3 |
2 files changed, 6 insertions, 1 deletions
diff --git a/script/dh_systemd_enable b/script/dh_systemd_enable index ea61301..8d21c04 100755 --- a/script/dh_systemd_enable +++ b/script/dh_systemd_enable @@ -159,6 +159,10 @@ foreach my $package (@{$dh{DOPACKAGES}}) { wanted => sub { my $name = $File::Find::name; return unless -f $name; + # Skip symbolic links, their only legitimate use is for + # adding an alias, e.g. linking smartmontools.service + # -> smartd.service. + return if -l $name; return unless $name =~ m,^$tmpdir/lib/systemd/system/[^/]+$,; push @installed_units, $name; }, diff --git a/script/dh_systemd_start b/script/dh_systemd_start index a5e6df0..bd02d92 100755 --- a/script/dh_systemd_start +++ b/script/dh_systemd_start @@ -116,11 +116,12 @@ foreach my $package (@{$dh{DOPACKAGES}}) { my $name = $File::Find::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} = [ $_ ]; + } else { + push @installed_units, $name; } }, }, $tmpdir); |