From 564761fcaeda8c013210f7c6934847a6d0228ec9 Mon Sep 17 00:00:00 2001 From: Christoph Anton Mitterer Date: Mon, 28 Jun 2021 19:24:37 +0200 Subject: [PATCH 1/2] sysusers: split up systemd.conf This makes it easier have the respective users/groups only created when their respective packages are installed. Fixes #20044. --- sysusers.d/meson.build | 30 +++++++++++++++++++++++------ sysusers.d/systemd-coredump.conf | 8 ++++++++ sysusers.d/systemd-journal.conf.in | 8 ++++++++ sysusers.d/systemd-network.conf.in | 8 ++++++++ sysusers.d/systemd-oom.conf | 8 ++++++++ sysusers.d/systemd-resolve.conf.in | 8 ++++++++ sysusers.d/systemd-timesync.conf.in | 8 ++++++++ sysusers.d/systemd.conf.in | 23 ---------------------- 8 files changed, 72 insertions(+), 29 deletions(-) create mode 100644 sysusers.d/systemd-coredump.conf create mode 100644 sysusers.d/systemd-journal.conf.in create mode 100644 sysusers.d/systemd-network.conf.in create mode 100644 sysusers.d/systemd-oom.conf create mode 100644 sysusers.d/systemd-resolve.conf.in create mode 100644 sysusers.d/systemd-timesync.conf.in delete mode 100644 sysusers.d/systemd.conf.in diff --git a/sysusers.d/meson.build b/sysusers.d/meson.build index 894d1840bcf..132d8a187af 100644 --- a/sysusers.d/meson.build +++ b/sysusers.d/meson.build @@ -1,13 +1,31 @@ # SPDX-License-Identifier: LGPL-2.1-or-later -if enable_sysusers - install_data('README', install_dir : sysusersdir) +files = [['README', ''], + ['systemd-coredump.conf', 'ENABLE_COREDUMP'], + ['systemd-oom.conf', 'ENABLE_OOMD']] + +foreach pair : files + if not enable_sysusers + # do nothing + elif pair[1] == '' or conf.get(pair[1]) == 1 + install_data(pair[0], install_dir : sysusersdir) + else + message('Not installing sysusers.d/@0@ because @1@ is @2@' + .format(pair[0], pair[1], conf.get(pair[1], 0))) + endif +endforeach + + +if enable_sysusers and conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_MICROHTTPD') == 1 + install_data('systemd-remote.conf', install_dir : sysusersdir) endif -in_files = [['basic.conf', enable_sysusers], - ['systemd.conf', enable_sysusers], - ['systemd-remote.conf', enable_sysusers and - conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_MICROHTTPD') == 1]] + +in_files = [['basic.conf', enable_sysusers], + ['systemd-journal.conf', enable_sysusers], + ['systemd-network.conf', enable_sysusers and conf.get('ENABLE_NETWORKD') == 1], + ['systemd-resolve.conf', enable_sysusers and conf.get('ENABLE_RESOLVE') == 1], + ['systemd-timesync.conf', enable_sysusers and conf.get('ENABLE_TIMESYNCD') == 1]] foreach tuple : in_files file = tuple[0] diff --git a/sysusers.d/systemd-coredump.conf b/sysusers.d/systemd-coredump.conf new file mode 100644 index 00000000000..c4ff003bd60 --- /dev/null +++ b/sysusers.d/systemd-coredump.conf @@ -0,0 +1,8 @@ +# This file is part of systemd. +# +# systemd is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or +# (at your option) any later version. + +u systemd-coredump - "systemd Core Dumper" diff --git a/sysusers.d/systemd-journal.conf.in b/sysusers.d/systemd-journal.conf.in new file mode 100644 index 00000000000..61768b234ea --- /dev/null +++ b/sysusers.d/systemd-journal.conf.in @@ -0,0 +1,8 @@ +# This file is part of systemd. +# +# systemd is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or +# (at your option) any later version. + +g systemd-journal {{SYSTEMD_JOURNAL_GID}} - diff --git a/sysusers.d/systemd-network.conf.in b/sysusers.d/systemd-network.conf.in new file mode 100644 index 00000000000..7c64a4681fd --- /dev/null +++ b/sysusers.d/systemd-network.conf.in @@ -0,0 +1,8 @@ +# This file is part of systemd. +# +# systemd is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or +# (at your option) any later version. + +u systemd-network {{SYSTEMD_NETWORK_UID}} "systemd Network Management" diff --git a/sysusers.d/systemd-oom.conf b/sysusers.d/systemd-oom.conf new file mode 100644 index 00000000000..27e571feb5e --- /dev/null +++ b/sysusers.d/systemd-oom.conf @@ -0,0 +1,8 @@ +# This file is part of systemd. +# +# systemd is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or +# (at your option) any later version. + +u systemd-oom - "systemd Userspace OOM Killer" diff --git a/sysusers.d/systemd-resolve.conf.in b/sysusers.d/systemd-resolve.conf.in new file mode 100644 index 00000000000..9f02ef94e6e --- /dev/null +++ b/sysusers.d/systemd-resolve.conf.in @@ -0,0 +1,8 @@ +# This file is part of systemd. +# +# systemd is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or +# (at your option) any later version. + +u systemd-resolve {{SYSTEMD_RESOLVE_UID}} "systemd Resolver" diff --git a/sysusers.d/systemd-timesync.conf.in b/sysusers.d/systemd-timesync.conf.in new file mode 100644 index 00000000000..e50f0254169 --- /dev/null +++ b/sysusers.d/systemd-timesync.conf.in @@ -0,0 +1,8 @@ +# This file is part of systemd. +# +# systemd is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or +# (at your option) any later version. + +u systemd-timesync {{SYSTEMD_TIMESYNC_UID}} "systemd Time Synchronization" diff --git a/sysusers.d/systemd.conf.in b/sysusers.d/systemd.conf.in deleted file mode 100644 index 9941ef8ef4f..00000000000 --- a/sysusers.d/systemd.conf.in +++ /dev/null @@ -1,23 +0,0 @@ -# This file is part of systemd. -# -# systemd is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation; either version 2.1 of the License, or -# (at your option) any later version. - -g systemd-journal {{SYSTEMD_JOURNAL_GID}} - -{% if ENABLE_NETWORKD %} -u systemd-network {{SYSTEMD_NETWORK_UID}} "systemd Network Management" -{% endif %} -{% if ENABLE_OOMD %} -u systemd-oom - "systemd Userspace OOM Killer" -{% endif %} -{% if ENABLE_RESOLVE %} -u systemd-resolve {{SYSTEMD_RESOLVE_UID}} "systemd Resolver" -{% endif %} -{% if ENABLE_TIMESYNCD %} -u systemd-timesync {{SYSTEMD_TIMESYNC_UID}} "systemd Time Synchronization" -{% endif %} -{% if ENABLE_COREDUMP %} -u systemd-coredump - "systemd Core Dumper" -{% endif %} From a2142fa60d6bf2408dd42bce637e3ae84b7dad76 Mon Sep 17 00:00:00 2001 From: Christoph Anton Mitterer Date: Wed, 30 Jun 2021 13:34:39 +0200 Subject: [PATCH 2/2] meson: minor cleanup The file itself is already only included when HAVE_MICROHTTPD is set. Signed-off-by: Christoph Anton Mitterer --- sysusers.d/{systemd-remote.conf.in => systemd-remote.conf} | 2 -- 1 file changed, 2 deletions(-) rename sysusers.d/{systemd-remote.conf.in => systemd-remote.conf} (90%) diff --git a/sysusers.d/systemd-remote.conf.in b/sysusers.d/systemd-remote.conf similarity index 90% rename from sysusers.d/systemd-remote.conf.in rename to sysusers.d/systemd-remote.conf index dae1077225f..ca20c248961 100644 --- a/sysusers.d/systemd-remote.conf.in +++ b/sysusers.d/systemd-remote.conf @@ -5,6 +5,4 @@ # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. -{% if HAVE_MICROHTTPD %} u systemd-journal-remote - "systemd Journal Remote" -{% endif %}