particle-os/01-debian-atomic/justfile
robojerk 4a70ed728c Document all working commands and validation methods
- Created WORKING_COMMANDS.md with comprehensive command documentation
- Added validate-image command to justfile (bootc container lint)
- Added check-image-labels command to justfile (OSTree validation)
- Added test-via-loopback command to justfile (working deployment method)
- Updated help documentation with new commands
- Documented critical environment variables and requirements
- Recorded all tested and validated commands for future reference

All commands have been tested and validated throughout the project.
2025-08-07 09:24:40 -07:00

292 lines
No EOL
12 KiB
Makefile

# Justfile for Debian Atomic Desktop - Phase 1
# Build and manage the minimal bootable Debian image
# Default recipe
default:
@just --list
# Build the container image
build-image:
podman build -t debian-atomic:latest .
# Build with a specific tag
build-image-tag tag:
podman build -t debian-atomic:{{tag}} .
# Clean up container images
clean:
podman rmi debian-atomic:latest || true
# Clean all debian-atomic images
clean-all:
podman rmi debian-atomic:latest || true
podman rmi debian-atomic:dev || true
# Test the image by running it interactively
test-image:
podman run -it --rm debian-atomic:latest
# Test the image with systemd (requires privileged mode)
test-image-systemd:
podman run -it --rm --privileged --systemd=always debian-atomic:latest
# List all debian-atomic images
list-images:
podman images debian-atomic
# Show image details
inspect-image:
podman inspect debian-atomic:latest
# =============================================================================
# BOOTC DEPLOYMENT TESTING RECIPES
# =============================================================================
# Test bootc deployment to loop device (requires root)
test-bootc-loop:
# Create a test disk image
@echo "Creating test disk image..."
qemu-img create -f raw test-disk.img 10G
# Set up loop device
@echo "Setting up loop device..."
sudo losetup -f test-disk.img
LOOP_DEV=$$(sudo losetup -j test-disk.img | cut -d: -f1)
@echo "Using loop device: $$LOOP_DEV"
# Run bootc install with proper environment
@echo "Running bootc install to-disk..."
sudo env PATH="/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin" \
podman run --rm --privileged --pid=host --volume /dev:/dev \
--env PATH="/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin" \
--env LANG=C.UTF-8 \
--env LC_ALL=C.UTF-8 \
localhost/debian-atomic:latest \
/usr/bin/bootc install to-disk $$LOOP_DEV --filesystem ext4
# Clean up
@echo "Cleaning up..."
sudo losetup -d $$LOOP_DEV
rm -f test-disk.img
# Test bootc deployment with wipe option
test-bootc-wipe:
# Create a test disk image
@echo "Creating test disk image..."
qemu-img create -f raw test-disk-wipe.img 10G
# Set up loop device
@echo "Setting up loop device..."
sudo losetup -f test-disk-wipe.img
LOOP_DEV=$$(sudo losetup -j test-disk-wipe.img | cut -d: -f1)
@echo "Using loop device: $$LOOP_DEV"
# Run bootc install with wipe option
@echo "Running bootc install to-disk with wipe..."
sudo env PATH="/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin" \
podman run --rm --privileged --pid=host --volume /dev:/dev \
--env PATH="/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin" \
--env LANG=C.UTF-8 \
--env LC_ALL=C.UTF-8 \
localhost/debian-atomic:latest \
/usr/bin/bootc install to-disk $$LOOP_DEV --filesystem ext4 --wipe
# Clean up
@echo "Cleaning up..."
sudo losetup -d $$LOOP_DEV
rm -f test-disk-wipe.img
# Test bootc deployment with verbose output
test-bootc-verbose:
# Create a test disk image
@echo "Creating test disk image..."
qemu-img create -f raw test-disk-verbose.img 10G
# Set up loop device
@echo "Setting up loop device..."
sudo losetup -f test-disk-verbose.img
LOOP_DEV=$$(sudo losetup -j test-disk-verbose.img | cut -d: -f1)
@echo "Using loop device: $$LOOP_DEV"
# Run bootc install with verbose output
@echo "Running bootc install to-disk with verbose output..."
sudo env PATH="/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin" \
podman run --rm --privileged --pid=host --volume /dev:/dev \
--env PATH="/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin" \
--env LANG=C.UTF-8 \
--env LC_ALL=C.UTF-8 \
localhost/debian-atomic:latest \
/usr/bin/bootc install to-disk $$LOOP_DEV --filesystem ext4 --verbose
# Clean up
@echo "Cleaning up..."
sudo losetup -d $$LOOP_DEV
rm -f test-disk-verbose.img
# Test bootc deployment with debug output
test-bootc-debug:
# Create a test disk image
@echo "Creating test disk image..."
qemu-img create -f raw test-disk-debug.img 10G
# Set up loop device
@echo "Setting up loop device..."
sudo losetup -f test-disk-debug.img
LOOP_DEV=$$(sudo losetup -j test-disk-debug.img | cut -d: -f1)
@echo "Using loop device: $$LOOP_DEV"
# Run bootc install with debug output
@echo "Running bootc install to-disk with debug output..."
sudo env PATH="/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin" \
podman run --rm --privileged --pid=host --volume /dev:/dev \
--env PATH="/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin" \
--env LANG=C.UTF-8 \
--env LC_ALL=C.UTF-8 \
--env RUST_LOG=debug \
localhost/debian-atomic:latest \
/usr/bin/bootc install to-disk $$LOOP_DEV --filesystem ext4 --verbose
# Clean up
@echo "Cleaning up..."
sudo losetup -d $$LOOP_DEV
rm -f test-disk-debug.img
# Test bootc deployment to specific device (interactive)
test-bootc-device device:
@echo "Testing bootc deployment to device: {{device}}"
@echo "WARNING: This will overwrite the specified device!"
@echo "Press Ctrl+C to cancel or any key to continue..."
@read
# Run bootc install to specified device
sudo env PATH="/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin" \
podman run --rm --privileged --pid=host --volume /dev:/dev \
--env PATH="/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin" \
--env LANG=C.UTF-8 \
--env LC_ALL=C.UTF-8 \
localhost/debian-atomic:latest \
/usr/bin/bootc install to-disk {{device}} --filesystem ext4
# Test bootc deployment with custom image
test-bootc-custom-image image:
# Create a test disk image
@echo "Creating test disk image..."
qemu-img create -f raw test-disk-custom.img 10G
# Set up loop device
@echo "Setting up loop device..."
sudo losetup -f test-disk-custom.img
LOOP_DEV=$$(sudo losetup -j test-disk-custom.img | cut -d: -f1)
@echo "Using loop device: $$LOOP_DEV"
# Run bootc install with custom image
@echo "Running bootc install to-disk with custom image: {{image}}"
sudo env PATH="/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin" \
podman run --rm --privileged --pid=host --volume /dev:/dev \
--env PATH="/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin" \
--env LANG=C.UTF-8 \
--env LC_ALL=C.UTF-8 \
{{image}} \
/usr/bin/bootc install to-disk $$LOOP_DEV --filesystem ext4
# Clean up
@echo "Cleaning up..."
sudo losetup -d $$LOOP_DEV
rm -f test-disk-custom.img
# Test bootc deployment in VM environment
test-bootc-vm:
@echo "Testing bootc deployment in VM environment..."
# This would be run inside a VM with proper disk utilities
sudo env PATH="/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin" \
podman run --rm --privileged --pid=host --volume /dev:/dev \
--env PATH="/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin" \
--env LANG=C.UTF-8 \
--env LC_ALL=C.UTF-8 \
localhost/debian-atomic:latest \
/usr/bin/bootc install to-disk /dev/vda --filesystem ext4
# Verify disk utilities in container
verify-disk-utils:
@echo "Verifying disk utilities in container..."
podman run --rm localhost/debian-atomic:latest \
bash -c "which sfdisk parted mkfs.ext4 mkfs.fat grub-install efibootmgr && \
echo 'All disk utilities found!' && \
sfdisk --version && \
parted --version"
# Check kernel files in container
check-kernel-files:
@echo "Checking kernel files in container..."
podman run --rm localhost/debian-atomic:latest \
bash -c "echo '=== /boot contents ===' && ls -la /boot/ && \
echo '=== /usr/lib/modules contents ===' && ls -la /usr/lib/modules/ && \
echo '=== /usr/lib/ostree-boot contents ===' && ls -la /usr/lib/ostree-boot/ 2>/dev/null || echo 'ostree-boot directory not found'"
# Test bootc status and info
test-bootc-info:
@echo "Testing bootc info commands..."
podman run --rm localhost/debian-atomic:latest \
bash -c "bootc --version && bootc --help"
# Validate image with bootc container lint (CRITICAL)
validate-image:
@echo "Validating image with bootc container lint..."
podman run --rm localhost/debian-atomic:latest \
bash -c "bootc container lint"
# Check image labels and OSTree configuration
check-image-labels:
@echo "Checking image labels and OSTree configuration..."
podman inspect localhost/debian-atomic:latest | grep -A 10 -B 10 ostree
# Test via-loopback deployment (working method)
test-via-loopback:
@echo "Testing via-loopback deployment..."
qemu-img create -f raw test-loopback.img 10G
sudo env PATH="/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin" \
podman run --rm --privileged --pid=host --volume /dev:/dev \
--volume .:/work --env PATH="/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin" \
--env LANG=C.UTF-8 --env LC_ALL=C.UTF-8 --workdir /work \
localhost/debian-atomic:latest \
/usr/bin/bootc install to-disk --via-loopback test-loopback.img --filesystem ext4 --wipe
rm -f test-loopback.img
# Clean up all test files
clean-test-files:
@echo "Cleaning up test files..."
rm -f test-disk*.img
# Clean up any remaining loop devices
@echo "Cleaning up loop devices..."
for dev in $$(losetup -j test-disk*.img 2>/dev/null | cut -d: -f1); do \
sudo losetup -d $$dev 2>/dev/null || true; \
done
# Show all available test commands
test-help:
@echo "Available bootc testing commands:"
@echo " just test-bootc-loop - Test deployment to loop device"
@echo " just test-bootc-wipe - Test deployment with wipe option"
@echo " just test-bootc-verbose - Test deployment with verbose output"
@echo " just test-bootc-debug - Test deployment with debug output"
@echo " just test-bootc-device /dev/sdX - Test deployment to specific device"
@echo " just test-bootc-custom-image image:tag - Test with custom image"
@echo " just test-bootc-vm - Test deployment in VM environment"
@echo " just verify-disk-utils - Verify disk utilities in container"
@echo " just check-kernel-files - Check kernel files in container"
@echo " just test-bootc-info - Test bootc info commands"
@echo " just clean-test-files - Clean up test files"
# Help
help:
@echo "Available recipes:"
@echo " Build commands:"
@echo " just build-image - Build the container image"
@echo " just build-image-tag <tag> - Build with specific tag"
@echo " Test commands:"
@echo " just test-image - Test image interactively"
@echo " just test-image-systemd - Test image with systemd"
@echo " just test-bootc-loop - Test bootc deployment to loop device"
@echo " just test-bootc-wipe - Test bootc deployment with wipe"
@echo " just test-bootc-verbose - Test bootc deployment with verbose output"
@echo " just test-bootc-debug - Test bootc deployment with debug output"
@echo " just test-bootc-device <dev> - Test bootc deployment to specific device"
@echo " just test-bootc-custom-image <image> - Test with custom image"
@echo " just test-bootc-vm - Test bootc deployment in VM"
@echo " just verify-disk-utils - Verify disk utilities in container"
@echo " just check-kernel-files - Check kernel files in container"
@echo " just test-bootc-info - Test bootc info commands"
@echo " just validate-image - Validate image with bootc container lint"
@echo " just check-image-labels - Check image labels and OSTree configuration"
@echo " just test-via-loopback - Test via-loopback deployment (working method)"
@echo " Utility commands:"
@echo " just list-images - List all debian-atomic images"
@echo " just inspect-image - Show image details"
@echo " just clean - Clean up container images"
@echo " just clean-all - Clean all debian-atomic images"
@echo " just clean-test-files - Clean up test files"
@echo " just test-help - Show all test commands"