]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
deprecate legacy systemd units
authorVladimír Čunát <vladimir.cunat@nic.cz>
Wed, 28 Jun 2023 08:17:41 +0000 (10:17 +0200)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Tue, 11 Jul 2023 08:01:56 +0000 (08:01 +0000)
- separate meson option, disabled by default
- deb,rpm: don't install these legacy units
- deb,rpm: use the new knot-resolver.service on all the places

distro/pkg/deb/knot-resolver-core.install
distro/pkg/deb/knot-resolver-core.links [deleted file]
distro/pkg/deb/knot-resolver-core.manpages
distro/pkg/deb/knot-resolver-core.postinst
distro/pkg/deb/knot-resolver-manager.links [new file with mode: 0644]
distro/pkg/rpm/knot-resolver.spec
doc/meson.build
manager/tests/packaging/manpage.sh
meson.build
meson_options.txt
systemd/meson.build

index c9dd93dfcb4b84be024ee4a5cdb01f150d141b1b..74ff1c57057da9aa9798e2a99dc61824165b4883 100644 (file)
@@ -1,6 +1,3 @@
-usr/lib/systemd/system/kresd@.service lib/systemd/system/
-usr/lib/systemd/system/kres-cache-gc.service lib/systemd/system/
-usr/lib/systemd/system/kresd.target lib/systemd/system/
 usr/lib/*.so.*
 usr/lib/tmpfiles.d/knot-resolver.conf
 usr/lib/knot-resolver/*.so
diff --git a/distro/pkg/deb/knot-resolver-core.links b/distro/pkg/deb/knot-resolver-core.links
deleted file mode 100644 (file)
index 8196524..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-dev/null lib/systemd/system/kresd.service
-lib/systemd/system/kresd.target lib/systemd/system/multi-user.target.wants/kresd.target
index 101a4acf6cf18c61d0fc1b75854f57a3f3379ac7..f9ca908fd598a9ab4a4f9973fe6fb81aeb241486 100644 (file)
@@ -1,2 +1 @@
 debian/tmp/usr/share/man/man8/kresd.8*
-debian/tmp/usr/share/man/man7/kresd.systemd.7*
index a1fcadd2fbf6eac9967b0a8fb8b262c02a2f7015..e98529876b17b80205a8585264ab6a5c4b170005 100644 (file)
@@ -9,7 +9,7 @@ fi
 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
     systemctl daemon-reload || true
     systemd-tmpfiles --create /usr/lib/tmpfiles.d/knot-resolver.conf
-    systemctl try-restart 'kresd@*.service' kres-cache-gc.service || true
+    systemctl try-restart knot-resolver.service || true
 fi
 
 #DEBHELPER#
diff --git a/distro/pkg/deb/knot-resolver-manager.links b/distro/pkg/deb/knot-resolver-manager.links
new file mode 100644 (file)
index 0000000..c5467e8
--- /dev/null
@@ -0,0 +1 @@
+lib/systemd/system/knot-resolver.service lib/systemd/system/multi-user.target.wants/knot-resolver.service
index e181e5af1d5625c2c188d1aaab73aac2d9d21ef1..10925a03e2db455a0e73f0db6a4ef0dcf7f87c4e 100644 (file)
@@ -101,10 +101,6 @@ written in C and LuaJIT, including both a resolver library and a daemon.
 Modular architecture of the library keeps the core tiny and efficient, and
 provides a state-machine like API for extensions.
 
-The package is pre-configured as local caching resolver.
-To start using it, start a single kresd instance:
-$ systemctl start kresd@1.service
-
 %package devel
 Summary:        Development headers for Knot Resolver
 Requires:       %{name}-core%{?_isa} = %{version}-%{release}
@@ -205,9 +201,9 @@ popd
 %install
 DESTDIR="${RPM_BUILD_ROOT}" %{NINJA} -v -C build_rpm install
 
-# add kresd.target to multi-user.target.wants to support enabling kresd services
+# add knot-resolver.service to multi-user.target.wants to support enabling kresd services
 install -m 0755 -d %{buildroot}%{_unitdir}/multi-user.target.wants
-ln -s ../kresd.target %{buildroot}%{_unitdir}/multi-user.target.wants/kresd.target
+ln -s ../knot-resolver.service %{buildroot}%{_unitdir}/multi-user.target.wants/knot-resolver.service
 
 # remove modules with missing dependencies
 rm %{buildroot}%{_libdir}/knot-resolver/kres_modules/etcd.lua
@@ -248,11 +244,11 @@ getent passwd knot-resolver >/dev/null || useradd -r -g knot-resolver -d %{_sysc
 /sbin/ldconfig
 %endif
 
-%preun core
-%systemd_preun kres-cache-gc.service kresd.target
+%preun manager
+%systemd_preun knot-resolver.service
 
-%postun core
-%systemd_postun_with_restart 'kresd@*.service' kres-cache-gc.service
+%postun manager
+%systemd_postun_with_restart knot-resolver.service
 %if "x%{?fedora}" == "x"
 /sbin/ldconfig
 %endif
@@ -269,12 +265,8 @@ getent passwd knot-resolver >/dev/null || useradd -r -g knot-resolver -d %{_sysc
 %{_sysconfdir}/knot-resolver/icann-ca.pem
 %attr(750,knot-resolver,knot-resolver) %dir %{_sharedstatedir}/knot-resolver
 %attr(640,knot-resolver,knot-resolver) %{_sharedstatedir}/knot-resolver/root.keys
-%{_unitdir}/kresd@.service
-%{_unitdir}/kres-cache-gc.service
-%{_unitdir}/kresd.target
 %dir %{_unitdir}/multi-user.target.wants
-%{_unitdir}/multi-user.target.wants/kresd.target
-%{_mandir}/man7/kresd.systemd.7.gz
+%{_unitdir}/multi-user.target.wants/knot-resolver.service
 %{_tmpfilesdir}/knot-resolver.conf
 %ghost /run/%{name}
 %ghost %{_localstatedir}/cache/%{name}
index 494985ce203f62721290897a7d2fe763e08bff86..94c93cfa419fdd7caf7a87ce06ac9b55029788ba 100644 (file)
@@ -7,7 +7,7 @@ man_config.set('version', meson.project_version())
 man_config.set('date', run_command('../scripts/get-date.sh', check: true).stdout())
 
 man_config.set('man_seealso_systemd', '')
-if systemd_files == 'enabled'
+if systemd_legacy_units == 'enabled'
   man_config.set('man_seealso_systemd', '\\fIkresd.systemd(7)\\fR, ')
 endif
 
index eeab3e4f1477a1ff1b49ef44a36d6008ea276575..c48d90480a18769e9e731fc3ed8a8ee30e85ac5f 100755 (executable)
@@ -2,6 +2,4 @@
 
 set -e
 
-man -w kresd
-man -w kresd.systemd
 man -w kresctl
index 4fbef2961183e4490ce3069ecd64da24d6563736..1a941a32513016f8d9496aca2b99f118d4ac5c24 100644 (file)
@@ -114,6 +114,7 @@ xdp = meson.get_compiler('c').has_header('libknot/xdp/xdp.h')
 
 ### Systemd
 systemd_files = get_option('systemd_files')
+systemd_legacy_units = get_option('systemd_legacy_units')
 libsystemd = dependency('libsystemd', required: systemd_files == 'enabled')
 
 ### Allocator
@@ -231,9 +232,7 @@ subdir('etc')
 
 
 # Systemd unit files
-if systemd_files != 'disabled'
-  subdir('systemd')
-endif
+subdir('systemd')
 
 
 # Additional files
index ee8b576aaa0162093cca9b169872d3f6773984c7..8bff17b2aeb710917a68150561cf5cb2116e6f75 100644 (file)
@@ -101,6 +101,16 @@ option(
   description: 'installs systemd-related files',
 )
 
+option(
+  'systemd_legacy_units',
+  type: 'combo',
+  choices: [
+    'disabled',
+    'enabled',
+  ],
+  value: 'disabled',
+  description: 'installs legacy systemd units for running without manager, like with versions before 6',
+)
 
 # Component options
 option(
index 0948e69f556c0894ec4edcf33a645719315e1f84..249905081297621820fcfa6cc509c074e56d5d63 100644 (file)
@@ -13,7 +13,8 @@ systemd_config.set('etc_dir', etc_dir)
 systemd_config.set('run_dir', run_dir)
 systemd_config.set('lib_dir', lib_dir)
 
-if systemd_files == 'enabled'
+if systemd_legacy_units == 'enabled'
+
   ## unit files
   kresd_service = configure_file(
     input: 'kresd@.service.in',
@@ -31,13 +32,6 @@ if systemd_files == 'enabled'
     sources: 'kresd.target',
     install_dir: systemd_unit_dir,
   )
-  manager_service = configure_file(
-    input: 'knot-resolver.service.in',
-    output: 'knot-resolver.service',
-    configuration: systemd_config,
-    install_dir: systemd_unit_dir,
-  )
-
   ## man page
   kresd_systemd_man = configure_file(
     input: 'kresd.systemd.7.in',
@@ -46,6 +40,18 @@ if systemd_files == 'enabled'
   )
   install_man(kresd_systemd_man)
 
+endif
+
+
+if systemd_files == 'enabled'
+
+  manager_service = configure_file(
+    input: 'knot-resolver.service.in',
+    output: 'knot-resolver.service',
+    configuration: systemd_config,
+    install_dir: systemd_unit_dir,
+  )
+
   ## tmpfiles
   tmpfiles = configure_file(
     input: 'tmpfiles.d/knot-resolver.conf.in',