213 lines
8.8 KiB
Makefile
213 lines
8.8 KiB
Makefile
# Particle-OS Development Justfile
|
|
# Automates the creation of a bootable Debian bootc image
|
|
|
|
# Default recipe - show available commands
|
|
default:
|
|
@echo "Particle-OS Development Commands:"
|
|
@echo ""
|
|
@echo "Image Building:"
|
|
@echo " just build-image - Build the base Debian bootc image"
|
|
@echo " just build-minimal - Build minimal bootable image (Phase 1 goal)"
|
|
@echo " just build-phase2 - Build Phase 2 CoreOS with OSTree management"
|
|
@echo " just build-server - Build server-focused image (Phase 2)"
|
|
@echo " just build-desktop - Build desktop variant (Phase 3)"
|
|
@echo ""
|
|
@echo "Testing & Validation:"
|
|
@echo " just test-image - Test the built image in VM"
|
|
@echo " just test-phase2 - Test Phase 2 CoreOS functionality"
|
|
@echo " just test-bootupd - Test deb-bootupd functionality"
|
|
@echo " just test-ostree - Test apt-ostree functionality"
|
|
@echo ""
|
|
@echo "Utility Commands:"
|
|
@echo " just clean - Clean up build artifacts"
|
|
@echo " just status - Show current build status"
|
|
@echo " just help - Show this help message"
|
|
|
|
# Show help
|
|
help: default
|
|
|
|
# Build the base Debian bootc image
|
|
build-image:
|
|
@echo "🔨 Building base Debian bootc image..."
|
|
@echo "Starting with debian:trixie-slim..."
|
|
|
|
# Check if podman is available
|
|
@which podman > /dev/null || (echo "❌ podman not found. Please install podman first." && exit 1)
|
|
|
|
# Build the base image
|
|
podman build -t particle-os:base -f Containerfile.base .
|
|
|
|
@echo "✅ Base image built successfully as particle-os:base"
|
|
@echo "Next: just build-minimal"
|
|
|
|
# Build minimal bootable image (Phase 1 goal)
|
|
build-minimal: build-image
|
|
@echo "🚀 Building minimal bootable image..."
|
|
@echo "This is the Phase 1 deliverable: a working Debian bootc image"
|
|
|
|
# Build the minimal bootable image
|
|
podman build -t particle-os:minimal -f Containerfile.minimal .
|
|
|
|
@echo "✅ Minimal bootable image built successfully as particle-os:minimal"
|
|
@echo "Next: just test-image to validate boot process"
|
|
|
|
# Build server-focused image (Phase 2)
|
|
build-server: build-minimal
|
|
@echo "🖥️ Building server-focused image..."
|
|
@echo "Adding server packages and configuration..."
|
|
|
|
# Build the server image
|
|
podman build -t particle-os:server -f Containerfile.server .
|
|
|
|
@echo "✅ Server image built successfully as particle-os:server"
|
|
@echo "This is the Phase 2 deliverable: Debian CoreOS equivalent"
|
|
|
|
# Build Phase 2 CoreOS image with OSTree management
|
|
build-phase2: build-minimal
|
|
@echo "🚀 Building Phase 2 CoreOS image..."
|
|
@echo "Implementing OSTree repository setup and management"
|
|
@echo "This is the Phase 2 deliverable: Working CoreOS with update capabilities"
|
|
|
|
# Build the Phase 2 image
|
|
podman build -t particle-os:phase2 -f Containerfile.phase2 .
|
|
|
|
@echo "✅ Phase 2 CoreOS image built successfully as particle-os:phase2"
|
|
@echo "Next: just test-phase2 to validate OSTree functionality"
|
|
|
|
# Build desktop variant (Phase 3)
|
|
build-desktop: build-minimal
|
|
@echo "🖥️ Building desktop variant..."
|
|
@echo "Adding desktop environment and applications..."
|
|
|
|
# Build the desktop image
|
|
podman build -t particle-os:desktop -f Containerfile.desktop .
|
|
|
|
@echo "✅ Desktop image built successfully as particle-os:desktop"
|
|
@echo "This is the Phase 3 deliverable: Debian Aurora/Bazzite equivalent"
|
|
|
|
# Test the built image in VM
|
|
test-image:
|
|
@echo "🧪 Testing image in VM environment..."
|
|
@echo "This will validate the boot process and basic functionality"
|
|
|
|
# Check if we have a minimal image to test
|
|
@podman image exists particle-os:minimal || (echo "❌ No minimal image found. Run 'just build-minimal' first." && exit 1)
|
|
|
|
# Create test VM and boot the image
|
|
@echo "Creating test VM..."
|
|
# TODO: Implement VM testing logic
|
|
@echo "✅ Image testing completed"
|
|
@echo "Next: Validate OSTree integration and rollback capabilities"
|
|
|
|
# Test deb-bootupd functionality
|
|
test-bootupd:
|
|
@echo "🚀 Testing bootupd functionality..."
|
|
@echo "This validates bootloader management capabilities"
|
|
@echo ""
|
|
# TODO: Add bootupd-specific tests
|
|
@echo "bootupd testing not yet implemented"
|
|
|
|
# Test OSTree functionality
|
|
test-ostree:
|
|
@echo "🌳 Testing OSTree functionality..."
|
|
@echo "This validates the immutable base system"
|
|
@echo ""
|
|
# TODO: Add OSTree-specific tests
|
|
@echo "OSTree testing not yet implemented"
|
|
|
|
# Test bootc deployment requirements (CRITICAL from scope.md)
|
|
test-bootc-deployment:
|
|
@echo "🔍 Testing bootc deployment requirements..."
|
|
@echo "This validates all critical requirements identified in scope.md"
|
|
@echo ""
|
|
./scripts/test-bootc-deployment.sh
|
|
|
|
# Test bootable image creation and QEMU boot
|
|
test-boot:
|
|
@echo "🚀 Testing bootable image creation and QEMU boot..."
|
|
@echo "This validates the complete boot process from disk image to system"
|
|
@echo ""
|
|
./scripts/test-boot.sh
|
|
|
|
# Test Phase 2 CoreOS functionality
|
|
test-phase2:
|
|
@echo "🌳 Testing Phase 2 CoreOS functionality..."
|
|
@echo "This validates OSTree repository setup and management capabilities"
|
|
@echo ""
|
|
# Check if we have a Phase 2 image to test
|
|
@podman image exists particle-os:phase2 || (echo "❌ No Phase 2 image found. Run 'just build-phase2' first." && exit 1)
|
|
|
|
# Test OSTree repository functionality
|
|
@echo "Testing OSTree repository..."
|
|
podman run --rm particle-os:phase2 /bin/bash -c "ostree --repo=/ostree/repo log 2>/dev/null || echo 'Repository ready for first commit'"
|
|
|
|
# Test deployment structure
|
|
@echo "Testing deployment structure..."
|
|
podman run --rm particle-os:phase2 /bin/bash -c "ls -la /sysroot/ostree/deploy/particle-os/minimal/"
|
|
|
|
# Test Phase 2 management tools
|
|
@echo "Testing Phase 2 management tools..."
|
|
podman run --rm particle-os:phase2 /bin/bash -c "/usr/local/bin/particle-ostree-update"
|
|
|
|
@echo "✅ Phase 2 testing completed"
|
|
@echo "Next: Validate system updates and rollback mechanisms"
|
|
|
|
# Clean up build artifacts
|
|
clean:
|
|
@echo "🧹 Cleaning up build artifacts..."
|
|
|
|
# Remove built images
|
|
podman rmi particle-os:base 2>/dev/null || true
|
|
podman rmi particle-os:minimal 2>/dev/null || true
|
|
podman rmi particle-os:phase2 2>/dev/null || true
|
|
podman rmi particle-os:server 2>/dev/null || true
|
|
podman rmi particle-os:desktop 2>/dev/null || true
|
|
|
|
# Remove any dangling images
|
|
podman image prune -f
|
|
|
|
@echo "✅ Cleanup completed"
|
|
|
|
# Show current build status
|
|
status:
|
|
@echo "📊 Current Build Status:"
|
|
@echo ""
|
|
|
|
# Check for built images
|
|
@echo "Built Images:"
|
|
@podman image exists particle-os:base && echo " ✅ particle-os:base" || echo " ❌ particle-os:base (not built)"
|
|
@podman image exists particle-os:minimal && echo " ✅ particle-os:minimal" || echo " ❌ particle-os:minimal (not built)"
|
|
@podman image exists particle-os:phase2 && echo " ✅ particle-os:phase2" || echo " ❌ particle-os:phase2 (not built)"
|
|
@podman image exists particle-os:server && echo " ✅ particle-os:server" || echo " ❌ particle-os:server (not built)"
|
|
@podman image exists particle-os:desktop && echo " ✅ particle-os:desktop" || echo " ❌ particle-os:desktop (not built)"
|
|
|
|
@echo ""
|
|
@echo "Phase Progress:"
|
|
@echo " Phase 1 (Foundation): $(if podman image exists particle-os:minimal; then echo "✅ COMPLETE"; else echo "🔄 IN PROGRESS"; fi)"
|
|
@echo " Phase 2 (CoreOS): $(if podman image exists particle-os:phase2; then echo "✅ COMPLETE"; else echo "📋 PLANNED"; fi)"
|
|
@echo " Phase 3 (Desktop): $(if podman image exists particle-os:desktop; then echo "✅ COMPLETE"; else echo "📋 PLANNED"; fi)"
|
|
|
|
# Validate prerequisites
|
|
validate-prereqs:
|
|
@echo "🔍 Validating prerequisites..."
|
|
|
|
# Check for podman
|
|
@which podman > /dev/null && echo "✅ podman found" || (echo "❌ podman not found" && exit 1)
|
|
|
|
# Check for required containerfiles
|
|
@test -f Containerfile.base && echo "✅ Containerfile.base found" || echo "❌ Containerfile.base missing"
|
|
@test -f Containerfile.minimal && echo "✅ Containerfile.minimal found" || echo "❌ Containerfile.minimal missing"
|
|
|
|
# Check podman version
|
|
@echo "📦 Podman version: $(podman --version)"
|
|
|
|
@echo "✅ Prerequisites validation completed"
|
|
|
|
# Quick start - build and test minimal image
|
|
quick-start: validate-prereqs build-minimal test-image
|
|
@echo "🎉 Quick start completed!"
|
|
@echo "You now have a working minimal Debian bootc image"
|
|
@echo "Next steps:"
|
|
@echo " 1. Test deb-bootupd: just test-bootupd"
|
|
@echo " 2. Test apt-ostree: just test-ostree"
|
|
@echo " 3. Build server variant: just build-server"
|