]> code.ossystems Code Review - openembedded-core.git/commitdiff
systemd-conf: simplify creation of machine-specific configuration
authorAlex Kiernan <alex.kiernan@hivehome.com>
Thu, 2 May 2019 21:09:41 +0000 (22:09 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 2 May 2019 21:20:24 +0000 (22:20 +0100)
The configuration files that systemd installs are just skeletons
detailing the available options and their default values.  The
recommended means of changing the configuration is to provide snippets
in configuration directories.  For example, journald.conf settings are
best set in /usr/lib/system.d/journald.conf.d/ and can be overridden by
the user by providing overriding snippets in
/etc/systemd/journald.conf.d/.

The systemd-conf package is just providing machine-specific overrides
for some systemd defaults.

This patch restores the installation of config files by systemd and
reduces systemd-conf to just providing the config snippets in
/usr/lib/systemd/*.conf.d.  This simpilfies the systemd-conf recipe
considerably since it now just sets up a couple of text files and
doesn't even need access to the systemd source anymore.

License-Update: configuration snippets licensing is independent of
systemd licensing

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-core/systemd/systemd-conf/journald.conf [new file with mode: 0644]
meta/recipes-core/systemd/systemd-conf/logind.conf [new file with mode: 0644]
meta/recipes-core/systemd/systemd-conf/system.conf [new file with mode: 0644]
meta/recipes-core/systemd/systemd-conf/system.conf-qemuall [new file with mode: 0644]
meta/recipes-core/systemd/systemd-conf_242.bb
meta/recipes-core/systemd/systemd_242.bb

diff --git a/meta/recipes-core/systemd/systemd-conf/journald.conf b/meta/recipes-core/systemd/systemd-conf/journald.conf
new file mode 100644 (file)
index 0000000..fd4d969
--- /dev/null
@@ -0,0 +1,3 @@
+[Journal]
+ForwardToSyslog=yes
+RuntimeMaxUse=64M
diff --git a/meta/recipes-core/systemd/systemd-conf/logind.conf b/meta/recipes-core/systemd/systemd-conf/logind.conf
new file mode 100644 (file)
index 0000000..bf7f692
--- /dev/null
@@ -0,0 +1,2 @@
+[Login]
+KillUserProcesses=yes
diff --git a/meta/recipes-core/systemd/systemd-conf/system.conf b/meta/recipes-core/systemd/systemd-conf/system.conf
new file mode 100644 (file)
index 0000000..554cab2
--- /dev/null
@@ -0,0 +1,2 @@
+[Manager]
+DefaultMemoryAccounting=yes
diff --git a/meta/recipes-core/systemd/systemd-conf/system.conf-qemuall b/meta/recipes-core/systemd/systemd-conf/system.conf-qemuall
new file mode 100644 (file)
index 0000000..741be27
--- /dev/null
@@ -0,0 +1,3 @@
+[Manager]
+# Change DefaultTimeoutStartSec from 90s to 240s
+DefaultTimeoutStartSec = 240s
index 7fe2e1105bef26b15ab7c532957dcdcd65635281..96beea53a73aa4738fb6a0221e7c6896a8b3cbc8 100644 (file)
@@ -1,48 +1,32 @@
-require systemd.inc
-
 SUMMARY = "Systemd system configuration"
 DESCRIPTION = "Systemd may require slightly different configuration for \
 different machines.  For example, qemu machines require a longer \
 DefaultTimeoutStartSec setting."
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
 
-PACKAGE_ARCH = "${MACHINE_ARCH}"
-
-CONFFILES_${PN} = "${sysconfdir}/systemd/coredump.conf \
-${sysconfdir}/systemd/journald.conf \
-${sysconfdir}/systemd/logind.conf \
-${sysconfdir}/systemd/system.conf \
-${sysconfdir}/systemd/user.conf"
-
-FILES_${PN} = "${sysconfdir}/systemd"
-
-do_configure[noexec] = '1'
-do_compile[noexec] = '1'
+SRC_URI = "\
+    file://journald.conf \
+    file://logind.conf \
+    file://system.conf \
+    file://system.conf-qemuall \
+"
 
 do_install() {
-       rm -rf ${D}/${sysconfdir}/systemd
-       install -d ${D}/${sysconfdir}/systemd
-
-       install -m 0644 ${S}/src/coredump/coredump.conf ${D}${sysconfdir}/systemd/coredump.conf
-
-       install -m 0644 ${S}/src/journal/journald.conf ${D}${sysconfdir}/systemd/journald.conf
-       # Enable journal to forward message to syslog daemon
-       sed -i -e 's/.*ForwardToSyslog.*/ForwardToSyslog=yes/' ${D}${sysconfdir}/systemd/journald.conf
-       # Set the maximium size of runtime journal to 64M as default
-       sed -i -e 's/.*RuntimeMaxUse.*/RuntimeMaxUse=64M/' ${D}${sysconfdir}/systemd/journald.conf
-
-       install -m 0644 ${S}/src/login/logind.conf.in ${D}${sysconfdir}/systemd/logind.conf
-       # Set KILL_USER_PROCESSES to yes
-       sed -i -e 's/@KILL_USER_PROCESSES@/yes/' ${D}${sysconfdir}/systemd/logind.conf
-
-       install -m 0644 ${S}/src/core/system.conf.in ${D}${sysconfdir}/systemd/system.conf
-       # Set MEMORY_ACCOUNTING_DEFAULT to yes
-       sed -i -e 's/@MEMORY_ACCOUNTING_DEFAULT@/yes/' ${D}${sysconfdir}/systemd/system.conf
-
-       install -m 0644 ${S}/src/core/user.conf ${D}${sysconfdir}/systemd/user.conf
+       install -D -m0644 ${WORKDIR}/journald.conf ${D}${systemd_unitdir}/journald.conf.d/00-${PN}.conf
+       install -D -m0644 ${WORKDIR}/logind.conf ${D}${systemd_unitdir}/logind.conf.d/00-${PN}.conf
+       install -D -m0644 ${WORKDIR}/system.conf ${D}${systemd_unitdir}/system.conf.d/00-${PN}.conf
 }
 
 # Based on change from YP bug 8141, OE commit 5196d7bacaef1076c361adaa2867be31759c1b52
 do_install_append_qemuall() {
-       # Change DefaultTimeoutStartSec from 90s to 240s
-       echo "DefaultTimeoutStartSec = 240s" >> ${D}${sysconfdir}/systemd/system.conf
+       install -D -m0644 ${WORKDIR}/system.conf-qemuall ${D}${systemd_unitdir}/system.conf.d/01-${PN}.conf
 }
