particle-os/02-installer-bootc/justfile
2025-08-07 01:04:22 -07:00

227 lines
No EOL
6.2 KiB
Makefile

# justfile for Debian Atomic Desktop Bootc Installer
# This creates a bootc-based installer with Calamares
# Variables
IMAGE_NAME := "debian-atomic-installer"
IMAGE_TAG := "latest"
# Apt-cacher-ng configuration
APT_CACHER_NG_PROXY := "http://192.168.1.101:3142"
# Default recipe
default: build-installer
# Build the installer container image
build-installer:
@echo "Building Debian Atomic Desktop installer..."
cd .. && podman build --build-arg APT_CACHER_NG_PROXY={{APT_CACHER_NG_PROXY}} -t {{IMAGE_NAME}}:{{IMAGE_TAG}} -f 02-installer-bootc/Containerfile .
@echo "Installer image built successfully!"
# Build with a specific tag
build-installer-tag tag:
@echo "Building installer with tag: {{tag}}"
cd .. && podman build --build-arg APT_CACHER_NG_PROXY={{APT_CACHER_NG_PROXY}} -t {{IMAGE_NAME}}:{{tag}} -f 02-installer-bootc/Containerfile .
@echo "Installer image built with tag {{tag}}!"
# Test the installer image interactively
test-installer:
@echo "Testing installer image..."
podman run -it --rm {{IMAGE_NAME}}:{{IMAGE_TAG}} /bin/bash
# Test the installer with systemd (for bootc compatibility)
test-installer-systemd:
@echo "Testing installer with systemd support..."
podman run -it --rm \
--privileged \
--systemd=always \
-v /sys/fs/cgroup:/sys/fs/cgroup:rw \
{{IMAGE_NAME}}:{{IMAGE_TAG}}
# Create a bootable ISO from the installer image
create-iso:
@echo "Creating bootable ISO from installer image..."
@echo "Using bootable ISO creation approach..."
./scripts/create-bootable-iso.sh
# Test the ISO in QEMU
test-iso:
@echo "Testing installer ISO in QEMU..."
qemu-system-x86_64 \
-enable-kvm \
-m 2G \
-cdrom build/debian-atomic-installer.iso \
-serial mon:stdio \
-nographic
# Test the ISO using podman containers
test-iso-podman:
@echo "Testing ISO using podman containers..."
./scripts/test-iso-podman.sh
# Build bootable ISO from installer container
build-iso:
@echo "Building bootable ISO from installer container..."
./test-vm.sh build-iso
# Create VM disk for testing
create-vm-disk:
@echo "Creating VM disk for testing..."
./test-vm.sh create-vm
# Start VM with VNC access
start-vm:
@echo "Starting VM with VNC access..."
./test-vm.sh start-vm
# Full VM test (build ISO, create VM, start VM)
test-vm:
@echo "Running full VM test..."
./test-vm.sh test
# Clean up VM files
clean-vm:
@echo "Cleaning up VM files..."
./test-vm.sh clean
# Container VM testing (simpler approach)
test-container:
@echo "Testing installer in container VM..."
./test-container-vm.sh test
# Start container VM
start-container:
@echo "Starting installer container VM..."
./test-container-vm.sh start
# Setup VNC in container
setup-vnc:
@echo "Setting up VNC in container..."
./test-container-vm.sh setup-vnc
# Show container status
container-status:
@echo "Showing container status..."
./test-container-vm.sh status
# Stop container VM
stop-container:
@echo "Stopping installer container VM..."
./test-container-vm.sh stop
# Access container shell
container-shell:
@echo "Accessing container shell..."
./test-container-vm.sh shell
# Real VM testing with QEMU
create-real-vm-disk:
@echo "Creating VM disk..."
./create-vm.sh create-disk
download-debian-iso:
@echo "Downloading Debian ISO..."
./create-vm.sh download-iso
start-real-vm:
@echo "Starting real VM with VNC..."
./create-vm.sh start-vm
vm-install-instructions:
@echo "Showing VM installation instructions..."
./create-vm.sh install
test-real-vm:
@echo "Testing real VM (create disk, download ISO, start VM)..."
./create-vm.sh test
clean-vm-files:
@echo "Cleaning up VM files..."
./create-vm.sh clean
# Clean up
clean:
@echo "Cleaning up installer images..."
podman rmi {{IMAGE_NAME}}:{{IMAGE_TAG}} 2>/dev/null || true
# Clean all related images (simplified)
clean-all:
@echo "Cleaning all installer images..."
@echo "Use 'podman images' and 'podman rmi' manually for now"
# List all installer images
list-images:
@echo "Installer images:"
podman images {{IMAGE_NAME}}
# Show detailed image information
inspect-image:
@echo "Inspecting installer image..."
podman inspect {{IMAGE_NAME}}:{{IMAGE_TAG}}
# Install custom packages locally (for testing)
install-custom-packages:
@echo "Installing custom bootc and ostree packages locally..."
./scripts/install-custom-packages.sh
# Build with custom packages
build-installer-custom:
@echo "Building installer with custom bootc/ostree packages..."
cd .. && podman build --build-arg APT_CACHER_NG_PROXY={{APT_CACHER_NG_PROXY}} -t {{IMAGE_NAME}}:{{IMAGE_TAG}} -f 02-installer-bootc/Containerfile .
@echo "Installer image built with custom packages!"
# Help
help:
@echo "Available commands:"
@just --list
# Test apt-cacher-ng connectivity
test-apt-cacher:
@echo "Testing apt-cacher-ng connectivity..."
@if timeout 5 bash -c '</dev/tcp/192.168.1.101/3142' 2>/dev/null; then \
echo "✅ apt-cacher-ng is accessible at {{APT_CACHER_NG_PROXY}}"; \
else \
echo "❌ apt-cacher-ng is not accessible at {{APT_CACHER_NG_PROXY}}"; \
echo "You may need to start apt-cacher-ng or check the IP address"; \
fi
# Build without apt-cacher-ng (fallback)
build-installer-no-cache:
@echo "Building installer without apt-cacher-ng..."
cd .. && podman build -t {{IMAGE_NAME}}:{{IMAGE_TAG}} -f 02-installer-bootc/Containerfile .
@echo "Installer image built successfully!"
# Create test VM with KVM and VNC
create-test-vm:
@echo "Creating test VM with KVM and VNC access..."
./scripts/create-test-vm.sh
# Start test VM
start-test-vm:
@echo "Starting test VM..."
virsh start debian-atomic-test
# Stop test VM
stop-test-vm:
@echo "Stopping test VM..."
virsh destroy debian-atomic-test
# Destroy test VM completely
destroy-test-vm:
@echo "Destroying test VM completely..."
virsh destroy debian-atomic-test 2>/dev/null || true
virsh undefine debian-atomic-test 2>/dev/null || true
sudo rm -f /var/lib/libvirt/images/debian-atomic-test.qcow2
# Full test workflow (build installer, create ISO, create VM)
test-full-workflow:
@echo "Running full test workflow..."
@echo "1. Building installer container..."
just build-installer
@echo "2. Creating ISO..."
just create-iso
@echo "3. Creating test VM..."
just create-test-vm
@echo "Full workflow completed!"
# List all recipes
list: help