# Miasma OS Installer - Testing Guide

## Testing in a Minimal Arch VM

### Setup Test Environment

1. **Create Arch VM with minimal install:**
   - Boot Arch ISO
   - Choose "Install Arch Linux"
   - When prompted for profile, select "minimal" (no desktop)
   - Complete basic installation
   - Reboot into minimal Arch system

2. **Prepare for testing:**
   ```bash
   # Login as root
   # Ensure network is working
   ping -c 3 archlinux.org
   
   # Install git and go (for building)
   pacman -Sy git go base-devel
   
   # Clone the installer
   git clone https://git.miasma-os.com/miasma/miasma-installer.git
   cd miasma-installer
   
   # Build the installer
   make build
   ```

3. **Run the installer:**
   ```bash
   # Must be run as root
   sudo ./build/miasma-installer
   ```

### What Should Happen

1. **During Installation:**
   - Installer detects available disks
   - Partitions selected disk (GPT with EFI + root)
   - Formats with btrfs (with subvolumes)
   - Optional LUKS2 encryption
   - Installs base system + linux-hardened
   - Installs Cosmic Desktop packages
   - Configures bootloader (systemd-boot)
   - Sets up user account with sudo

2. **After Installation:**
   - Installer exits cleanly
   - Unmount filesystems: `umount -R /mnt`
   - Reboot: `reboot`
   - System boots into Cosmic Desktop login
   - Login with created user credentials

### For archiso Integration

The installer will be included as a custom package in the archiso build:
- ISO boots directly to root shell
- Installer auto-starts or user runs `miasma-installer`
- After installation completes, user reboots
- System boots into installed Miasma OS with Cosmic Desktop

### Troubleshooting

If installation fails:
- Check `/mnt` is empty before starting
- Ensure UEFI mode: `ls /sys/firmware/efi`
- Check disk permissions: `lsblk`
- View detailed errors in the TUI
- Manually unmount if needed: `umount -R /mnt`
