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/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/*.conf.d. This simplfies 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. Given, however, that the base configuration files in /etc/systemd have the lowest priority, they will always be overridden by any snippets. As it may confuse a user who is used to modifying these base files directly, this patch puts symlinks in the overriding /etc/systemd/*.conf.d/ directories back to the top-level files, thereby restoring them to their top-level glory. The default config files installed by systemd are just lists of (commented out) defaults so this should be safe. The symlinks also provide an indication to the user that there is more to systemd configuration than just the top-level file and that checking the man page may be in order... With this patch, systemd gets the right configuration irregardless of whether /etc is populated at boot or not (i.e. in a "stateless" system). License-Update: configuration snippets licensing is independent of systemd licensing Signed-off-by: Jonas Bonn <jo...@norrbonn.se> --- meta/recipes-core/systemd/systemd-conf.bb | 48 +++++++++++------------ meta/recipes-core/systemd/systemd_239.bb | 16 ++++---- 2 files changed, 31 insertions(+), 33 deletions(-) diff --git a/meta/recipes-core/systemd/systemd-conf.bb b/meta/recipes-core/systemd/systemd-conf.bb index 7fe2e1105b..8a9f01c48a 100644 --- a/meta/recipes-core/systemd/systemd-conf.bb +++ b/meta/recipes-core/systemd/systemd-conf.bb @@ -1,48 +1,44 @@ -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" 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' +FILES_${PN} = "/usr/lib/journald.conf.d/* \ + /usr/lib/logind.conf.d/* \ + /usr/lib/system.conf.d/* \ + /etc/systemd/* \ +" 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 + install -d ${D}/usr/lib/journald.conf.d # Enable journal to forward message to syslog daemon - sed -i -e 's/.*ForwardToSyslog.*/ForwardToSyslog=yes/' ${D}${sysconfdir}/systemd/journald.conf + echo "ForwardToSyslog=yes" >> ${D}/usr/lib/journald.conf.d/00-${PN}.conf # Set the maximium size of runtime journal to 64M as default - sed -i -e 's/.*RuntimeMaxUse.*/RuntimeMaxUse=64M/' ${D}${sysconfdir}/systemd/journald.conf + echo "RuntimeMaxUse=64M" >> ${D}/usr/lib/journald.conf.d/00-${PN}.conf + + install -d ${D}${sysconfdir}/systemd/journald.conf.d + ln -s ../journald.conf ${D}${sysconfdir}/systemd/journald.conf.d/00-${PN}.conf - install -m 0644 ${S}/src/login/logind.conf.in ${D}${sysconfdir}/systemd/logind.conf + install -d ${D}/usr/lib/logind.conf.d # Set KILL_USER_PROCESSES to yes - sed -i -e 's/@KILL_USER_PROCESSES@/yes/' ${D}${sysconfdir}/systemd/logind.conf + echo "KillUserProcesses=yes" >> ${D}/usr/lib/logind.conf.d/00-${PN}.conf + + install -d ${D}${sysconfdir}/systemd/logind.conf.d + ln -s ../logind.conf ${D}${sysconfdir}/systemd/logind.conf.d/00-${PN}.conf - install -m 0644 ${S}/src/core/system.conf.in ${D}${sysconfdir}/systemd/system.conf + install -d ${D}/usr/lib/system.conf.d # Set MEMORY_ACCOUNTING_DEFAULT to yes - sed -i -e 's/@MEMORY_ACCOUNTING_DEFAULT@/yes/' ${D}${sysconfdir}/systemd/system.conf + echo "DefaultMemoryAccounting=yes" >> ${D}/usr/lib/system.conf.d/00-${PN}.conf - install -m 0644 ${S}/src/core/user.conf ${D}${sysconfdir}/systemd/user.conf + install -d ${D}${sysconfdir}/systemd/system.conf.d + ln -s ../system.conf ${D}${sysconfdir}/systemd/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 + echo "DefaultTimeoutStartSec = 240s" >> ${D}/usr/lib/system.conf.d/00-${PN}.conf } diff --git a/meta/recipes-core/systemd/systemd_239.bb b/meta/recipes-core/systemd/systemd_239.bb index 54217d3042..c6b93251b3 100644 --- a/meta/recipes-core/systemd/systemd_239.bb +++ b/meta/recipes-core/systemd/systemd_239.bb @@ -291,13 +291,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 @@ -496,6 +489,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 \ -- 2.19.1 -- _______________________________________________ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core