]> code.ossystems Code Review - openembedded-core.git/commitdiff
systemd: do not create machine-id
authorJonas Bonn <jonas@norrbonn.se>
Thu, 2 May 2019 21:09:40 +0000 (22:09 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 2 May 2019 21:20:24 +0000 (22:20 +0100)
There is no reason to have an emtpy machine-id as part of the systemd
package.  Either:

i)  the filesystem is writable and the file will be created
automatically; or
ii) the filesystem is read-only, in which case the empty machine-id file
should be created as part of the read-only-rootfs tweaks.

Signed-off-by: Jonas Bonn <jonas@norrbonn.se>
Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/rootfs-postcommands.bbclass
meta/recipes-core/systemd/systemd-conf_242.bb
meta/recipes-core/systemd/systemd/99-default.preset [new file with mode: 0644]
meta/recipes-core/systemd/systemd_242.bb

index bde58ad6cd3670986d616201095708b32fd22f63..89f8efd323634ed50e186e85156d0ee7a4c4a94b 100644 (file)
@@ -126,6 +126,12 @@ read_only_rootfs_hook () {
                        ${IMAGE_ROOTFS}/etc/init.d/populate-volatile.sh
                fi
        fi
+
+       if ${@bb.utils.contains("DISTRO_FEATURES", "systemd", "true", "false", d)}; then
+       # Create machine-id
+       # 20:12 < mezcalero> koen: you have three options: a) run systemd-machine-id-setup at install time, b) have / read-only and an empty file there (for stateless) and c) boot with / writable
+               touch ${IMAGE_ROOTFS}${sysconfdir}/machine-id
+       fi
 }
 
 #
index 9bb27fd96d9c3e1d0cf5eb356f29468c34415fb5..7fe2e1105bef26b15ab7c532957dcdcd65635281 100644 (file)
@@ -7,14 +7,13 @@ DefaultTimeoutStartSec setting."
 
 PACKAGE_ARCH = "${MACHINE_ARCH}"
 
-CONFFILES_${PN} = "${sysconfdir}/machine-id \
-${sysconfdir}/systemd/coredump.conf \
+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}/machine-id ${sysconfdir}/systemd"
+FILES_${PN} = "${sysconfdir}/systemd"
 
 do_configure[noexec] = '1'
 do_compile[noexec] = '1'
@@ -23,10 +22,6 @@ do_install() {
        rm -rf ${D}/${sysconfdir}/systemd
        install -d ${D}/${sysconfdir}/systemd
 
-       # Create machine-id
-       # 20:12 < mezcalero> koen: you have three options: a) run systemd-machine-id-setup at install time, b) have / read-only and an empty file there (for stateless) and c) boot with / writable
-       touch ${D}${sysconfdir}/machine-id
-
        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
diff --git a/meta/recipes-core/systemd/systemd/99-default.preset b/meta/recipes-core/systemd/systemd/99-default.preset
new file mode 100644 (file)
index 0000000..1f29b50
--- /dev/null
@@ -0,0 +1 @@
+disable *
index 9f194f2b6ca177f977ae6ca474d92fc394b6bee2..7d1b0ec13a44be2210d80aa209a7d778fafa4742 100644 (file)
@@ -22,6 +22,7 @@ SRC_URI += "file://touchscreen.rules \
            file://0003-implment-systemd-sysv-install-for-OE.patch \
            file://0004-rules-whitelist-hd-devices.patch \
            file://0005-rules-watch-metadata-changes-in-ide-devices.patch \
+           file://99-default.preset \
            "
 
 # patches needed by musl
@@ -277,7 +278,6 @@ do_install() {
        fi
 
        # conf files are handled by systemd-conf
-       rm -f ${D}${sysconfdir}/machine-id
        rm -f ${D}${sysconfdir}/systemd/coredump.conf
        rm -f ${D}${sysconfdir}/systemd/journald.conf
        rm -f ${D}${sysconfdir}/systemd/logind.conf
@@ -287,6 +287,10 @@ do_install() {
        # duplicate udevadm for postinst script
        install -d ${D}${libexecdir}
        ln ${D}${base_bindir}/udevadm ${D}${libexecdir}/${MLPREFIX}udevadm
+
+       # install default policy for presets
+       # https://www.freedesktop.org/wiki/Software/systemd/Preset/#howto
+       install -Dm 0644 ${WORKDIR}/99-default.preset ${D}${systemd_unitdir}/system-preset/99-default.preset
 }