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