Metadata-Version: 2.4
Name: tkl-installer
Version: 0.1.0
Summary: TurnKey Linux CLI OS installer, probably compatible with any Debian-based system
Author-email: TurnKey GNU/Linux maintainers <admin@turnkeylinux.org>
License-Expression: MIT
Project-URL: Homepage, https://github.com/turnkeylinux/tkl-installer
Requires-Python: >=3.13
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: dialog
Dynamic: license-file

# tkl-installer

An opinionated, minimal CLI installer for TurnKey Linux. Designed to run from a
live environment (ISO/USB) and install a pre-built rootfs (squashfs) to a
target disk.

## Features

- Auto-detects UEFI vs legacy BIOS boot mode
- Detects and excludes the live boot device
- Supports guided (ext4), guided-LVM, and manual partition schemes
- Calculates sensible default partition sizes based on disk space
- Installs GRUB (EFI or BIOS) via chroot
- Generates `/etc/fstab` using UUIDs
- Optional post-install chroot commands
- Dry-run mode for testing
- TOML config file support

## Requirements

Debian-based live environment with:
- `lsblk`, `blkid`, `sfdisk`, `wipefs`, `partprobe`
- `mkfs.ext4`, `mkfs.vfat`, `mkswap`
- `unsquashfs` (squashfs-tools)
- `grub-install`, `update-grub`
- `pvcreate`, `vgcreate`, `lvcreate` (for LVM)
- `udevadm`
- Python 3.11+

## Installation

```bash
pip install .
# or run directly:
python -m min_installer
```

## Usage

```
tkl-installer [OPTIONS]

Options:
  -c, --config FILE      TOML config file
  --disk DEVICE          Target disk (e.g. /dev/sda)
  --scheme TYPE          guided | guided-lvm | manual
  --squashfs PATH        Path to rootfs squashfs
  --mount-root PATH      Target mount point (default: /mnt/target)
  -y, --yes              Assume yes to all prompts
  --dry-run              Simulate without writing
  -v, --verbose          Debug logging
```

### Fully interactive

```bash
tkl-installer
```

### From config file

```bash
tkl-installer --config /etc/tkl-installer.toml
```

### Scripted (non-interactive)

```bash
tkl-installer \
  --disk /dev/sda \
  --scheme guided \
  --squashfs /run/live/medium/live/filesystem.squashfs \
  --yes
```

## Partition Scheme Defaults

| Partition | UEFI | BIOS | Notes |
|-----------|------|------|-------|
| EFI       | 512 MiB | — | vfat |
| /boot     | 512 MiB | 512 MiB | ext4 |
| swap      | 512M–4G | 512M–4G | Scaled to disk size |
| /         | Remainder | Remainder | ext4 |

Swap sizing:
- Disk < 16 GiB → 512 MiB swap
- Disk 16–64 GiB → 2 GiB swap
- Disk ≥ 64 GiB → 4 GiB swap

## Config File Reference

See `example-config.toml` for all available options.

## Architecture

```
min_installer/
  __main__.py     Entry point
  cli.py          Argument parsing + install orchestration
  config.py       InstallerConfig dataclass + TOML loader
  live.py         Live environment detection
  disks.py        Block device probing (lsblk, blkid, pvs)
  partitioner.py  Scheme calculation + sfdisk/LVM/mkfs
  installer.py    rootfs unpack, fstab, grub, extra commands
  wizard.py       Interactive prompts
  ui.py           Terminal output helpers
  runner.py       Subprocess execution with dry-run support
```
