From 47c1bd435a498e736a6fd3f41655c05279560bb1 Mon Sep 17 00:00:00 2001 From: Artem Savkov Date: Thu, 25 Feb 2021 13:24:30 +0100 Subject: [PATCH] kpatch: cleanup install directory On module installation kpatch utility creates a directory with kernel version as a name in /var/lib/kpatch which is never removed. To address this check if any files are left in this directory after each 'uninstall' call and if not - remove it. Signed-off-by: Artem Savkov --- kpatch/kpatch | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kpatch/kpatch b/kpatch/kpatch index ccb6914..8c34ed4 100755 --- a/kpatch/kpatch +++ b/kpatch/kpatch @@ -575,10 +575,12 @@ case "$1" in fi [[ ! -e "$MODULE" ]] && die "$PATCH is not installed for kernel $KVER" - echo "uninstalling $PATCH ($KVER)" rm -f "$MODULE" || die "failed to uninstall module $PATCH" + rmdir --ignore-fail-on-non-empty "$INSTALLDIR/$KVER" || die "failed to remove directory $INSTALLDIR/$KVER" + rmdir --ignore-fail-on-non-empty "$INSTALLDIR" || die "failed to remove directory $INSTALLDIR" + ;; "list") -- 2.26.2