+
+PACKAGE_ARCH = "${MACHINE_ARCH}"
+
+FILES_${PN} = "\
+    ${systemd_unitdir}/journald.conf.d/ \
+    ${systemd_unitdir}/logind.conf.d/ \
+    ${systemd_unitdir}/system.conf.d/ \
+"
index 7d1b0ec13a44be2210d80aa209a7d778fafa4742..a6b39d57e8f993fb52b557fc7d19f3edaf2fbb86 100644 (file)
@@ -277,13 +277,6 @@ do_install() {
                fi
        fi
 
-       # conf files are handled by systemd-conf
-       rm -f ${D}${sysconfdir}/systemd/coredump.conf
-       rm -f ${D}${sysconfdir}/systemd/journald.conf
-       rm -f ${D}${sysconfdir}/systemd/logind.conf
-       rm -f ${D}${sysconfdir}/systemd/system.conf
-       rm -f ${D}${sysconfdir}/systemd/user.conf
-
        # duplicate udevadm for postinst script
        install -d ${D}${libexecdir}
        ln ${D}${base_bindir}/udevadm ${D}${libexecdir}/${MLPREFIX}udevadm
@@ -486,6 +479,15 @@ FILES_${PN}-extra-utils = "\
                         ${rootlibexecdir}/systemd/systemd-cgroups-agent \
 "
 
+CONFFILES_${PN} = "${sysconfdir}/systemd/coredump.conf \
+       ${sysconfdir}/systemd/journald.conf \
+       ${sysconfdir}/systemd/logind.conf \
+       ${sysconfdir}/systemd/system.conf \
+       ${sysconfdir}/systemd/user.conf \
+       ${sysconfdir}/systemd/resolved.conf \
+       ${sysconfdir}/systemd/timesyncd.conf \
+"
+
 FILES_${PN} = " ${base_bindir}/* \
                 ${base_sbindir}/shutdown \
                 ${base_sbindir}/halt \
@@ -549,7 +551,7 @@ FILES_${PN}-dev += "${base_libdir}/security/*.la ${datadir}/dbus-1/interfaces/ $
 
 RDEPENDS_${PN} += "kmod dbus util-linux-mount util-linux-umount udev (= ${EXTENDPKGV}) util-linux-agetty util-linux-fsck"
 RDEPENDS_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'serial-getty-generator', '', 'systemd-serialgetty', d)}"
-RDEPENDS_${PN} += "volatile-binds update-rc.d systemd-conf"
+RDEPENDS_${PN} += "volatile-binds update-rc.d"
 RDEPENDS_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'myhostname', 'libnss-myhostname', '', d)}"
 
 RRECOMMENDS_${PN} += "systemd-extra-utils \
@@ -557,6 +559,7 @@ RRECOMMENDS_${PN} += "systemd-extra-utils \
                       e2fsprogs-e2fsck \
                       kernel-module-autofs4 kernel-module-unix kernel-module-ipv6 \
                       os-release \
+                      systemd-conf \
 "
 
 INSANE_SKIP_${PN} += "dev-so libdir"