Blob Blame History Raw
From 58134fd4490ebe57840762afef5d095a9a4a9771 Mon Sep 17 00:00:00 2001
From: Seth Jennings <sjenning@redhat.com>
Date: Wed, 27 Aug 2014 14:30:39 -0500
Subject: [PATCH 3/5] Support modprobe format names in uninstall
To: rhkernel-list@redhat.com

Signed-off-by: Seth Jennings <sjenning@redhat.com>
---
 kpatch/kpatch | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/kpatch/kpatch b/kpatch/kpatch
index 1d33641..1a1b1ac 100755
--- a/kpatch/kpatch
+++ b/kpatch/kpatch
@@ -264,10 +264,24 @@ case "$1" in
 		shift
 	done
 
-	[[ ! -e $INSTALLDIR/$KVER/"$PATCH" ]] && die "$PATCH is not installed for kernel $KVER"
+	MODULE=$INSTALLDIR/$KVER/"$PATCH"
+	if [[ ! -f "$MODULE" ]]; then
+		mod_name "$PATCH"
+		PATCHNAME=$MODNAME
+		for i in $INSTALLDIR/$KVER/*; do
+			mod_name "$i"
+			if [[ $MODNAME == $PATCHNAME ]]; then
+				MODULE="$i"
+				break
+			fi
+		done
+	fi
+
+	[[ ! -e $MODULE ]] && die "$PATCH is not installed for kernel $KVER"
+	
 
 	echo "uninstalling $PATCH ($KVER)"
-	rm -f $INSTALLDIR/$KVER/"$PATCH" || die "failed to uninstall module $PATCH"
+	rm -f $MODULE || die "failed to uninstall module $PATCH"
 	if lsinitrd -k $KVER &> /dev/null; then
 		echo "rebuilding $KVER initramfs"
 		dracut -f --kver $KVER || die "dracut failed"
-- 
1.9.3