# Debian Atomic Desktop - Bootc Installer (Phase 2 Alternative)

This is an alternative approach to Phase 2 that uses **bootc + Calamares** instead of live-build. This approach is more modern and consistent with our atomic architecture.

## Architecture Overview

Instead of using live-build to create a traditional installer ISO, this approach:

1. **Creates a bootc container** that includes Calamares
2. **Calamares handles** partitioning, user setup, and system configuration
3. **Post-install script** uses `bootc install` to deploy the atomic image
4. **bootc creates the ISO** from the container

## Advantages Over Live-Build

- ✅ **Consistent tooling** - Everything uses bootc
- ✅ **No sysvinit conflicts** - Pure systemd environment
- ✅ **Atomic guarantees** - The installer itself is atomic
- ✅ **Simpler maintenance** - One build system instead of two
- ✅ **Modern approach** - Uses container-native tooling

## Quick Start

### Basic Workflow

1. **Build the installer:**
   ```bash
   just build-installer
   ```

2. **Test the installer:**
   ```bash
   just test-installer-systemd
   ```

3. **Create ISO (when ready):**
   ```bash
   just create-iso
   ```

### Full Test Workflow

For complete testing with KVM and VNC:

```bash
# Run the complete workflow
just test-full-workflow
```

This will:
1. Build the installer container
2. Create the ISO (when bootc ISO creation is implemented)
3. Create a test VM with KVM and VNC access

### Manual VM Testing

If you prefer to control each step:

```bash
# Build the installer
just build-installer

# Create test VM (requires KVM and libvirt)
just create-test-vm

# Start/stop the VM
just start-test-vm
just stop-test-vm

# Clean up
just destroy-test-vm
```

## How It Works

### 1. Container Build
The `Containerfile` creates a bootc container with:
- Calamares installer
- bootc for atomic deployment
- Systemd services
- Partitioning tools

### 2. Calamares Configuration
- `settings.conf` - Main Calamares configuration
- Handles partitioning, user setup, etc.
- Calls our post-install script

### 3. Post-Install Script
- `post-install.sh` - Uses bootc to deploy atomic image
- Gets target device from Calamares
- Runs `bootc install to-disk`

### 4. ISO Creation
- bootc creates bootable ISO from container
- ISO boots into Calamares installer
- Installer deploys atomic image

## File Structure

```
02-installer-bootc/
├── Containerfile          # Bootc container definition
├── justfile              # Build automation
├── README.md             # This file
├── calamares-config/     # Calamares configuration
│   └── settings.conf     # Main Calamares settings
└── scripts/              # Installation scripts
    └── post-install.sh   # Bootc deployment script
```

## Comparison with Live-Build Approach

| Aspect | Live-Build | Bootc + Calamares |
|--------|------------|-------------------|
| Build System | live-build | bootc |
| Dependencies | Complex package conflicts | Clean container |
| Maintenance | Two build systems | One build system |
| Atomic Guarantees | Limited | Full atomic |
| Modern Tooling | Traditional | Container-native |

## Next Steps

1. **Test the basic container** - Verify Calamares works
2. **Configure Calamares** - Add proper partitioning and user modules
3. **Test bootc deployment** - Verify atomic image installation
4. **Create ISO** - Use bootc to generate bootable ISO
5. **Integration testing** - Test full installation flow

## Prerequisites

- `podman` or `docker`
- `just`
- `bootc`
- `qemu` (for testing)

### For VM Testing

- `qemu-kvm`
- `libvirt-daemon-system`
- `libvirt-clients`
- `virt-install`
- User in `libvirt` group
- `virt-manager` (optional, for GUI management)

This approach should eliminate the sysvinit conflicts we encountered with live-build and provide a cleaner, more modern installer experience. 