All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Alex Kiernan" <alex.kiernan@gmail.com>
To: openembedded-core@lists.openembedded.org
Cc: Alex Kiernan <alex.kiernan@gmail.com>
Subject: [OE-Core][RFC PATCH 04/13] systemd: Reinstate systemd-hwdb-update.service
Date: Thu, 26 Mar 2020 08:54:17 +0000	[thread overview]
Message-ID: <20200326085426.117209-5-alex.kiernan@gmail.com> (raw)
In-Reply-To: <20200326085426.117209-1-alex.kiernan@gmail.com>

systemd supports a distribution hwdb.bin in /usr/lib/udev/hwdb.bin,
which is used if /etc/udev/hwdb.bin is not present. When generating the
install time hwdb, for systemd, ensure that we put it in /usr/lib/udev,
which then ensures that at boot time we do not regenerate it, unless the
system is marked for update.

This allows fragments dropped into /etc/udev/hwdb.d to be processed
correctly, but without requiring a first boot time build:

root@qemumips:~# systemctl status systemd-hwdb-update.service
* systemd-hwdb-update.service - Rebuild Hardware Database
     Loaded: loaded (/usr/lib/systemd/system/systemd-hwdb-update.service; static; vendor preset: disabled)
     Active: inactive (dead)
  Condition: start condition failed at Wed 2020-03-04 15:18:11 UTC; 44s ago
             |- ConditionPathExists=|!/usr/lib/udev/hwdb.bin was not met
             |- ConditionPathExists=|/etc/udev/hwdb.bin was not met
             `- ConditionDirectoryNotEmpty=|/etc/udev/hwdb.d was not met
       Docs: man:hwdb(7)
             man:systemd-hwdb(8)

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Otavio Salvador <otavio@ossystems.com.br>
---

Changes in v2: None

 meta/recipes-core/systemd/systemd_244.3.bb   | 10 ++++------
 scripts/postinst-intercepts/update_udev_hwdb | 16 ++++++++++++++--
 2 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/meta/recipes-core/systemd/systemd_244.3.bb b/meta/recipes-core/systemd/systemd_244.3.bb
index 214eee316b63..4ee20f85c21f 100644
--- a/meta/recipes-core/systemd/systemd_244.3.bb
+++ b/meta/recipes-core/systemd/systemd_244.3.bb
@@ -293,10 +293,6 @@ do_install() {
 	# 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
-
-    # We use package postinsts for the hwdb update, as the update service is
-    # easily triggered for no reason and will slow down boots.
-    find ${D} -name systemd-hwdb-update.service -delete
 }
 
 python populate_packages_prepend (){
@@ -636,7 +632,9 @@ FILES_udev += "${base_sbindir}/udevd \
                ${datadir}/bash-completion/completions/udevadm \
               "
 
-FILES_udev-hwdb = "${rootlibexecdir}/udev/hwdb.d"
+FILES_udev-hwdb = "${rootlibexecdir}/udev/hwdb.d \
+                   ${systemd_unitdir}/system/systemd-hwdb-update.service \
+                   "
 
 RCONFLICTS_${PN} = "tiny-init ${@bb.utils.contains('PACKAGECONFIG', 'resolved', 'resolvconf', '', d)}"
 
@@ -696,7 +694,7 @@ pkg_prerm_${PN}_libc-glibc () {
 PACKAGE_WRITE_DEPS += "qemu-native"
 pkg_postinst_udev-hwdb () {
 	if test -n "$D"; then
-		$INTERCEPT_DIR/postinst_intercept update_udev_hwdb ${PKG} mlprefix=${MLPREFIX} binprefix=${MLPREFIX}
+		$INTERCEPT_DIR/postinst_intercept update_udev_hwdb ${PKG} mlprefix=${MLPREFIX} binprefix=${MLPREFIX} rootlibexecdir="${rootlibexecdir}" PREFERRED_PROVIDER_udev="${PREFERRED_PROVIDER_udev}"
 	else
 		udevadm hwdb --update
 	fi
diff --git a/scripts/postinst-intercepts/update_udev_hwdb b/scripts/postinst-intercepts/update_udev_hwdb
index c4fb2bffcbf0..102e99b94725 100644
--- a/scripts/postinst-intercepts/update_udev_hwdb
+++ b/scripts/postinst-intercepts/update_udev_hwdb
@@ -5,5 +5,17 @@
 
 set -e
 
-PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D $D${libexecdir}/${binprefix}udevadm hwdb --update --root $D
-chown root:root $D${sysconfdir}/udev/hwdb.bin
+case "${PREFERRED_PROVIDER_udev}" in
+	systemd)
+		UDEV_EXTRA_ARGS="--usr"
+		UDEVLIBDIR="${rootlibexecdir}"
+		;;
+
+	*)
+		UDEV_EXTRA_ARGS=""
+		UDEVLIBDIR="${sysconfdir}"
+		;;
+esac
+
+PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D $D${libexecdir}/${binprefix}udevadm hwdb --update --root $D ${UDEV_EXTRA_ARGS}
+chown root:root $D${UDEVLIBDIR}/udev/hwdb.bin
-- 
2.17.1


  parent reply	other threads:[~2020-03-26  8:54 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-26  8:54 [OE-Core][RFC PATCH 00/13] Systemd 245 and related updates Alex Kiernan
2020-03-26  8:54 ` [OE-Core][RFC PATCH 01/13] systemd: Use PACKAGE_BEFORE_PN, not =+ Alex Kiernan
2020-03-26  8:54 ` [OE-Core][RFC PATCH 02/13] systemd: Package udev rules explicitly Alex Kiernan
2020-03-26  8:54 ` [OE-Core][RFC PATCH 03/13] systemd: Replace nonarch_base_libdir with rootlibexecdir Alex Kiernan
2020-03-26  8:54 ` Alex Kiernan [this message]
2020-03-26  8:54 ` [OE-Core][RFC PATCH 05/13] systemd: Add sch-fq-codel to RRECOMMENDS Alex Kiernan
2020-03-26  8:54 ` [OE-Core][RFC PATCH 06/13] systemd: Add PACKAGECONFIG for sysvinit Alex Kiernan
2020-03-26 14:56   ` Adrian Bunk
2020-03-26 15:54     ` Alex Kiernan
2020-03-26 17:32       ` Adrian Bunk
2020-03-26 18:08         ` Alex Kiernan
2020-03-26 19:13           ` Adrian Bunk
2020-03-26 19:21             ` Otavio Salvador
2020-03-26 18:17         ` Andre McCurdy
2020-03-26 18:32           ` Otavio Salvador
2020-03-26 19:12             ` Adrian Bunk
2020-03-26  8:54 ` [OE-Core][RFC PATCH 07/13] systemd: Remove X11 related files when disabled Alex Kiernan
2020-03-26  8:54 ` [OE-Core][RFC PATCH 08/13] systemd: Enable smack based on DISTRO_FEATURES Alex Kiernan
2020-03-26  8:54 ` [OE-Core][RFC PATCH 09/13] systemd: Enable audit " Alex Kiernan
2020-03-26  8:54 ` [OE-Core][RFC PATCH 10/13] systemd: Enable acl " Alex Kiernan
2020-03-26  8:54 ` [OE-Core][RFC PATCH 11/13] psplash: Set RemainAfterExit on systemd units Alex Kiernan
2020-03-26  8:54 ` [OE-Core][RFC PATCH 12/13] oeqa/runtime/cases: Disable and stop systemd-timesyncd Alex Kiernan
2020-03-26  8:54 ` [OE-Core][RFC PATCH 13/13] systemd: upgrade v244.3 -> v245.2 Alex Kiernan
2020-03-26 12:27 ` [OE-Core][RFC PATCH 00/13] Systemd 245 and related updates Otavio Salvador

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200326085426.117209-5-alex.kiernan@gmail.com \
    --to=alex.kiernan@gmail.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.