#!/bin/sh
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Undoes the node-level state postinst wrote, on a real removal only. The
# service-disable half of that undo runs in prerm instead, for the reason
# given there.
#
# fstab's swap comment and containerd's store under /var/lib/containerd are
# left alone: reverting the fstab edit would turn swap back on under a kubelet
# that may still be running, and the image store is not something this
# package's file list ever claimed to own.
set -e

case "$1" in
remove)
  systemctl daemon-reload 2>/dev/null || true
  rm -f /etc/sysctl.d/k8s.conf /etc/modules-load.d/k8s.conf
  ;;
upgrade | failed-upgrade | abort-install | abort-upgrade | disappear | purge) ;;
*) ;;
esac

exit 0
