Blame 0073-dracut-functions.sh-for-module-handling-strip-all-.k.patch

Harald Hoyer b94732
From bea41b898a93e4437640817964861bbb694b01e6 Mon Sep 17 00:00:00 2001
Harald Hoyer b94732
From: Harald Hoyer <harald@redhat.com>
Harald Hoyer b94732
Date: Wed, 17 Dec 2014 11:22:46 +0100
Harald Hoyer b94732
Subject: [PATCH] dracut-functions.sh: for module handling, strip all ".ko*"
Harald Hoyer b94732
Harald Hoyer b94732
Just strip anything after ".ko" including ".ko", otherwise compressed
Harald Hoyer b94732
modules are not stripped, if they end on e.g. ".ko.gz"
Harald Hoyer b94732
---
Harald Hoyer b94732
 dracut-functions.sh | 16 ++++++++--------
Harald Hoyer b94732
 1 file changed, 8 insertions(+), 8 deletions(-)
Harald Hoyer b94732
Harald Hoyer b94732
diff --git a/dracut-functions.sh b/dracut-functions.sh
Harald Hoyer b94732
index b91d8dc..410960d 100755
Harald Hoyer b94732
--- a/dracut-functions.sh
Harald Hoyer b94732
+++ b/dracut-functions.sh
Harald Hoyer b94732
@@ -1461,7 +1461,7 @@ install_kmod_with_fw() {
Harald Hoyer b94732
 
Harald Hoyer b94732
     if [[ $omit_drivers ]]; then
Harald Hoyer b94732
         local _kmod=${1##*/}
Harald Hoyer b94732
-        _kmod=${_kmod%.ko}
Harald Hoyer b94732
+        _kmod=${_kmod%.ko*}
Harald Hoyer b94732
         _kmod=${_kmod/-/_}
Harald Hoyer b94732
         if [[ "$_kmod" =~ $omit_drivers ]]; then
Harald Hoyer b94732
             dinfo "Omitting driver $_kmod"
Harald Hoyer b94732
@@ -1475,7 +1475,7 @@ install_kmod_with_fw() {
Harald Hoyer b94732
 
Harald Hoyer b94732
     if [[ $silent_omit_drivers ]]; then
Harald Hoyer b94732
         local _kmod=${1##*/}
Harald Hoyer b94732
-        _kmod=${_kmod%.ko}
Harald Hoyer b94732
+        _kmod=${_kmod%.ko*}
Harald Hoyer b94732
         _kmod=${_kmod/-/_}
Harald Hoyer b94732
         [[ "$_kmod" =~ $silent_omit_drivers ]] && return 0
Harald Hoyer b94732
         [[ "${1##*/lib/modules/$kernel/}" =~ $silent_omit_drivers ]] && return 0
Harald Hoyer b94732
@@ -1599,7 +1599,7 @@ module_is_host_only() {
Harald Hoyer b94732
     local _mod=$1
Harald Hoyer b94732
     local _modenc a i _k _s _v _aliases
Harald Hoyer b94732
     _mod=${_mod##*/}
Harald Hoyer b94732
-    _mod=${_mod%.ko}
Harald Hoyer b94732
+    _mod=${_mod%.ko*}
Harald Hoyer b94732
     _modenc=${_mod//-/_}
Harald Hoyer b94732
 
Harald Hoyer b94732
     [[ " $add_drivers " == *\ ${_mod}\ * ]] && return 0
Harald Hoyer b94732
@@ -1691,16 +1691,16 @@ instmods() {
Harald Hoyer b94732
                 _mod=${_mod##*/}
Harald Hoyer b94732
                 # Check for aliased modules
Harald Hoyer b94732
                 _modalias=$(modinfo -k $kernel -F filename $_mod 2> /dev/null)
Harald Hoyer b94732
-                _modalias=${_modalias%.ko}
Harald Hoyer b94732
-                if [ "${_modalias##*/}" != "$_mod" ] ; then
Harald Hoyer b94732
+                _modalias=${_modalias%.ko*}
Harald Hoyer b94732
+                if [[ $_modalias ]] && [ "${_modalias##*/}" != "${_mod%.ko*}" ] ; then
Harald Hoyer b94732
                     _mod=${_modalias##*/}
Harald Hoyer b94732
                 fi
Harald Hoyer b94732
 
Harald Hoyer b94732
                 # if we are already installed, skip this module and go on
Harald Hoyer b94732
                 # to the next one.
Harald Hoyer b94732
                 if [[ $DRACUT_KERNEL_LAZY_HASHDIR ]] && \
Harald Hoyer b94732
-                    [[ -f "$DRACUT_KERNEL_LAZY_HASHDIR/${_mod%.ko}.ko" ]]; then
Harald Hoyer b94732
-                    read _ret <"$DRACUT_KERNEL_LAZY_HASHDIR/${_mod%.ko}.ko"
Harald Hoyer b94732
+                    [[ -f "$DRACUT_KERNEL_LAZY_HASHDIR/${_mod%.ko*}" ]]; then
Harald Hoyer b94732
+                    read _ret <"$DRACUT_KERNEL_LAZY_HASHDIR/${_mod%.ko*}"
Harald Hoyer b94732
                     return $_ret
Harald Hoyer b94732
                 fi
Harald Hoyer b94732
 
Harald Hoyer b94732
@@ -1730,7 +1730,7 @@ instmods() {
Harald Hoyer b94732
                     ((_ret+=$?))
Harald Hoyer b94732
                 else
Harald Hoyer b94732
                     [[ $DRACUT_KERNEL_LAZY_HASHDIR ]] && \
Harald Hoyer b94732
-                        echo $_mod >> "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist"
Harald Hoyer b94732
+                        echo ${_mod%.ko*} >> "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist"
Harald Hoyer b94732
                 fi
Harald Hoyer b94732
                 ;;
Harald Hoyer b94732
         esac