Fix make clean target to safely unmount stray filesystems before deletion

This commit is contained in:
2026-01-30 23:27:57 +01:00
parent aea6e58f43
commit 18f0f637bd

View File

@@ -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!"