Blame 2237-kmoddir-fix-trailing-forwardslash-handling.patch

61fb1e
From 6fb0f4b4d54eeb1b1e89c06cc54bdcab504138da Mon Sep 17 00:00:00 2001
61fb1e
From: Pavel Valena <pvalena@redhat.com>
61fb1e
Date: Fri, 24 Feb 2023 19:19:59 +0100
61fb1e
Subject: [PATCH] fix(dracut.sh): kmoddir does not handle trailing /
61fb1e
61fb1e
Fixes https://github.com/dracutdevs/dracut/issues/2236
61fb1e
61fb1e
+(/) only works in bash interactive mode. Using any non-interactive
61fb1e
bash run simply doesn't remove anything.
61fb1e
61fb1e
The solution is copied from dracut-lib.sh, trim().
61fb1e
---
61fb1e
 dracut.sh | 2 +-
61fb1e
 1 file changed, 1 insertion(+), 1 deletion(-)
61fb1e
61fb1e
diff --git a/dracut.sh b/dracut.sh
61fb1e
index 1aa3f8e1f..0c0f85c2d 100755
61fb1e
--- a/dracut.sh
61fb1e
+++ b/dracut.sh
61fb1e
@@ -1033,7 +1033,7 @@ stdloglvl=$((stdloglvl + verbosity_mod_l))
61fb1e
 ((stdloglvl < 0)) && stdloglvl=0
61fb1e
 
61fb1e
 [[ $drivers_dir_l ]] && drivers_dir=$drivers_dir_l
61fb1e
-drivers_dir="${drivers_dir%%+(/)}"
61fb1e
+drivers_dir="${drivers_dir%"${drivers_dir##*[!/]}"}"
61fb1e
 [[ $do_strip_l ]] && do_strip=$do_strip_l
61fb1e
 [[ $do_strip ]] || do_strip=yes
61fb1e
 [[ $aggressive_strip_l ]] && aggressive_strip=$aggressive_strip_l