Fix make clean target to safely unmount stray filesystems before deletion
This commit is contained in:
10
Makefile
10
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!"
|
||||
|
||||
Reference in New Issue
Block a user