systemd: avoid failing if no udev rules provided

Submitted by Peter Bergin on Sept. 15, 2020, 7:33 p.m. | Patch ID: 176544


Message ID
State Accepted
Commit c65eb4c38b61509ad38da19b986e0f06923f0cea
Headers show

Commit Message

Peter Bergin Sept. 15, 2020, 7:33 p.m.
In the case when no udev rules are provided by the recipe the do_install
step of systemd is failing with:

    install: cannot stat '<WORKDIR>/*.rules': No such file or directory

By default the systemd recipe provides touchscreen.rules but in the
case this is unwanted on target the install step fails. This solution
is dynamic and search for *.rules files in $WORKDIR. If found they are

Signed-off-by: Peter Bergin <>
 meta/recipes-core/systemd/ | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/meta/recipes-core/systemd/ b/meta/recipes-core/systemd/
index 238cd4741f..af10e4212b 100644
--- a/meta/recipes-core/systemd/
+++ b/meta/recipes-core/systemd/
@@ -232,7 +232,9 @@  do_install() {
 	install -d ${D}${sysconfdir}/udev/rules.d/
 	install -d ${D}${sysconfdir}/tmpfiles.d
-	install -m 0644 ${WORKDIR}/*.rules ${D}${sysconfdir}/udev/rules.d/
+	for rule in $(find ${WORKDIR} -maxdepth 1 -type f -name "*.rules"); do
+		install -m 0644 $rule ${D}${sysconfdir}/udev/rules.d/
+	done
 	install -m 0644 ${WORKDIR}/00-create-volatile.conf ${D}${sysconfdir}/tmpfiles.d/