[PATCH] Use shell code to work around missing basename

Jesse Keating jkeating at redhat.com
Tue Aug 14 22:58:16 UTC 2012


Basename got removed from dracut land.  This was our only use of it so
use shell built ins to accomplish the same thing.  Sadly you cannot
strip both prefix and suffix at the same time, so take a two step
approach.
---
 dracut/anaconda-modprobe.sh | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/dracut/anaconda-modprobe.sh b/dracut/anaconda-modprobe.sh
index 20f173f..a14d27a 100644
--- a/dracut/anaconda-modprobe.sh
+++ b/dracut/anaconda-modprobe.sh
@@ -7,7 +7,10 @@ MODULE_LIST="cramfs squashfs iscsi_tcp "
 
 SCSI_MODULES=/lib/modules/$KERNEL/kernel/drivers/scsi/device_handler/
 for m in $SCSI_MODULES/*.ko; do
-    MODULE_LIST+=" `basename $m .ko` "
+    # Shell spew to work around not having basename
+    # Trim the paths off the prefix, then the . suffix
+    a="${m##*/}"
+    MODULE_LIST+=" ${a%*.}"
 done
 
 if [ "$ARCH" != "s390" -a "$ARCH" != "s390x" ]; then
-- 
1.7.11.2



More information about the anaconda-patches mailing list