From 80f59e0d1ea8ac73a6ecabf8cccc3906f252face Mon Sep 17 00:00:00 2001 From: Eric Ace Date: Wed, 12 Jul 2023 07:11:32 -0400 Subject: [PATCH 1/2] Uninstall handle cases when directories are mounts and cannot be removed --- bundle/bin/rke2-uninstall.sh | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/bundle/bin/rke2-uninstall.sh b/bundle/bin/rke2-uninstall.sh index 284ca543e7..89f8ebd1a8 100755 --- a/bundle/bin/rke2-uninstall.sh +++ b/bundle/bin/rke2-uninstall.sh @@ -91,14 +91,9 @@ uninstall_remove_files() $transactional_update rm -f "${INSTALL_RKE2_ROOT}/bin/rke2" $transactional_update rm -f "${INSTALL_RKE2_ROOT}/bin/rke2-killall.sh" $transactional_update rm -rf "${INSTALL_RKE2_ROOT}/share/rke2" - rm -rf /etc/rancher/rke2 - rm -rf /etc/rancher/node - rm -d /etc/rancher || true - rm -rf /etc/cni - rm -rf /opt/cni/bin - rm -rf /var/lib/kubelet - rm -rf /var/lib/rancher/rke2 - rm -d /var/lib/rancher || true + for dir in /etc/rancher /etc/cni /opt/cni/bin /var/lib/kubelet /var/lib/rancher; do + rm -rf "$dir" || true + done if type fapolicyd >/dev/null 2>&1; then if [ -f /etc/fapolicyd/rules.d/80-rke2.rules ]; then From bbaa44df370c8007a1b2f8445c6502b182810f7b Mon Sep 17 00:00:00 2001 From: Eric Ace Date: Fri, 14 Jul 2023 06:28:10 -0400 Subject: [PATCH 2/2] Least change to handle var/lib/kubelet as a mount --- bundle/bin/rke2-uninstall.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/bundle/bin/rke2-uninstall.sh b/bundle/bin/rke2-uninstall.sh index 89f8ebd1a8..cc63a54929 100755 --- a/bundle/bin/rke2-uninstall.sh +++ b/bundle/bin/rke2-uninstall.sh @@ -91,9 +91,14 @@ uninstall_remove_files() $transactional_update rm -f "${INSTALL_RKE2_ROOT}/bin/rke2" $transactional_update rm -f "${INSTALL_RKE2_ROOT}/bin/rke2-killall.sh" $transactional_update rm -rf "${INSTALL_RKE2_ROOT}/share/rke2" - for dir in /etc/rancher /etc/cni /opt/cni/bin /var/lib/kubelet /var/lib/rancher; do - rm -rf "$dir" || true - done + rm -rf /etc/rancher/rke2 + rm -rf /etc/rancher/node + rm -d /etc/rancher || true + rm -rf /etc/cni + rm -rf /opt/cni/bin + rm -rf /var/lib/kubelet || true + rm -rf /var/lib/rancher/rke2 + rm -d /var/lib/rancher || true if type fapolicyd >/dev/null 2>&1; then if [ -f /etc/fapolicyd/rules.d/80-rke2.rules ]; then