235 lines
No EOL
7.6 KiB
Makefile
235 lines
No EOL
7.6 KiB
Makefile
# Debian Atomic Terminal Installer - Justfile
|
|
# Commands for building and testing the terminal-based installer
|
|
|
|
# Default target
|
|
default:
|
|
@just --list
|
|
|
|
# Build the container image
|
|
build:
|
|
#!/usr/bin/env bash
|
|
echo "Building Debian Atomic Terminal Installer container..."
|
|
|
|
# Set up apt-cacher-ng proxy if available
|
|
if [ -n "$APT_CACHER_NG_PROXY" ]; then
|
|
echo "Using apt-cacher-ng proxy: $APT_CACHER_NG_PROXY"
|
|
fi
|
|
|
|
# Build the container
|
|
podman build \
|
|
--build-arg APT_CACHER_NG_PROXY="$APT_CACHER_NG_PROXY" \
|
|
-t debian-atomic-tui-installer:latest \
|
|
.
|
|
|
|
echo "✅ Container built successfully!"
|
|
|
|
# Create bootable ISO
|
|
create-iso:
|
|
#!/usr/bin/env bash
|
|
echo "Creating bootable ISO for terminal installer..."
|
|
|
|
# Create build directory
|
|
mkdir -p build
|
|
|
|
# Extract container filesystem
|
|
echo "Extracting container filesystem..."
|
|
podman create --name temp-tui-extractor debian-atomic-tui-installer:latest
|
|
podman export temp-tui-extractor | tar -x -C build/
|
|
podman rm temp-tui-extractor
|
|
|
|
# Create ISO structure
|
|
echo "Creating ISO structure..."
|
|
mkdir -p build/iso/{boot/grub,isolinux}
|
|
|
|
# Copy kernel and initrd
|
|
if [ -f build/boot/vmlinuz-* ]; then
|
|
cp build/boot/vmlinuz-* build/iso/boot/vmlinuz
|
|
else
|
|
echo "Warning: No kernel found, creating placeholder"
|
|
echo "placeholder kernel" > build/iso/boot/vmlinuz
|
|
fi
|
|
|
|
if [ -f build/boot/initrd.img-* ]; then
|
|
cp build/boot/initrd.img-* build/iso/boot/initrd.img
|
|
else
|
|
echo "Warning: No initrd found, creating placeholder"
|
|
echo "placeholder initrd" > build/iso/boot/initrd.img
|
|
fi
|
|
|
|
# Create isolinux configuration
|
|
echo "DEFAULT linux" > build/iso/isolinux/isolinux.cfg
|
|
echo "TIMEOUT 30" >> build/iso/isolinux/isolinux.cfg
|
|
echo "PROMPT 1" >> build/iso/isolinux/isolinux.cfg
|
|
echo "" >> build/iso/isolinux/isolinux.cfg
|
|
echo "LABEL linux" >> build/iso/isolinux/isolinux.cfg
|
|
echo " KERNEL /boot/vmlinuz" >> build/iso/isolinux/isolinux.cfg
|
|
echo " APPEND initrd=/boot/initrd.img root=/dev/sda1 ro console=ttyS0 console=tty0" >> build/iso/isolinux/isolinux.cfg
|
|
echo "" >> build/iso/isolinux/isolinux.cfg
|
|
echo "LABEL linux-debug" >> build/iso/isolinux/isolinux.cfg
|
|
echo " KERNEL /boot/vmlinuz" >> build/iso/isolinux/isolinux.cfg
|
|
echo " APPEND initrd=/boot/initrd.img root=/dev/sda1 ro console=ttyS0 console=tty0 debug" >> build/iso/isolinux/isolinux.cfg
|
|
|
|
# Create GRUB configuration
|
|
echo "set timeout=5" > build/iso/boot/grub/grub.cfg
|
|
echo "set default=0" >> build/iso/boot/grub/grub.cfg
|
|
echo "" >> build/iso/boot/grub/grub.cfg
|
|
echo 'menuentry "Debian Atomic Terminal Installer" {' >> build/iso/boot/grub/grub.cfg
|
|
echo " linux /boot/vmlinuz root=/dev/sda1 ro console=ttyS0 console=tty0" >> build/iso/boot/grub/grub.cfg
|
|
echo " initrd /boot/initrd.img" >> build/iso/boot/grub/grub.cfg
|
|
echo "}" >> build/iso/boot/grub/grub.cfg
|
|
echo "" >> build/iso/boot/grub/grub.cfg
|
|
echo 'menuentry "Debian Atomic Terminal Installer (Debug)" {' >> build/iso/boot/grub/grub.cfg
|
|
echo " linux /boot/vmlinuz root=/dev/sda1 ro console=ttyS0 console=tty0 debug" >> build/iso/boot/grub/grub.cfg
|
|
echo " initrd /boot/initrd.img" >> build/iso/boot/grub/grub.cfg
|
|
echo "}" >> build/iso/boot/grub/grub.cfg
|
|
|
|
# Use container to create ISO (no host packages needed)
|
|
echo "Creating ISO image using container..."
|
|
podman run --rm \
|
|
-v "$(pwd)/build/iso:/iso:Z" \
|
|
-v "$(pwd)/build:/output:Z" \
|
|
debian:bookworm-slim \
|
|
bash -c "
|
|
apt-get update && apt-get install -y xorriso &&
|
|
xorriso -as mkisofs -o /output/debian-atomic-tui-installer.iso \
|
|
-b boot/vmlinuz \
|
|
-c boot/boot.cat \
|
|
-no-emul-boot \
|
|
-boot-load-size 4 \
|
|
-boot-info-table \
|
|
-r \
|
|
-J \
|
|
-joliet-long \
|
|
-V \"DEBIAN_ATOMIC_TUI\" \
|
|
/iso/
|
|
"
|
|
|
|
echo "✅ ISO created: build/debian-atomic-tui-installer.iso"
|
|
|
|
# Test the ISO in QEMU
|
|
test-iso:
|
|
#!/usr/bin/env bash
|
|
echo "Testing ISO in QEMU..."
|
|
|
|
if [ ! -f build/debian-atomic-tui-installer.iso ]; then
|
|
echo "❌ ISO not found. Run 'just create-iso' first."
|
|
exit 1
|
|
fi
|
|
|
|
# Test ISO bootability
|
|
qemu-system-x86_64 \
|
|
-m 2G \
|
|
-smp 2 \
|
|
-boot d \
|
|
-cdrom build/debian-atomic-tui-installer.iso \
|
|
-display gtk \
|
|
-enable-kvm
|
|
|
|
echo "✅ ISO test completed"
|
|
|
|
# Create a simple test VM
|
|
create-test-vm:
|
|
#!/usr/bin/env bash
|
|
echo "Creating test VM..."
|
|
|
|
# Create VM disk
|
|
qemu-img create -f qcow2 build/test-vm.qcow2 10G
|
|
|
|
# Start VM with ISO
|
|
qemu-system-x86_64 \
|
|
-m 2G \
|
|
-smp 2 \
|
|
-boot d \
|
|
-cdrom build/debian-atomic-tui-installer.iso \
|
|
-hda build/test-vm.qcow2 \
|
|
-display gtk \
|
|
-enable-kvm \
|
|
-name "Debian Atomic TUI Installer Test"
|
|
|
|
echo "✅ Test VM created"
|
|
|
|
# Clean build artifacts
|
|
clean:
|
|
#!/usr/bin/env bash
|
|
echo "Cleaning build artifacts..."
|
|
|
|
# Remove build directory
|
|
rm -rf build/
|
|
|
|
# Remove container images
|
|
podman rmi debian-atomic-tui-installer:latest 2>/dev/null || true
|
|
|
|
echo "✅ Cleanup completed"
|
|
|
|
# Show build status
|
|
status:
|
|
#!/usr/bin/env bash
|
|
echo "Build Status:"
|
|
echo "============="
|
|
|
|
if podman image exists debian-atomic-tui-installer:latest; then
|
|
echo "✅ Container image: debian-atomic-tui-installer:latest"
|
|
else
|
|
echo "❌ Container image: Not built"
|
|
fi
|
|
|
|
if [ -f build/debian-atomic-tui-installer.iso ]; then
|
|
echo "✅ ISO: build/debian-atomic-tui-installer.iso"
|
|
ls -lh build/debian-atomic-tui-installer.iso
|
|
else
|
|
echo "❌ ISO: Not created"
|
|
fi
|
|
|
|
if [ -f build/test-vm.qcow2 ]; then
|
|
echo "✅ Test VM: build/test-vm.qcow2"
|
|
ls -lh build/test-vm.qcow2
|
|
else
|
|
echo "❌ Test VM: Not created"
|
|
fi
|
|
|
|
# Run container for testing
|
|
run-container:
|
|
#!/usr/bin/env bash
|
|
echo "Running container for testing..."
|
|
|
|
podman run --rm -it \
|
|
--name debian-atomic-tui-test \
|
|
debian-atomic-tui-installer:latest
|
|
|
|
echo "✅ Container test completed"
|
|
|
|
# Extract filesystem for analysis
|
|
extract-fs:
|
|
#!/usr/bin/env bash
|
|
echo "Extracting container filesystem..."
|
|
|
|
mkdir -p build/fs-extract
|
|
|
|
podman create --name temp-fs-extractor debian-atomic-tui-installer:latest
|
|
podman export temp-fs-extractor | tar -x -C build/fs-extract/
|
|
podman rm temp-fs-extractor
|
|
|
|
echo "✅ Filesystem extracted to build/fs-extract/"
|
|
|
|
# Show help
|
|
help:
|
|
@echo "Debian Atomic Terminal Installer - Available Commands"
|
|
@echo "=================================================="
|
|
@echo ""
|
|
@echo "Build Commands:"
|
|
@echo " build - Build the container image"
|
|
@echo " create-iso - Create bootable ISO"
|
|
@echo " extract-fs - Extract container filesystem for analysis"
|
|
@echo ""
|
|
@echo "Test Commands:"
|
|
@echo " test-iso - Test ISO in QEMU"
|
|
@echo " create-test-vm - Create and run test VM"
|
|
@echo " run-container - Run container for testing"
|
|
@echo ""
|
|
@echo "Utility Commands:"
|
|
@echo " status - Show build status"
|
|
@echo " clean - Clean build artifacts"
|
|
@echo " help - Show this help"
|
|
@echo ""
|
|
@echo "Environment Variables:"
|
|
@echo " APT_CACHER_NG_PROXY - Proxy for apt-cacher-ng (optional)"
|