distro/systemd: use kresd.target to start enabled instances

Starting multiple systemd units with a target is conceptually cleaner
than using globbing expression.

Related https://github.com/systemd/systemd/issues/9080
parent ca54220a
......@@ -24,6 +24,7 @@ Bugfixes
- systemd: multiple enabled kresd instances can now be started using kresd.target
- ta_sentinel: switch to version 14 of the RFC draft (!596)
- support for glibc systems with a non-Linux kernel (!588)
- support per-request variables for Lua modules (!533)
......@@ -49,6 +49,9 @@ package() {
install -Dm 0644 "${srcdir}/${pkgname}-${pkgver}/distro/common/systemd/kresd-control@.socket" "${pkgdir}/usr/lib/systemd/system/kresd-control@.socket"
install -Dm 0644 "${srcdir}/${pkgname}-${pkgver}/distro/common/systemd/kresd-tls.socket" "${pkgdir}/usr/lib/systemd/system/kresd-tls.socket"
install -Dm 0644 "${srcdir}/${pkgname}-${pkgver}/distro/common/systemd/kresd@.service" "${pkgdir}/usr/lib/systemd/system/kresd@.service"
install -Dm 0644 "${srcdir}/${pkgname}-${pkgver}/distro/common/systemd/kresd.target" "${pkgdir}/usr/lib/systemd/system/kresd.target"
install -dm 0755 "${pkgdir}/usr/lib/systemd/system/multi-user.target.wants"
ln -s ../kresd.target "${pkgdir}/usr/lib/systemd/system/multi-user.target.wants/kresd.target"
install -Dm 0644 "${srcdir}/${pkgname}-${pkgver}/distro/common/systemd/kresd.systemd.7" "${pkgdir}/usr/share/man/man7/kresd.systemd.7"
install -Dm 0644 "${srcdir}/${pkgname}-${pkgver}/distro/common/tmpfiles/knot-resolver.conf" "${pkgdir}/usr/lib/tmpfiles.d/knot-resolver.conf"
install -dm 0775 "${pkgdir}/etc/knot-resolver"
......@@ -26,3 +26,6 @@ Notes
* Distributions using systemd-sysv-generator should mask kresd.service to
be consistent with other distributions. Any use of kresd.service instead of
kresd@N.service is discouraged to avoid confusing the users.
* kresd.target should be enabled by default by linking it to systemd lib/
directory. Instances of kresd@.service are then added manually to
kresd.target when the user enables them.
.TH "kresd.systemd" "7" "2018-01-30" "CZ.NIC" "Knot DNS Resolver Systemd Units"
.TH "kresd.systemd" "7" "2018-06-04" "CZ.NIC" "Knot DNS Resolver Systemd Units"
.\" kresd.systemd.7 -- man page for systemd units for kresd
......@@ -17,6 +17,7 @@ kresd@.service
......@@ -99,7 +100,7 @@ number. To enable 3 concurrent daemons:
.B Using system-kresd.slice
.B Using system-kresd.slice and kresd.target
The following commands may not work with older systemd (e.g. on CentOS 7).
See notes for more info.
......@@ -129,13 +130,11 @@ Or you can use it to stop kresd altogether (e.g. during package removal):
Note that \fBsystemctl start system-kresd.slice\fR does not
automatically start the sockets or the daemons, though. To ensure
that all enabled daemons are started and running, do:
To start all enabled kresd daemons, use the provided \fIkresd.target\fR:
.RS 4n
.B systemctl start --all 'kresd@*.service'
.B systemctl start kresd.target
......@@ -212,7 +211,7 @@ To enable multiple concurrent daemons, for example 16:
To start all enabled daemons:
.B systemctl start --all 'kresd@*.service'
.B systemctl start kresd.target
Description=Knot DNS Resolver daemons
After=syslog.target network-online.target
......@@ -14,4 +14,4 @@ Sockets=kresd-tls.socket
......@@ -5,6 +5,7 @@ distro/common/systemd/kresd-control@.socket lib/systemd/system/
distro/common/systemd/kresd-tls.socket lib/systemd/system/
distro/common/systemd/kresd.socket lib/systemd/system/
distro/common/systemd/kresd@.service lib/systemd/system/
distro/common/systemd/kresd.target lib/systemd/system/
distro/common/tmpfiles/knot-resolver.conf usr/lib/tmpfiles.d/
dev/null lib/systemd/system/kresd.service
lib/systemd/system/kresd.target lib/systemd/system/multi-user.target.wants/kresd.target
......@@ -139,6 +139,9 @@ install -m 0664 -p %SOURCE3 %{buildroot}%{_sysconfdir}/knot-resolver/root.keys
# install systemd units and doc
mkdir -p %{buildroot}%{_unitdir}
install -m 0644 -p %{repodir}/distro/common/systemd/kresd@.service %{buildroot}%{_unitdir}/kresd@.service
install -m 0644 -p %{repodir}/distro/common/systemd/kresd.target %{buildroot}%{_unitdir}/kresd.target
install -m 0755 -d %{buildroot}%{_unitdir}/multi-user.target.wants
ln -s ../kresd.target %{buildroot}%{_unitdir}/multi-user.target.wants/kresd.target
mkdir -p %{buildroot}%{_mandir}/man7
install -m 0644 -p %{repodir}/distro/common/systemd/kresd.systemd.7 %{buildroot}%{_mandir}/man7/kresd.systemd.7
......@@ -213,6 +216,8 @@ fi
%attr(644,root,knot-resolver) %config(noreplace) %{_sysconfdir}/knot-resolver/icann-ca.pem
%attr(750,knot-resolver,knot-resolver) %dir %{_localstatedir}/cache/knot-resolver
%if 0%{?rhel}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment