Blame SOURCES/0532-base-dracut-lib.sh-remove-bashism.patch

18971c
From 9dfcc5f0660b0d7cc7ca251dff940c4f2d0ddf95 Mon Sep 17 00:00:00 2001
18971c
From: Alexander Tsoy <alexander@tsoy.me>
18971c
Date: Tue, 24 Feb 2015 22:28:24 +0300
18971c
Subject: [PATCH] base/dracut-lib.sh: remove bashism
18971c
18971c
Cherry-picked from: 13efce5d
18971c
Resolves: #1306640
18971c
---
18971c
 modules.d/99base/dracut-lib.sh | 4 +++-
18971c
 1 file changed, 3 insertions(+), 1 deletion(-)
18971c
18971c
diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
18971c
index 46cee5a9..7502ab66 100755
18971c
--- a/modules.d/99base/dracut-lib.sh
18971c
+++ b/modules.d/99base/dracut-lib.sh
18971c
@@ -888,7 +888,9 @@ dev_unit_name()
18971c
     dev="${dev##/}"
18971c
     dev="$(str_replace "$dev" '\' '\x5c')"
18971c
     dev="$(str_replace "$dev" '-' '\x2d')"
18971c
-    dev=${dev/#\./\\x2e}
18971c
+    if [ "${dev##.}" != "$dev" ]; then
18971c
+        dev="\x2e${dev##.}"
18971c
+    fi
18971c
     dev="$(str_replace "$dev" '/' '-')"
18971c
 
18971c
     printf -- "%s" "$dev"