[systemd-devel] [PATCHv2] logind: Support logind.conf.d directories in the usual search paths

Josh Triplett josh at joshtriplett.org
Thu Oct 16 21:29:29 PDT 2014


This makes it possible to drop in logind configuration snippets from a
package or other configuration management mechanism.

Introduce a new helper, conf_parse_many, to parse configuration files in
a search path.

systemd now installs /usr/lib/systemd/logind.conf.d/50-default.conf
rather than /etc/systemd/logind.conf .  Distributions should migrate
existing modified versions of /etc/systemd/logind.conf to
/etc/systemd/logind.conf.d/50-default.conf .

Move the logind.conf manpage to logind.conf.d, update it to document the
search paths, and update all references to it.
---

v2: Updated to use the usual search path mechanism and directories.


For systemd, are "git format-patch -M" patches (with git-style renames
rather than whole-file deletion/insertions) acceptable for mailing list
review?  That format makes renames much easier to review.

 Makefile-man.am                      |   4 +-
 Makefile.am                          |   5 +-
 man/loginctl.xml                     |   2 +-
 man/logind.conf.d.xml                | 381 +++++++++++++++++++++++++++++++++++
 man/logind.conf.xml                  | 359 ---------------------------------
 man/nss-myhostname.xml               |   2 +-
 man/pam_systemd.xml                  |   2 +-
 man/systemd-inhibit.xml              |   4 +-
 man/systemd-logind.service.xml       |   4 +-
 src/login/50-default.conf            |  29 +++
 src/login/logind.c                   |  17 +-
 src/login/logind.conf                |  29 ---
 src/shared/conf-parser.c             |  25 +++
 src/shared/conf-parser.h             |   7 +
 units/org.freedesktop.login1.busname |   2 +-
 units/systemd-logind.service.in      |   2 +-
 16 files changed, 469 insertions(+), 405 deletions(-)
 create mode 100644 man/logind.conf.d.xml
 delete mode 100644 man/logind.conf.xml
 create mode 100644 src/login/50-default.conf
 delete mode 100644 src/login/logind.conf

diff --git a/Makefile-man.am b/Makefile-man.am
index a13e948..f28eccd 100644
--- a/Makefile-man.am
+++ b/Makefile-man.am
@@ -1096,7 +1096,7 @@ endif
 if ENABLE_LOGIND
 MANPAGES += \
 	man/loginctl.1 \
-	man/logind.conf.5 \
+	man/logind.conf.d.5 \
 	man/systemd-logind.service.8
 MANPAGES_ALIAS += \
 	man/systemd-logind.8
@@ -1547,7 +1547,7 @@ EXTRA_DIST += \
 	man/localectl.xml \
 	man/localtime.xml \
 	man/loginctl.xml \
-	man/logind.conf.xml \
+	man/logind.conf.d.xml \
 	man/machine-id.xml \
 	man/machine-info.xml \
 	man/machinectl.xml \
diff --git a/Makefile.am b/Makefile.am
index e52db17..e048d83 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -95,6 +95,7 @@ sysusersdir=$(prefix)/lib/sysusers.d
 sysctldir=$(prefix)/lib/sysctl.d
 binfmtdir=$(prefix)/lib/binfmt.d
 modulesloaddir=$(prefix)/lib/modules-load.d
+logindconfdir=$(prefix)/lib/logind.conf.d
 networkdir=$(rootprefix)/lib/systemd/network
 pkgincludedir=$(includedir)/systemd
 systemgeneratordir=$(rootlibexecdir)/system-generators
@@ -5361,8 +5362,8 @@ dist_dbussystemservice_DATA += \
 dist_dbuspolicy_DATA += \
 	src/login/org.freedesktop.login1.conf
 
-dist_pkgsysconf_DATA += \
-	src/login/logind.conf
+dist_logindconf_DATA = \
+	src/login/50-default.conf
 
 polkitpolicy_files += \
 	src/login/org.freedesktop.login1.policy
diff --git a/man/loginctl.xml b/man/loginctl.xml
index 749db92..b2eaea4 100644
--- a/man/loginctl.xml
+++ b/man/loginctl.xml
@@ -446,7 +446,7 @@
                         <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
                         <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
                         <citerefentry><refentrytitle>systemd-logind.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
-                        <citerefentry><refentrytitle>logind.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+                        <citerefentry><refentrytitle>logind.conf.d</refentrytitle><manvolnum>5</manvolnum></citerefentry>
                 </para>
         </refsect1>
 
