Yannick Cote 1fb0ce
kpatch: do not rm selinux rpm owned directory
Yannick Cote 1fb0ce
Yannick Cote 1fb0ce
As part of the kpatch rpm package installation, the /var/lib/kpatch directory
Yannick Cote 1fb0ce
gets created and is set to be selinux owned by the kpatch rpm package.
Yannick Cote 1fb0ce
Yannick Cote 1fb0ce
There is a problem where uninstalling the last kpatch-patch will also remove
Yannick Cote 1fb0ce
this directory. When another kpatch-patch installation occurs, the
Yannick Cote 1fb0ce
/var/lib/kpatch get recreated but withtout the selinux context which triggers a
Yannick Cote 1fb0ce
policy error.
Yannick Cote 1fb0ce
Yannick Cote 1fb0ce
Since /var/lib/kpatch is now created by the rpm spec file, do not remove it
Yannick Cote 1fb0ce
from the uinstall target of the kpatch script. This insures selinux context
Yannick Cote 1fb0ce
consistency.
Yannick Cote 1fb0ce
Yannick Cote 1fb0ce
RHEL-only.
Yannick Cote 1fb0ce
Yannick Cote 1fb0ce
Signed-off-by: Yannick Cote <ycote@redhat.com>
Yannick Cote 1fb0ce
diff -Nupr kpatch-0.9.4.old/kpatch/kpatch kpatch-0.9.4/kpatch/kpatch
Yannick Cote 1fb0ce
--- kpatch-0.9.4.old/kpatch/kpatch	2021-08-26 15:31:07.000000000 -0400
Yannick Cote 1fb0ce
+++ kpatch-0.9.4/kpatch/kpatch	2022-06-10 12:19:55.791538218 -0400
Yannick Cote 1fb0ce
@@ -584,7 +584,6 @@ case "$1" in
Yannick Cote 1fb0ce
 	echo "uninstalling $PATCH ($KVER)"
Yannick Cote 1fb0ce
 	rm -f "$MODULE" || die "failed to uninstall module $PATCH"
Yannick Cote 1fb0ce
 	rmdir --ignore-fail-on-non-empty "$INSTALLDIR/$KVER" || die "failed to remove directory $INSTALLDIR/$KVER"
Yannick Cote 1fb0ce
-	rmdir --ignore-fail-on-non-empty "$INSTALLDIR" || die "failed to remove directory $INSTALLDIR"
Yannick Cote 1fb0ce
 
Yannick Cote 1fb0ce
 	;;
Yannick Cote 1fb0ce