From 1b907b5c3b11491b790e541dd24255a758511a2f Mon Sep 17 00:00:00 2001 From: Josh Triplett Date: Sat, 29 Nov 2014 01:06:04 -0800 Subject: [PATCH] core: Support system.conf.d and user.conf.d directories in the usual search paths --- Makefile-man.am | 12 +++++++++++- man/systemd-system.conf.xml | 25 ++++++++++++++++++++----- man/systemd.xml | 10 ++++++---- src/core/main.c | 9 ++++----- src/core/system.conf | 3 +++ src/core/user.conf | 3 +++ 6 files changed, 47 insertions(+), 15 deletions(-) diff --git a/Makefile-man.am b/Makefile-man.am index c24606a9c..f025be0b3 100644 --- a/Makefile-man.am +++ b/Makefile-man.am @@ -195,6 +195,7 @@ MANPAGES_ALIAS += \ man/sd_journal_wait.3 \ man/sd_machine_get_ifindices.3 \ man/sd_notifyf.3 \ + man/system.conf.d.5 \ man/systemd-ask-password-console.path.8 \ man/systemd-ask-password-wall.path.8 \ man/systemd-ask-password-wall.service.8 \ @@ -227,7 +228,8 @@ MANPAGES_ALIAS += \ man/systemd-udevd-kernel.socket.8 \ man/systemd-udevd.8 \ man/systemd-update-done.8 \ - man/systemd-user.conf.5 + man/systemd-user.conf.5 \ + man/user.conf.d.5 man/SD_ALERT.3: man/sd-daemon.3 man/SD_CRIT.3: man/sd-daemon.3 man/SD_DEBUG.3: man/sd-daemon.3 @@ -301,6 +303,7 @@ man/sd_journal_test_cursor.3: man/sd_journal_get_cursor.3 man/sd_journal_wait.3: man/sd_journal_get_fd.3 man/sd_machine_get_ifindices.3: man/sd_machine_get_class.3 man/sd_notifyf.3: man/sd_notify.3 +man/system.conf.d.5: man/systemd-system.conf.5 man/systemd-ask-password-console.path.8: man/systemd-ask-password-console.service.8 man/systemd-ask-password-wall.path.8: man/systemd-ask-password-console.service.8 man/systemd-ask-password-wall.service.8: man/systemd-ask-password-console.service.8 @@ -334,6 +337,7 @@ man/systemd-udevd-kernel.socket.8: man/systemd-udevd.service.8 man/systemd-udevd.8: man/systemd-udevd.service.8 man/systemd-update-done.8: man/systemd-update-done.service.8 man/systemd-user.conf.5: man/systemd-system.conf.5 +man/user.conf.d.5: man/systemd-system.conf.5 man/SD_ALERT.html: man/sd-daemon.html $(html-alias) @@ -553,6 +557,9 @@ man/sd_machine_get_ifindices.html: man/sd_machine_get_class.html man/sd_notifyf.html: man/sd_notify.html $(html-alias) +man/system.conf.d.html: man/systemd-system.conf.html + $(html-alias) + man/systemd-ask-password-console.path.html: man/systemd-ask-password-console.service.html $(html-alias) @@ -652,6 +659,9 @@ man/systemd-update-done.html: man/systemd-update-done.service.html man/systemd-user.conf.html: man/systemd-system.conf.html $(html-alias) +man/user.conf.d.html: man/systemd-system.conf.html + $(html-alias) + if ENABLE_BACKLIGHT MANPAGES += \ diff --git a/man/systemd-system.conf.xml b/man/systemd-system.conf.xml index 284516d93..dfb180cc5 100644 --- a/man/systemd-system.conf.xml +++ b/man/systemd-system.conf.xml @@ -22,7 +22,8 @@ along with systemd; If not, see . --> - + systemd-system.conf systemd @@ -44,25 +45,39 @@ systemd-system.conf + system.conf.d systemd-user.conf - System and session service manager configuration file + user.conf.d + System and session service manager configuration files /etc/systemd/system.conf + /etc/systemd/system.conf.d/*.conf + /run/systemd/system.conf.d/*.conf + /usr/lib/systemd/system.conf.d/*.conf /etc/systemd/user.conf + /etc/systemd/user.conf.d/*.conf + /run/systemd/user.conf.d/*.conf + /usr/lib/systemd/user.conf.d/*.conf Description - When run as system instance systemd reads the - configuration file system.conf, - otherwise user.conf. These + When run as a system instance, systemd interprets the + configuration file system.conf and the + files in system.conf.d directories; when + run as a user instance, systemd interprets the configuration + file user.conf and the files in + user.conf.d directories. These configuration files contain a few settings controlling basic manager operations. + + + Options diff --git a/man/systemd.xml b/man/systemd.xml index bf7a7a6f6..d77681541 100644 --- a/man/systemd.xml +++ b/man/systemd.xml @@ -75,10 +75,12 @@ telinit8 for more information. - When run as system instance, systemd interprets - the configuration file - system.conf, otherwise - user.conf. See + When run as a system instance, systemd interprets the + configuration file system.conf and the + files in system.conf.d directories; when + run as a user instance, systemd interprets the configuration + file user.conf and the files in + user.conf.d directories. See systemd-system.conf5 for more information. diff --git a/src/core/main.c b/src/core/main.c index c9fd56232..140f2195a 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -667,13 +667,12 @@ static int parse_config_file(void) { {} }; - const char *fn; + const char *fn, *conf_dirs_nulstr; fn = arg_running_as == SYSTEMD_SYSTEM ? PKGSYSCONFDIR "/system.conf" : PKGSYSCONFDIR "/user.conf"; - config_parse(NULL, fn, NULL, - "Manager\0", - config_item_table_lookup, items, - false, false, true, NULL); + conf_dirs_nulstr = arg_running_as == SYSTEMD_SYSTEM ? CONF_DIRS_NULSTR("systemd/system.conf") : CONF_DIRS_NULSTR("systemd/user.conf"); + config_parse_many(fn, conf_dirs_nulstr, "Manager\0", + config_item_table_lookup, items, false, NULL); return 0; } diff --git a/src/core/system.conf b/src/core/system.conf index 65a35a068..a3727200d 100644 --- a/src/core/system.conf +++ b/src/core/system.conf @@ -5,6 +5,9 @@ # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # +# You can override the directives in this file by creating files in +# /etc/systemd/system.conf.d/*.conf. +# # See systemd-system.conf(5) for details [Manager] diff --git a/src/core/user.conf b/src/core/user.conf index 8c7ecde72..87c816437 100644 --- a/src/core/user.conf +++ b/src/core/user.conf @@ -5,6 +5,9 @@ # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # +# You can override the directives in this file by creating files in +# /etc/systemd/user.conf.d/*.conf. +# # See systemd-user.conf(5) for details [Manager] -- 2.30.2