uninstall.sh: clean up unmounted regular-file placeholders even after service stop

This commit is contained in:
Eric Hartford
2026-12-02 20:10:50 +00:00
parent b1720e6727
commit 25d6f6f05e

View File

@ -22,10 +22,13 @@ if [ "$UNLOAD" = "1" ]; then
# bind mounts the service did not own (e.g. from install.sh's own --bind)
for f in /dev/nvidia[0-9]* /dev/nvidiactl /dev/nvidia-uvm /dev/nvidia-modeset; do
if mountpoint -q "$f" 2>/dev/null; then
if sudo umount "$f" 2>/dev/null; then
# Remove regular-file placeholders created by bind_dev_nodes.sh; preserve real char devices.
if [ -f "$f" ] && [ ! -c "$f" ]; then sudo rm -f -- "$f"; fi
fi
sudo umount "$f" 2>/dev/null || true
fi
# Remove regular-file placeholders created by bind_dev_nodes.sh (including
# those already unmounted by nvdriver-devnodes.service); preserve real char
# devices, symlinks, and anything still mounted.
if ! mountpoint -q "$f" 2>/dev/null && [ -f "$f" ] && [ ! -c "$f" ] && [ ! -L "$f" ]; then
sudo rm -f -- "$f"
fi
done
for m in nvidia_rs_drm nvidia_rs_modeset nvidia_rs_peermem nvidia_rs_modeset_bridge nvidia_rs_uvm_bridge nvidia_rs; do