From 18f0f637bdf2953c8b60b83138c3c662c5c1f551 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torbj=C3=B8rn=20Lindahl?= Date: Fri, 30 Jan 2026 23:27:57 +0100 Subject: [PATCH] Fix make clean target to safely unmount stray filesystems before deletion --- Makefile | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 7caac58..fddd6ef 100644 --- a/Makefile +++ b/Makefile @@ -46,7 +46,15 @@ all: build deploy @echo "✓ Build and deployment complete!" clean: - @echo "Removing build artifacts..." + @echo "Cleaning build artifacts..." + @if [ -d "$(SCRIPT_DIR)/build/rootfs" ]; then \ + echo "Unmounting any stray mounts from $(SCRIPT_DIR)/build/rootfs..."; \ + mount | grep "$(SCRIPT_DIR)/build/rootfs" | awk '{print $$3}' | while read mount; do \ + echo " Unmounting $$mount"; \ + sudo umount -l "$$mount" 2>/dev/null || true; \ + done; \ + fi + @echo "Removing build directories..." sudo rm -rf $(SCRIPT_DIR)/build/rootfs sudo rm -rf $(SCRIPT_DIR)/images @echo "✓ Cleaned!"