Compare commits

..

2 Commits

2 changed files with 62 additions and 1 deletions

9
.gitignore vendored
View File

@@ -1,6 +1,13 @@
# Build artifacts
# Build artifacts and generated files
build/
images/
# Boot file artifacts (but keep boot.ipxe configuration)
http/*
!http/boot.ipxe
tftp/
# Generated metadata
*.img
filesystem.squashfs
version.txt

54
Makefile Normal file
View File

@@ -0,0 +1,54 @@
.PHONY: build deploy clean help
NAS_HOST=phoenix
NAS_PATH=/srv/netboot
SCRIPT_DIR=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
help:
@echo "Netboot image build and deployment"
@echo ""
@echo "Targets:"
@echo " make build - Build the netboot image (kernel, initramfs, squashfs)"
@echo " make deploy - Sync built artifacts to NAS ($(NAS_HOST))"
@echo " make all - Build and deploy in one step"
@echo " make check-nas - Verify NAS is reachable"
@echo " make clean - Remove build artifacts"
@echo ""
@echo "Configuration:"
@echo " NAS_HOST=$(NAS_HOST)"
@echo " NAS_PATH=$(NAS_PATH)"
@echo ""
check-nas:
@echo "Checking NAS connectivity..."
@ping -c 1 $(NAS_HOST) > /dev/null 2>&1 && echo "✓ NAS is reachable" || (echo "✗ Cannot reach $(NAS_HOST)"; exit 1)
build:
@echo "Building netboot image..."
@echo "This will take 15-30 minutes..."
sudo $(SCRIPT_DIR)/build-image.sh
@echo ""
@echo "Build complete!"
@echo "Artifacts ready in $(SCRIPT_DIR)/http/"
@du -sh $(SCRIPT_DIR)/http/*
deploy: check-nas
@echo "Deploying to NAS ($(NAS_HOST):$(NAS_PATH))..."
@echo "Syncing http/ directory..."
rsync -avz --delete $(SCRIPT_DIR)/http/ $(NAS_HOST):$(NAS_PATH)/http/
@echo ""
@echo "✓ Deployment complete!"
@echo "Images are now live on $(NAS_HOST)"
@ssh $(NAS_HOST) "ls -lh $(NAS_PATH)/http/ | grep -E '(vmlinuz|initrd|squashfs)'"
all: build deploy
@echo ""
@echo "✓ Build and deployment complete!"
clean:
@echo "Removing build artifacts..."
sudo rm -rf $(SCRIPT_DIR)/build/rootfs
sudo rm -rf $(SCRIPT_DIR)/images
@echo "✓ Cleaned!"
.DEFAULT_GOAL := help