diff --git a/man/logind.conf.d.xml b/man/logind.conf.d.xml
new file mode 100644
index 0000000..1c34017
--- /dev/null
+++ b/man/logind.conf.d.xml
@@ -0,0 +1,381 @@
+<?xml version='1.0'?> <!--*-nxml-*-->
+<?xml-stylesheet type="text/xsl" href="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+        "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<!--
+  This file is part of systemd.
+
+  Copyright 2010 Lennart Poettering
+
+  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.
+
+  systemd is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  Lesser General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public License
+  along with systemd; If not, see <http://www.gnu.org/licenses/>.
+-->
+
+<refentry id="logind.conf.d" conditional='ENABLE_LOGIND'>
+        <refentryinfo>
+                <title>logind.conf.d</title>
+                <productname>systemd</productname>
+
+                <authorgroup>
+                        <author>
+                                <contrib>Developer</contrib>
+                                <firstname>Lennart</firstname>
+                                <surname>Poettering</surname>
+                                <email>lennart at poettering.net</email>
+                        </author>
+                </authorgroup>
+        </refentryinfo>
+
+        <refmeta>
+                <refentrytitle>logind.conf.d</refentrytitle>
+                <manvolnum>5</manvolnum>
+        </refmeta>
+
+        <refnamediv>
+                <refname>logind.conf.d</refname>
+                <refpurpose>Login manager configuration files</refpurpose>
+        </refnamediv>
+
+        <refsynopsisdiv>
+                <para><filename>/etc/systemd/logind.conf.d/*.conf</filename></para>
+                <para><filename>/run/systemd/logind.conf.d/*.conf</filename></para>
+                <para><filename>/usr/lib/systemd/logind.conf.d/*.conf</filename></para>
+        </refsynopsisdiv>
+
+        <refsect1>
+                <title>Description</title>
+
+                <para>These files configure various parameters of the systemd login manager, <citerefentry><refentrytitle>systemd-logind.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para>
+
+                <para>Each configuration file shall be named in the
+                style of <filename><replaceable>program</replaceable>.conf</filename>.
+                Files in <filename>/etc/</filename> override files
+                with the same name in <filename>/usr/lib/</filename>
+                and <filename>/run/</filename>.  Files in
+                <filename>/run/</filename> override files with the same
+                name in <filename>/usr/lib/</filename>. Packages
+                should install their configuration files in
+                <filename>/usr/lib/</filename>. Files in
+                <filename>/etc/</filename> are reserved for the local
+                administrator, who may use this logic to override the
+                configuration files installed by vendor packages. All
+                configuration files are sorted by their filename in
+                lexicographic order, regardless of which of the
+                directories they reside in. If multiple files specify the
+                same option, the entry in the file with the
+                lexicographically latest name will be applied. It is
+                recommended to prefix all filenames with a two-digit
+                number and a dash, to simplify the ordering of the
+                files.</para>
+        </refsect1>
+
+        <refsect1>
+                <title>Options</title>
+
+                <para>All options are configured in the
+                <literal>[Login]</literal> section:</para>
+
+                <variablelist>
+
+                        <varlistentry>
+                                <term><varname>NAutoVTs=</varname></term>
+
+                                <listitem><para>Takes a positive
+                                integer. Configures how many virtual
+                                terminals (VTs) to allocate by default
+                                that, when switched to and are
+                                previously unused,
+                                <literal>autovt</literal> services are
+                                automatically spawned on. These
+                                services are instantiated from the
+                                template unit
+                                <filename>autovt at .service</filename>
+                                for the respective VT TTY name,
+                                for example, <filename>autovt at tty4.service</filename>. By
+                                default,
+                                <filename>autovt at .service</filename>
+                                is linked to
+                                <filename>getty at .service</filename>.
+                                In other words, login prompts are started
+                                dynamically as the user switches to
+                                unused virtual terminals. Hence, this
+                                parameter controls how many login
+                                <literal>gettys</literal> are
+                                available on the VTs. If a VT is
+                                already used by some other subsystem
+                                (for example, a graphical login), this
+                                kind of activation will not be
+                                attempted. Note that the VT configured
+                                in <varname>ReserveVT=</varname> is
+                                always subject to this kind of
+                                activation, even if it is not one of
+                                the VTs configured with the
+                                <varname>NAutoVTs=</varname>
+                                directive. Defaults to 6. When set to
+                                0, automatic spawning of
+                                <literal>autovt</literal> services is
+                                disabled.</para></listitem>
+                        </varlistentry>
+
+                        <varlistentry>
+                                <term><varname>ReserveVT=</varname></term>
+
+                                <listitem><para>Takes a positive
+                                integer. Identifies one
+                                virtual terminal that shall
+                                unconditionally be reserved for
+                                <filename>autovt at .service</filename>
+                                activation (see above). The VT
+                                selected with this option will be
+                                marked busy unconditionally, so that no
+                                other subsystem will allocate it. This
+                                functionality is useful to ensure that,
+                                regardless of how many VTs are allocated
+                                by other subsystems, one login
+                                <literal>getty</literal> is always
+                                available. Defaults to 6 (in other
+                                words, there will always be a
+                                <literal>getty</literal> available on
+                                Alt-F6.). When set to 0, VT
+                                reservation is
+                                disabled.</para></listitem>
+                        </varlistentry>
+
+                        <varlistentry>
+                                <term><varname>KillUserProcesses=</varname></term>
+
+                                <listitem><para>Takes a boolean
+                                argument. Configures whether the
+                                processes of a user should be killed
+                                when the user completely logs out (i.e. after
+                                the user's last session ended). Defaults to
+                                <literal>no</literal>.</para>
+
+                                <para>Note that setting
+                                <varname>KillUserProcesses=1</varname>
+                                will break tools like
+                                <citerefentry><refentrytitle>screen</refentrytitle><manvolnum>1</manvolnum></citerefentry>.</para></listitem>
+                        </varlistentry>
+
+                        <varlistentry>
+                                <term><varname>KillOnlyUsers=</varname></term>
+                                <term><varname>KillExcludeUsers=</varname></term>
+
+                                <listitem><para>These settings take
+                                space-separated lists of usernames
+                                that influence the effect of
+                                <varname>KillUserProcesses=</varname>. If
+                                not empty, only processes of users
+                                listed in
+                                <varname>KillOnlyUsers=</varname> will
+                                be killed when they log out
+                                entirely. Processes of users listed in
+                                <varname>KillExcludeUsers=</varname>
+                                are excluded from being
+                                killed. <varname>KillExcludeUsers=</varname>
+                                defaults to <literal>root</literal>
+                                and takes precedence over
+                                <varname>KillOnlyUsers=</varname>,
+                                which defaults to the empty list.</para></listitem>
+                        </varlistentry>
+
+                        <varlistentry>
+                                <term><varname>IdleAction=</varname></term>
+
+                                <listitem><para>Configures the action
+                                to take when the system is idle. Takes
+                                one of <literal>ignore</literal>,
+                                <literal>poweroff</literal>,
+                                <literal>reboot</literal>,
+                                <literal>halt</literal>,
+                                <literal>kexec</literal>,
+                                <literal>suspend</literal>,
+                                <literal>hibernate</literal>,
+                                <literal>hybrid-sleep</literal>, and
+                                <literal>lock</literal>. Defaults to
+                                <literal>ignore</literal>.</para>
+
+                                <para>Note that this requires that
+                                user sessions correctly report the
+                                idle status to the system. The system
+                                will execute the action after all
+                                sessions report that they are idle,
+                                no idle inhibitor lock is active,
+                                and subsequently, the time configured
+                                with <varname>IdleActionSec=</varname>
+                                (see below) has expired.</para>
+                                </listitem>
+                        </varlistentry>
+
+                        <varlistentry>
+                                <term><varname>IdleActionSec=</varname></term>
+
+                                <listitem><para>Configures the delay
+                                after which the action configured in
+                                <varname>IdleAction=</varname> (see
+                                above) is taken after the system is
+                                idle.</para></listitem>
+                        </varlistentry>
+
+                        <varlistentry>
+                                <term><varname>InhibitDelayMaxSec=</varname></term>
+
+                                <listitem><para>Specifies the maximum
+                                time a system shutdown or sleep
+                                request is delayed due to an inhibitor
+                                lock of type <literal>delay</literal>
+                                being active before the inhibitor is
+                                ignored and the operation executes
+                                anyway. Defaults to
+                                5.</para></listitem>
+                        </varlistentry>
+
+                        <varlistentry>
+                                <term><varname>HandlePowerKey=</varname></term>
+                                <term><varname>HandleSuspendKey=</varname></term>
+                                <term><varname>HandleHibernateKey=</varname></term>
+                                <term><varname>HandleLidSwitch=</varname></term>
+                                <term><varname>HandleLidSwitchDocked=</varname></term>
+
+                                <listitem><para>Controls whether
+                                logind shall handle the system power
+                                and sleep keys and the lid switch to
+                                trigger actions such as system
+                                power-off or suspend. Can be one of
+                                <literal>ignore</literal>,
+                                <literal>poweroff</literal>,
+                                <literal>reboot</literal>,
+                                <literal>halt</literal>,
+                                <literal>kexec</literal>,
+                                <literal>suspend</literal>,
+                                <literal>hibernate</literal>,
+                                <literal>hybrid-sleep</literal>, and
+                                <literal>lock</literal>. If
+                                <literal>ignore</literal>, logind will
+                                never handle these keys. If
+                                <literal>lock</literal>, all running
+                                sessions will be screen-locked;
+                                otherwise, the specified action will
+                                be taken in the respective event. Only
+                                input devices with the
+                                <literal>power-switch</literal> udev
+                                tag will be watched for key/lid switch
+                                events. <varname>HandlePowerKey=</varname>
+                                defaults to
+                                <literal>poweroff</literal>.
+                                <varname>HandleSuspendKey=</varname>
+                                and
+                                <varname>HandleLidSwitch=</varname>
+                                default to <literal>suspend</literal>.
+                                <varname>HandleLidSwitchDocked=</varname>
+                                defaults to <literal>ignore</literal>.
+                                <varname>HandleHibernateKey=</varname>
+                                defaults to
+                                <literal>hibernate</literal>. If the
+                                system is inserted in a docking station,
+                                or if more than one display is connected,
+                                the action specified by
+                                <varname>HandleLidSwitchDocked=</varname>
+                                occurs; otherwise the
+                                <varname>HandleLidSwitch=</varname>
+                                action occurs.</para></listitem>
+                        </varlistentry>
+
+                        <varlistentry>
+                                <term><varname>PowerKeyIgnoreInhibited=</varname></term>
+                                <term><varname>SuspendKeyIgnoreInhibited=</varname></term>
+                                <term><varname>HibernateKeyIgnoreInhibited=</varname></term>
+                                <term><varname>LidSwitchIgnoreInhibited=</varname></term>
+
+                                <listitem><para>Controls whether
+                                actions triggered by the power and
+                                sleep keys and the lid switch are
+                                subject to inhibitor locks. These
+                                settings take boolean arguments. If
+                                <literal>off</literal>, the inhibitor
+                                locks taken by applications in order
+                                to block the requested operation are
+                                respected. If <literal>on</literal>,
+                                the requested operation is executed in
+                                any
+                                case. <varname>PowerKeyIgnoreInhibited=</varname>,
+                                <varname>SuspendKeyIgnoreInhibited=</varname>
+                                and
+                                <varname>HibernateKeyIgnoreInhibited=</varname>
+                                default to <literal>off</literal>.
+                                <varname>LidSwitchIgnoreInhibited=</varname>
+                                defaults to
+                                <literal>yes</literal>. This means
+                                that the lid switch does not respect
+                                suspend blockers by default, but the
+                                power and sleep keys do.
+                                </para></listitem>
+                        </varlistentry>
+
+                        <varlistentry>
+                                <term><varname>RuntimeDirectorySize=</varname></term>
+
+                                <listitem><para>Sets the size limit on
+                                the
+                                <varname>$XDG_RUNTIME_DIR</varname>
+                                runtime directory for each user who
+                                logs in. Takes a size in bytes,
+                                optionally suffixed with the usual K, G,
+                                M, and T suffixes, to the base 1024
+                                (IEC). Alternatively, a numerical
+                                percentage suffixed by <literal>%</literal>
+                                may be specified, which sets the size
+                                limit relative to the amount of
+                                physical RAM. Defaults to 10%. Note
+                                that this size is a safety limit
+                                only. As each runtime directory is a
+                                tmpfs file system, it will only consume
+                                as much memory as is needed.
+                                </para></listitem>
+                        </varlistentry>
+
+                        <varlistentry>
+                                <term><varname>RemoveIPC=</varname></term>
+
+                                <listitem><para>Controls whether
+                                System V and POSIX IPC objects
+                                belonging to the user shall be removed
+                                when the user fully logs out. Takes a
+                                boolean argument. If enabled, the user
+                                may not consume IPC resources after
+                                the last of his sessions
+                                terminated. This covers System V
+                                semaphores, shared memory and message
+                                queues, as well as POSIX shared memory
+                                and message queues. Note that IPC
+                                objects of the root user are excluded
+                                from the effect of this
+                                setting. Defaults to
+                                <literal>yes</literal>.</para></listitem>
+                        </varlistentry>
+
+                </variablelist>
+        </refsect1>
+
+        <refsect1>
+                  <title>See Also</title>
+                  <para>
+                          <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+                          <citerefentry><refentrytitle>systemd-logind.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+                          <citerefentry><refentrytitle>loginctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+                          <citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+                  </para>
+        </refsect1>
+
+</refentry>
diff --git a/man/logind.conf.xml b/man/logind.conf.xml
deleted file mode 100644
index 8ba9523..0000000
--- a/man/logind.conf.xml
+++ /dev/null
@@ -1,359 +0,0 @@
-<?xml version='1.0'?> <!--*-nxml-*-->
-<?xml-stylesheet type="text/xsl" href="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"?>
-<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
-        "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
-
-<!--
-  This file is part of systemd.
-
-  Copyright 2010 Lennart Poettering
-
-  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.
-
-  systemd is distributed in the hope that it will be useful, but
-  WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  Lesser General Public License for more details.
-
-  You should have received a copy of the GNU Lesser General Public License
-  along with systemd; If not, see <http://www.gnu.org/licenses/>.
--->
-
-<refentry id="logind.conf" conditional='ENABLE_LOGIND'>
-        <refentryinfo>
-                <title>logind.conf</title>
-                <productname>systemd</productname>
-
-                <authorgroup>
-                        <author>
-                                <contrib>Developer</contrib>
-                                <firstname>Lennart</firstname>
-                                <surname>Poettering</surname>
-                                <email>lennart at poettering.net</email>
-                        </author>
-                </authorgroup>
-        </refentryinfo>
-
-        <refmeta>
-                <refentrytitle>logind.conf</refentrytitle>
-                <manvolnum>5</manvolnum>
-        </refmeta>
-
-        <refnamediv>
-                <refname>logind.conf</refname>
-                <refpurpose>Login manager configuration file</refpurpose>
-        </refnamediv>
-
-        <refsynopsisdiv>
-                <para><filename>/etc/systemd/logind.conf</filename></para>
-        </refsynopsisdiv>
-
-        <refsect1>
-                <title>Description</title>
-
-                <para>This file configures various parameters of the systemd login manager, <citerefentry><refentrytitle>systemd-logind.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para>
-
-        </refsect1>
-
-        <refsect1>
-                <title>Options</title>
-
-                <para>All options are configured in the
-                <literal>[Login]</literal> section:</para>
-
-                <variablelist>
-
-                        <varlistentry>
-                                <term><varname>NAutoVTs=</varname></term>
-
-                                <listitem><para>Takes a positive
-                                integer. Configures how many virtual
-                                terminals (VTs) to allocate by default
-                                that, when switched to and are
-                                previously unused,
-                                <literal>autovt</literal> services are
-                                automatically spawned on. These
-                                services are instantiated from the
-                                template unit
-                                <filename>autovt at .service</filename>
-                                for the respective VT TTY name,
-                                for example, <filename>autovt at tty4.service</filename>. By
-                                default,
-                                <filename>autovt at .service</filename>
-                                is linked to
-                                <filename>getty at .service</filename>.
-                                In other words, login prompts are started
-                                dynamically as the user switches to
-                                unused virtual terminals. Hence, this
-                                parameter controls how many login
-                                <literal>gettys</literal> are
-                                available on the VTs. If a VT is
-                                already used by some other subsystem
-                                (for example, a graphical login), this
-                                kind of activation will not be
-                                attempted. Note that the VT configured
-                                in <varname>ReserveVT=</varname> is
-                                always subject to this kind of
-                                activation, even if it is not one of
-                                the VTs configured with the
-                                <varname>NAutoVTs=</varname>
-                                directive. Defaults to 6. When set to
-                                0, automatic spawning of
-                                <literal>autovt</literal> services is
-                                disabled.</para></listitem>
-                        </varlistentry>
-
-                        <varlistentry>
-                                <term><varname>ReserveVT=</varname></term>
-
-                                <listitem><para>Takes a positive
-                                integer. Identifies one
-                                virtual terminal that shall
-                                unconditionally be reserved for
-                                <filename>autovt at .service</filename>
-                                activation (see above). The VT
-                                selected with this option will be
-                                marked busy unconditionally, so that no
-                                other subsystem will allocate it. This
-                                functionality is useful to ensure that,
-                                regardless of how many VTs are allocated
-                                by other subsystems, one login
-                                <literal>getty</literal> is always
-                                available. Defaults to 6 (in other
-                                words, there will always be a
-                                <literal>getty</literal> available on
-                                Alt-F6.). When set to 0, VT
-                                reservation is
-                                disabled.</para></listitem>
-                        </varlistentry>
-
-                        <varlistentry>
-                                <term><varname>KillUserProcesses=</varname></term>
-
-                                <listitem><para>Takes a boolean
-                                argument. Configures whether the
-                                processes of a user should be killed
-                                when the user completely logs out (i.e. after
-                                the user's last session ended). Defaults to
-                                <literal>no</literal>.</para>
-
-                                <para>Note that setting
-                                <varname>KillUserProcesses=1</varname>
-                                will break tools like
-                                <citerefentry><refentrytitle>screen</refentrytitle><manvolnum>1</manvolnum></citerefentry>.</para></listitem>
-                        </varlistentry>
-
-                        <varlistentry>
-                                <term><varname>KillOnlyUsers=</varname></term>
-                                <term><varname>KillExcludeUsers=</varname></term>
-
-                                <listitem><para>These settings take
-                                space-separated lists of usernames
-                                that influence the effect of
-                                <varname>KillUserProcesses=</varname>. If
-                                not empty, only processes of users
-                                listed in
-                                <varname>KillOnlyUsers=</varname> will
-                                be killed when they log out
-                                entirely. Processes of users listed in
-                                <varname>KillExcludeUsers=</varname>
-                                are excluded from being
-                                killed. <varname>KillExcludeUsers=</varname>
-                                defaults to <literal>root</literal>
-                                and takes precedence over
-                                <varname>KillOnlyUsers=</varname>,
-                                which defaults to the empty list.</para></listitem>
-                        </varlistentry>
-
-                        <varlistentry>
-                                <term><varname>IdleAction=</varname></term>
-
-                                <listitem><para>Configures the action
-                                to take when the system is idle. Takes
-                                one of <literal>ignore</literal>,
-                                <literal>poweroff</literal>,
-                                <literal>reboot</literal>,
-                                <literal>halt</literal>,
-                                <literal>kexec</literal>,
-                                <literal>suspend</literal>,
-                                <literal>hibernate</literal>,
-                                <literal>hybrid-sleep</literal>, and
-                                <literal>lock</literal>. Defaults to
-                                <literal>ignore</literal>.</para>
-
-                                <para>Note that this requires that
-                                user sessions correctly report the
-                                idle status to the system. The system
-                                will execute the action after all
-                                sessions report that they are idle,
-                                no idle inhibitor lock is active,
-                                and subsequently, the time configured
-                                with <varname>IdleActionSec=</varname>
-                                (see below) has expired.</para>
-                                </listitem>
-                        </varlistentry>
-
-                        <varlistentry>
-                                <term><varname>IdleActionSec=</varname></term>
-
-                                <listitem><para>Configures the delay
-                                after which the action configured in
-                                <varname>IdleAction=</varname> (see
-                                above) is taken after the system is
-                                idle.</para></listitem>
-                        </varlistentry>
-
-                        <varlistentry>
-                                <term><varname>InhibitDelayMaxSec=</varname></term>
-
-                                <listitem><para>Specifies the maximum
-                                time a system shutdown or sleep
-                                request is delayed due to an inhibitor
-                                lock of type <literal>delay</literal>
-                                being active before the inhibitor is
-                                ignored and the operation executes
-                                anyway. Defaults to
-                                5.</para></listitem>
-                        </varlistentry>
-
-                        <varlistentry>
-                                <term><varname>HandlePowerKey=</varname></term>
-                                <term><varname>HandleSuspendKey=</varname></term>
-                                <term><varname>HandleHibernateKey=</varname></term>
-                                <term><varname>HandleLidSwitch=</varname></term>
-                                <term><varname>HandleLidSwitchDocked=</varname></term>
-
-                                <listitem><para>Controls whether
-                                logind shall handle the system power
-                                and sleep keys and the lid switch to
-                                trigger actions such as system
-                                power-off or suspend. Can be one of
-                                <literal>ignore</literal>,
-                                <literal>poweroff</literal>,
-                                <literal>reboot</literal>,
-                                <literal>halt</literal>,
-                                <literal>kexec</literal>,
-                                <literal>suspend</literal>,
-                                <literal>hibernate</literal>,
-                                <literal>hybrid-sleep</literal>, and
-                                <literal>lock</literal>. If
-                                <literal>ignore</literal>, logind will
-                                never handle these keys. If
-                                <literal>lock</literal>, all running
-                                sessions will be screen-locked;
-                                otherwise, the specified action will
-                                be taken in the respective event. Only
-                                input devices with the
-                                <literal>power-switch</literal> udev
-                                tag will be watched for key/lid switch
-                                events. <varname>HandlePowerKey=</varname>
-                                defaults to
-                                <literal>poweroff</literal>.
-                                <varname>HandleSuspendKey=</varname>
-                                and
-                                <varname>HandleLidSwitch=</varname>
-                                default to <literal>suspend</literal>.
-                                <varname>HandleLidSwitchDocked=</varname>
-                                defaults to <literal>ignore</literal>.
-                                <varname>HandleHibernateKey=</varname>
-                                defaults to
-                                <literal>hibernate</literal>. If the
-                                system is inserted in a docking station,
-                                or if more than one display is connected,
-                                the action specified by
-                                <varname>HandleLidSwitchDocked=</varname>
-                                occurs; otherwise the
-                                <varname>HandleLidSwitch=</varname>
-                                action occurs.</para></listitem>
-                        </varlistentry>
-
-                        <varlistentry>
-                                <term><varname>PowerKeyIgnoreInhibited=</varname></term>
-                                <term><varname>SuspendKeyIgnoreInhibited=</varname></term>
-                                <term><varname>HibernateKeyIgnoreInhibited=</varname></term>
-                                <term><varname>LidSwitchIgnoreInhibited=</varname></term>
-
-                                <listitem><para>Controls whether
-                                actions triggered by the power and
-                                sleep keys and the lid switch are
-                                subject to inhibitor locks. These
-                                settings take boolean arguments. If
-                                <literal>off</literal>, the inhibitor
-                                locks taken by applications in order
-                                to block the requested operation are
-                                respected. If <literal>on</literal>,
-                                the requested operation is executed in
-                                any
-                                case. <varname>PowerKeyIgnoreInhibited=</varname>,
-                                <varname>SuspendKeyIgnoreInhibited=</varname>
-                                and
-                                <varname>HibernateKeyIgnoreInhibited=</varname>
-                                default to <literal>off</literal>.
-                                <varname>LidSwitchIgnoreInhibited=</varname>
-                                defaults to
-                                <literal>yes</literal>. This means
-                                that the lid switch does not respect
-                                suspend blockers by default, but the
-                                power and sleep keys do.
-                                </para></listitem>
-                        </varlistentry>
-
-                        <varlistentry>
-                                <term><varname>RuntimeDirectorySize=</varname></term>
-
-                                <listitem><para>Sets the size limit on
-                                the
-                                <varname>$XDG_RUNTIME_DIR</varname>
-                                runtime directory for each user who
-                                logs in. Takes a size in bytes,
-                                optionally suffixed with the usual K, G,
-                                M, and T suffixes, to the base 1024
-                                (IEC). Alternatively, a numerical
-                                percentage suffixed by <literal>%</literal>
-                                may be specified, which sets the size
-                                limit relative to the amount of
-                                physical RAM. Defaults to 10%. Note
-                                that this size is a safety limit
-                                only. As each runtime directory is a
-                                tmpfs file system, it will only consume
-                                as much memory as is needed.
-                                </para></listitem>
-                        </varlistentry>
-
-                        <varlistentry>
-                                <term><varname>RemoveIPC=</varname></term>
-
-                                <listitem><para>Controls whether
-                                System V and POSIX IPC objects
-                                belonging to the user shall be removed
-                                when the user fully logs out. Takes a
-                                boolean argument. If enabled, the user
-                                may not consume IPC resources after
-                                the last of his sessions
-                                terminated. This covers System V
-                                semaphores, shared memory and message
-                                queues, as well as POSIX shared memory
-                                and message queues. Note that IPC
-                                objects of the root user are excluded
-                                from the effect of this
-                                setting. Defaults to
-                                <literal>yes</literal>.</para></listitem>
-                        </varlistentry>
-
-                </variablelist>
-        </refsect1>
-
-        <refsect1>
-                  <title>See Also</title>
-                  <para>
-                          <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
-                          <citerefentry><refentrytitle>systemd-logind.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
-                          <citerefentry><refentrytitle>loginctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
-                          <citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>
-                  </para>
-        </refsect1>
-
-</refentry>
diff --git a/man/nss-myhostname.xml b/man/nss-myhostname.xml
index ba9297e..cf82fcc 100644
--- a/man/nss-myhostname.xml
+++ b/man/nss-myhostname.xml
@@ -121,7 +121,7 @@ netgroup:       nis</programlisting>
                 <para>
                         <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
                         <citerefentry><refentrytitle>systemd-logind.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
-                        <citerefentry><refentrytitle>logind.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
+                        <citerefentry><refentrytitle>logind.conf.d</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
                         <citerefentry><refentrytitle>loginctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
                         <citerefentry project='man-pages'><refentrytitle>pam.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
                         <citerefentry project='man-pages'><refentrytitle>pam.d</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
diff --git a/man/pam_systemd.xml b/man/pam_systemd.xml
index 4df26a3..d528e72 100644
--- a/man/pam_systemd.xml
+++ b/man/pam_systemd.xml
@@ -312,7 +312,7 @@ session    required     pam_systemd.so</programlisting>
                 <para>
                         <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
                         <citerefentry><refentrytitle>systemd-logind.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
-                        <citerefentry><refentrytitle>logind.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
+                        <citerefentry><refentrytitle>logind.conf.d</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
                         <citerefentry><refentrytitle>loginctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
                         <citerefentry project='man-pages'><refentrytitle>pam.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
                         <citerefentry project='man-pages'><refentrytitle>pam.d</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
diff --git a/man/systemd-inhibit.xml b/man/systemd-inhibit.xml
index c694744..0d35ebd 100644
--- a/man/systemd-inhibit.xml
+++ b/man/systemd-inhibit.xml
@@ -144,7 +144,7 @@
                                 time elapses, the lock is ignored and
                                 the operation executed. The time limit
                                 may be specified in
-                                <citerefentry><refentrytitle>logind.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>. Note
+                                <citerefentry><refentrytitle>logind.conf.d</refentrytitle><manvolnum>5</manvolnum></citerefentry>. Note
                                 that <literal>delay</literal> is only
                                 available for <literal>sleep</literal>
                                 and
@@ -187,7 +187,7 @@
                 <title>See Also</title>
                 <para>
                         <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
-                        <citerefentry><refentrytitle>logind.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+                        <citerefentry><refentrytitle>logind.conf.d</refentrytitle><manvolnum>5</manvolnum></citerefentry>
                 </para>
         </refsect1>
 
diff --git a/man/systemd-logind.service.xml b/man/systemd-logind.service.xml
index c0c3d1a..c67c2d4 100644
--- a/man/systemd-logind.service.xml
+++ b/man/systemd-logind.service.xml
@@ -96,7 +96,7 @@
                 PAM module.</para>
 
                 <para>See
-                <citerefentry><refentrytitle>logind.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+                <citerefentry><refentrytitle>logind.conf.d</refentrytitle><manvolnum>5</manvolnum></citerefentry>
                 for information about the configuration of this
                 service.</para>
 
@@ -123,7 +123,7 @@
                         <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
                         <citerefentry><refentrytitle>systemd-user-sessions.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
                         <citerefentry><refentrytitle>loginctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
-                        <citerefentry><refentrytitle>logind.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
+                        <citerefentry><refentrytitle>logind.conf.d</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
                         <citerefentry><refentrytitle>pam_systemd</refentrytitle><manvolnum>8</manvolnum></citerefentry>
                 </para>
         </refsect1>
diff --git a/src/login/50-default.conf b/src/login/50-default.conf
new file mode 100644
index 0000000..77ceb1e
--- /dev/null
+++ b/src/login/50-default.conf
@@ -0,0 +1,29 @@
+#  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.
+#
+# See logind.conf.d(5) for details
+
+[Login]
+#NAutoVTs=6
+#ReserveVT=6
+#KillUserProcesses=no
+#KillOnlyUsers=
+#KillExcludeUsers=root
+#InhibitDelayMaxSec=5
+#HandlePowerKey=poweroff
+#HandleSuspendKey=suspend
+#HandleHibernateKey=hibernate
+#HandleLidSwitch=suspend
+#HandleLidSwitchDocked=ignore
+#PowerKeyIgnoreInhibited=no
+#SuspendKeyIgnoreInhibited=no
+#HibernateKeyIgnoreInhibited=no
+#LidSwitchIgnoreInhibited=yes
+#IdleAction=ignore
+#IdleActionSec=30min
+#RuntimeDirectorySize=10%
+#RemoveIPC=yes
diff --git a/src/login/logind.c b/src/login/logind.c
index 8f00c46..7c80974 100644
--- a/src/login/logind.c
+++ b/src/login/logind.c
@@ -36,6 +36,16 @@
 #include "logind.h"
 #include "udev-util.h"
 
+static const char conf_file_dirs[] =
+        "/etc/systemd/logind.conf.d\0"
+        "/run/systemd/logind.conf.d\0"
+        "/usr/local/lib/systemd/logind.conf.d\0"
+        "/usr/lib/systemd/logind.conf.d\0"
+#ifdef HAVE_SPLIT_USR
+        "/lib/systemd/logind.conf.d\0"
+#endif
+        ;
+
 Manager *manager_new(void) {
         Manager *m;
         int r;
@@ -1171,10 +1181,9 @@ int manager_run(Manager *m) {
 static int manager_parse_config_file(Manager *m) {
         assert(m);
 
-        return config_parse(NULL, "/etc/systemd/logind.conf", NULL,
-                            "Login\0",
-                            config_item_perf_lookup, logind_gperf_lookup,
-                            false, false, true, m);
+        return config_parse_many(conf_file_dirs, "Login\0",
+                                 config_item_perf_lookup, logind_gperf_lookup,
+                                 false, m);
 }
 
 int main(int argc, char *argv[]) {
diff --git a/src/login/logind.conf b/src/login/logind.conf
deleted file mode 100644
index 4608a2c..0000000
--- a/src/login/logind.conf
+++ /dev/null
@@ -1,29 +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.
-#
-# See logind.conf(5) for details
-
-[Login]
-#NAutoVTs=6
-#ReserveVT=6
-#KillUserProcesses=no
-#KillOnlyUsers=
-#KillExcludeUsers=root
-#InhibitDelayMaxSec=5
-#HandlePowerKey=poweroff
-#HandleSuspendKey=suspend
-#HandleHibernateKey=hibernate
-#HandleLidSwitch=suspend
-#HandleLidSwitchDocked=ignore
-#PowerKeyIgnoreInhibited=no
-#SuspendKeyIgnoreInhibited=no
-#HibernateKeyIgnoreInhibited=no
-#LidSwitchIgnoreInhibited=yes
-#IdleAction=ignore
-#IdleActionSec=30min
-#RuntimeDirectorySize=10%
-#RemoveIPC=yes
diff --git a/src/shared/conf-parser.c b/src/shared/conf-parser.c
index ee6de65..3d10270 100644
--- a/src/shared/conf-parser.c
+++ b/src/shared/conf-parser.c
@@ -27,6 +27,7 @@
 #include <netinet/ether.h>
 
 #include "conf-parser.h"
+#include "conf-files.h"
 #include "util.h"
 #include "macro.h"
 #include "strv.h"
@@ -430,6 +431,30 @@ int config_parse(const char *unit,
         return 0;
 }
 
+/* Parse each config file in the specified directories. */
+int config_parse_many(const char *conf_file_dirs,
+                      const char *sections,
+                      ConfigItemLookup lookup,
+                      const void *table,
+                      bool relaxed,
+                      void *userdata) {
+        _cleanup_strv_free_ char **files = NULL;
+        char **fn;
+        int r;
+
+        r = conf_files_list_nulstr(&files, ".conf", NULL, conf_file_dirs);
+        if (r < 0)
+                return r;
+
+        STRV_FOREACH(fn, files) {
+                r = config_parse(NULL, *fn, NULL, sections, lookup, table, relaxed, false, true, userdata);
+                if (r < 0)
+                        return r;
+        }
+
+        return 0;
+}
+
 #define DEFINE_PARSER(type, vartype, conv_func)                         \
         int config_parse_##type(const char *unit,                       \
                                 const char *filename,                   \
