i'm working on packaging knot-resolver 2.0.0.
Upstream has gone with a templated approach to take advantage of
multiple cores.
each daemon can consume a full core, and listens on its own control
socket, and on shared network-facing sockets:
kresd@.service
kresd@.socket (port 53)
kresd-tls@.socket (port 853)
kresd-control@socket (/run/knot-resolver/control@%i)
We ship all of these templates, but we *also* want to start with 1
daemon's sockets enabled (kresd{,-tls,-control}@1.socket, in particular).
i can ship those as symlinks in /lib/systemd/system/, like this:
2387690 4 drwxr-xr-x 2 dkg dkg 4096 Feb 5 03:00 lib/systemd/system/
2384490 4 -rw-r--r-- 1 dkg dkg 281 Feb 5 03:00 lib/systemd/system/kresd-control@.socket
2384493 0 lrwxrwxrwx 1 dkg dkg 17 Feb 5 03:00 lib/systemd/system/kresd-tls@1.socket -> kresd-tls@.socket
2384488 4 -rw-r--r-- 1 dkg dkg 347 Feb 5 03:00 lib/systemd/system/kresd@.service
2384489 4 -rw-r--r-- 1 dkg dkg 302 Feb 5 03:00 lib/systemd/system/kresd@.socket
2384492 0 lrwxrwxrwx 1 dkg dkg 13 Feb 5 03:00 lib/systemd/system/kresd@1.socket -> kresd@.socket
2384491 4 -rw-r--r-- 1 dkg dkg 303 Feb 5 03:00 lib/systemd/system/kresd-tls@.socket
2384494 0 lrwxrwxrwx 1 dkg dkg 21 Feb 5 03:00 lib/systemd/system/kresd-control@1.socket -> kresd-control@.socket
however, dh_installsystemd doesn't recognize the linked files as units
worthy of managing in the maintscripts.
in particular, there's a line in dh_installsystemd that looks like it
ignores symlinks entirely:
wanted => sub {
my $name = $File::Find::name;
return unless -f $name;
return unless $name =~ m,^\Q${tmpdir}\E/lib/systemd/system/[^/]+$,;
if (-l) {
my $target = abs_path(readlink());
$target =~ s,^\Q${oldcwd}\E/,,g;
$aliases{$target} = [ $_ ];
} else {
push @installed_units, $name;
}
},
It's not clear to me what the "if (-l)" is doing there, since there's
a "return unless -f $fname" two lines above it.
could we have dh_installsystemd perform the same management for the
symlinked socket instantiations that it does for other units?
Note that if i list kresd{,-tls,-control}@1.socket on the command line
to dh_installsystemd, i get the following warnings:
dh_installsystemd: Could not find "kresd@1.socket" in the /lib/systemd/system directory of knot-resolver. This could be a typo, or using Also= with a service file from another package. Please check carefully that this message is harmless.
dh_installsystemd: Could not find "kresd-tls@1.socket" in the /lib/systemd/system directory of knot-resolver. This could be a typo, or using Also= with a service file from another package. Please check carefully that this message is harmless.
dh_installsystemd: Could not find "kresd-control@1.socket" in the /lib/systemd/system directory of knot-resolver. This could be a typo, or using Also= with a service file from another package. Please check carefully that this message is harmless.
i do not believe these messages are harmless!