dracut/0590-00systemd-check-if-systemd-version-is-a-number.patch
Daniel Molkentin d3ae36b2fe Accepting request 671820 from home:dmolkentin:branches:Base:System
- Fix displaying text on emergency consoles (boo#1124088)
  - adds 0589-Fix-displaying-text-on-emergency-consoles.patch
- Fix systemd version check, will be required for systemd v241
  - 0590-00systemd-check-if-systemd-version-is-a-number.patch

OBS-URL: https://build.opensuse.org/request/show/671820
OBS-URL: https://build.opensuse.org/package/show/Base:System/dracut?expand=0&rev=363
2019-02-05 10:40:45 +00:00

38 lines
1.5 KiB
Diff

From 53cb081b4c3afa843022d8e6156bdbd4808db4a2 Mon Sep 17 00:00:00 2001
From: Frantisek Sumsal <frantisek@sumsal.cz>
Date: Fri, 4 Jan 2019 16:51:15 +0100
Subject: [PATCH] 00systemd: check if systemd version is a number
The recent systemd upstream introduced a slightly modified version
string which included information about a git commit, which however
broke the version check in dracut. Unfortunately, the (( )) bash syntax
went along with it in certain cases and introduced a pretty nasty issue,
when the systemd would boot up but with slightly changed environment.
To prevent this from happening in the future, let's at least check if
the version parsed from the `systemd --version` output is a comparable
number.
---
modules.d/00systemd/module-setup.sh | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/modules.d/00systemd/module-setup.sh b/modules.d/00systemd/module-setup.sh
index 1ed4b34f..3583062b 100755
--- a/modules.d/00systemd/module-setup.sh
+++ b/modules.d/00systemd/module-setup.sh
@@ -5,6 +5,11 @@ check() {
[[ $mount_needs ]] && return 1
if require_binaries $systemdutildir/systemd; then
SYSTEMD_VERSION=$($systemdutildir/systemd --version | { read a b a; echo $b; })
+ # Check if the systemd version is a valid number
+ if ! [[ $SYSTEMD_VERSION =~ ^[0-9]+$ ]]; then
+ dfatal "systemd version is not a number ($SYSTEMD_VERSION)"
+ exit 1
+ fi
(( $SYSTEMD_VERSION >= 198 )) && return 0
return 255
fi
--
2.16.4