diff --git a/src/shared/conf-parser.h b/src/shared/conf-parser.h
index 62f2a01..6d156b6 100644
--- a/src/shared/conf-parser.h
+++ b/src/shared/conf-parser.h
@@ -92,6 +92,13 @@ int config_parse(const char *unit,
                  bool warn,
                  void *userdata);
 
+int config_parse_many(const char *conf_file_dirs, /* nulstr */
+                      const char *sections,       /* nulstr */
+                      ConfigItemLookup lookup,
+                      const void *table,
+                      bool relaxed,
+                      void *userdata);
+
 /* Generic parsers */
 int config_parse_int(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
 int config_parse_unsigned(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
diff --git a/units/org.freedesktop.login1.busname b/units/org.freedesktop.login1.busname
index d0686b1..edfe0d7 100644
--- a/units/org.freedesktop.login1.busname
+++ b/units/org.freedesktop.login1.busname
@@ -7,7 +7,7 @@
 
 [Unit]
 Description=Login Service Bus Name
-Documentation=man:systemd-logind.service(8) man:logind.conf(5)
+Documentation=man:systemd-logind.service(8) man:logind.conf.d(5)
 Documentation=http://www.freedesktop.org/wiki/Software/systemd/logind
 Documentation=http://www.freedesktop.org/wiki/Software/systemd/multiseat
 
diff --git a/units/systemd-logind.service.in b/units/systemd-logind.service.in
index f087e99..061dffe 100644
--- a/units/systemd-logind.service.in
+++ b/units/systemd-logind.service.in
@@ -7,7 +7,7 @@
 
 [Unit]
 Description=Login Service
-Documentation=man:systemd-logind.service(8) man:logind.conf(5)
+Documentation=man:systemd-logind.service(8) man:logind.conf.d(5)
 Documentation=http://www.freedesktop.org/wiki/Software/systemd/logind
 Documentation=http://www.freedesktop.org/wiki/Software/systemd/multiseat
 Wants=user.slice
-- 
2.1.1



More information about the systemd-devel mailing list