171 lines
5.1 KiB
Markdown
171 lines
5.1 KiB
Markdown
# Archiso — Custom Live Installer
|
|
|
|
The archiso build system produces a bootable Arch Linux ISO pre-loaded with the M-Archy installer scripts. Optionally, an answerfile can be embedded so the entire install — base OS + dotfiles — runs with zero user interaction.
|
|
|
|
---
|
|
|
|
## Prerequisites
|
|
|
|
```bash
|
|
sudo pacman -S archiso jq
|
|
```
|
|
|
|
---
|
|
|
|
## Building the ISO
|
|
|
|
```bash
|
|
# Basic build — interactive installer, no answerfile
|
|
bash setup/archiso/build.sh
|
|
|
|
# Specify output directory
|
|
bash setup/archiso/build.sh /path/to/output
|
|
|
|
# Embed an answerfile for automated deployment
|
|
bash setup/archiso/build.sh --preconf
|
|
|
|
# Embed a specific answerfile
|
|
bash setup/archiso/build.sh --preconf ~/my-server.json
|
|
|
|
# Both flags together
|
|
bash setup/archiso/build.sh --preconf ~/my-server.json /media/usb/output
|
|
```
|
|
|
|
| Flag | Effect |
|
|
|------|--------|
|
|
| _(none)_ | Clean ISO, no answerfile |
|
|
| `--preconf` | Embed `~/answerfile.json` at `/answerfile.json` in the ISO |
|
|
| `--preconf FILE` | Embed the specified file instead |
|
|
|
|
Build artefacts land in `~/m-archy-out/` by default. Override with the `OUT_DIR` environment variable or by passing a path argument.
|
|
|
|
### Environment Variables
|
|
|
|
| Variable | Default | Purpose |
|
|
|----------|---------|---------|
|
|
| `WORK_DIR` | `~/m-archy-build` | Scratch space for mkarchiso |
|
|
| `OUT_DIR` | `~/m-archy-out` | ISO output directory |
|
|
|
|
---
|
|
|
|
## What the Build Does
|
|
|
|
1. Copies the upstream `releng` Arch base profile
|
|
2. Applies the M-Archy overlay (`setup/archiso/overlay/`)
|
|
3. Replaces `profiledef.sh` with the M-Archy version
|
|
4. Adds extra packages from `packages.extra`
|
|
5. Embeds both installer scripts (`arch-autoinstall.sh`, `archbaseos-guided-install.sh`) into `/root/installer/`
|
|
6. If `--preconf`: copies the answerfile to `/answerfile.json` in the ISO's airootfs
|
|
7. Runs `mkarchiso` to produce the final `.iso`
|
|
|
|
---
|
|
|
|
## Extra Packages on the Live System
|
|
|
|
Defined in `setup/archiso/overlay/packages.extra`:
|
|
|
|
```
|
|
git
|
|
jq
|
|
pam-u2f
|
|
btop
|
|
fastfetch
|
|
openssh
|
|
```
|
|
|
|
These are added on top of the standard Arch `releng` package set.
|
|
|
|
---
|
|
|
|
## Live System Entry Points
|
|
|
|
Once booted from the ISO, the following are available:
|
|
|
|
### `install-arch`
|
|
|
|
A command placed in `/usr/local/bin/`:
|
|
|
|
```bash
|
|
install-arch # guided mode (default)
|
|
install-arch guided # guided interactive install
|
|
install-arch auto # automated mode (reads /answerfile.json)
|
|
```
|
|
|
|
### `/root/launch.sh`
|
|
|
|
Internal dispatcher used by `install-arch`.
|
|
|
|
### `/answerfile.json`
|
|
|
|
Only present when built with `--preconf`. Both installer scripts check for this file on startup. If found, all prompts are answered from it — the only interaction required is the disk-encryption password (passwords are never stored in answerfiles).
|
|
|
|
---
|
|
|
|
## Automated Deployment Workflow
|
|
|
|
```
|
|
┌─────────────────────────────────────┐
|
|
│ Developer machine │
|
|
│ │
|
|
│ 1. generate-answerfile.sh │
|
|
│ → ~/answerfile.json │
|
|
│ │
|
|
│ 2. build.sh --preconf │
|
|
│ → ~/m-archy-out/m-archy.iso │
|
|
│ │
|
|
│ 3. dd if=m-archy.iso of=/dev/sdX │
|
|
└──────────────┬──────────────────────┘
|
|
│ USB
|
|
▼
|
|
┌─────────────────────────────────────┐
|
|
│ Target machine (boots from USB) │
|
|
│ │
|
|
│ 4. install-arch auto │
|
|
│ reads /answerfile.json │
|
|
│ installs base OS │
|
|
│ runs tui-install.sh in chroot │
|
|
│ installs dotfiles & apps │
|
|
│ │
|
|
│ 5. Reboot → ready system │
|
|
└─────────────────────────────────────┘
|
|
```
|
|
|
|
For multi-machine deployments, the `hostname` field in the answerfile is combined with the machine's MAC address, so each system gets a unique hostname even though they share the same answerfile.
|
|
|
|
---
|
|
|
|
## Overlay Structure
|
|
|
|
```
|
|
setup/archiso/overlay/
|
|
├── airootfs/
|
|
│ ├── etc/motd # Welcome message
|
|
│ ├── root/
|
|
│ │ └── launch.sh # Installer entry point
|
|
│ └── usr/local/bin/
|
|
│ └── install-arch # User-facing CLI command
|
|
├── packages.extra # Additional live-system packages
|
|
└── profiledef.sh # M-Archy ISO profile definition
|
|
```
|
|
|
|
The `build.sh` script also adds at build time:
|
|
```
|
|
airootfs/root/installer/
|
|
├── arch-autoinstall.sh
|
|
└── archbaseos-guided-install.sh
|
|
```
|
|
|
|
---
|
|
|
|
## Writing the ISO to USB
|
|
|
|
```bash
|
|
# Find the USB drive
|
|
lsblk
|
|
|
|
# Write (replace /dev/sdX with your drive — ALL DATA WILL BE ERASED)
|
|
sudo dd if=~/m-archy-out/m-archy-*.iso of=/dev/sdX bs=4M status=progress oflag=sync
|
|
```
|
|
|
|
Or use `ventoy` / `balenaEtcher` as alternatives.
|