Michel Alexandre Salim 7b5855
From c8daa0d621bcf7a1fa82698b2556a274b29f6c13 Mon Sep 17 00:00:00 2001
Michel Alexandre Salim 7b5855
From: Michel Alexandre Salim <michel@michel-slm.name>
Michel Alexandre Salim 7b5855
Date: Wed, 9 Jun 2021 14:07:20 -0700
Michel Alexandre Salim 7b5855
Subject: [PATCH] Handle non-integer udev version strings
Michel Alexandre Salim 7b5855
Michel Alexandre Salim 7b5855
CentOS 8's systemd reports this for `udevadm --version`:
Michel Alexandre Salim 7b5855
Michel Alexandre Salim 7b5855
```
Michel Alexandre Salim 7b5855
[vagrant@localhost ~]$ udevadm --version
Michel Alexandre Salim 7b5855
239 (239-44.el8)
Michel Alexandre Salim 7b5855
[vagrant@localhost ~]$ udevadm --version | awk '{print $1;}'
Michel Alexandre Salim 7b5855
239
Michel Alexandre Salim 7b5855
[vagrant@localhost ~]$ udevadm --version | sed -e 's/\s.*$//'
Michel Alexandre Salim 7b5855
239
Michel Alexandre Salim 7b5855
```
Michel Alexandre Salim 7b5855
Michel Alexandre Salim 7b5855
Using sed rather than awk to get the first token out, since it is
Michel Alexandre Salim 7b5855
already declared as a dependency in the dracut spec.
Michel Alexandre Salim 7b5855
Michel Alexandre Salim 7b5855
This works fine on fully integral versions, e.g. on Fedora 33
Michel Alexandre Salim 7b5855
```
Michel Alexandre Salim 7b5855
$ udevadm --version | sed -e 's/\s.*$//'
Michel Alexandre Salim 7b5855
246
Michel Alexandre Salim 7b5855
```
Michel Alexandre Salim 7b5855
Michel Alexandre Salim 7b5855
Signed-off-by: Michel Alexandre Salim <salimma@centosproject.org>
Michel Alexandre Salim 7b5855
---
Michel Alexandre Salim 7b5855
 dracut-init.sh | 2 +-
Michel Alexandre Salim 7b5855
 1 file changed, 1 insertion(+), 1 deletion(-)
Michel Alexandre Salim 7b5855
Michel Alexandre Salim 7b5855
diff --git a/dracut-init.sh b/dracut-init.sh
Michel Alexandre Salim 7b5855
index b6e3714a..5be62d50 100644
Michel Alexandre Salim 7b5855
--- a/dracut-init.sh
Michel Alexandre Salim 7b5855
+++ b/dracut-init.sh
Michel Alexandre Salim 7b5855
@@ -508,7 +508,7 @@ inst_rules_wildcard() {
Michel Alexandre Salim 7b5855
 
Michel Alexandre Salim 7b5855
 prepare_udev_rules() {
Michel Alexandre Salim 7b5855
     if [ -z "$UDEVVERSION" ]; then
Michel Alexandre Salim 7b5855
-        UDEVVERSION=$(udevadm --version)
Michel Alexandre Salim 7b5855
+        UDEVVERSION=$(udevadm --version | sed -e 's/\s.*$//')
Michel Alexandre Salim 7b5855
         export UDEVVERSION
Michel Alexandre Salim 7b5855
     fi
Michel Alexandre Salim 7b5855
 
Michel Alexandre Salim 7b5855
-- 
Michel Alexandre Salim 7b5855
2.31.1
Michel Alexandre Salim 7b5855