boot straight into the installer from the live ISO

This commit is contained in:
Astral
2026-09-01 08:38:22 +02:00
parent 6b65014d64
commit 535ccc1ffc
3 changed files with 73 additions and 5 deletions
+5 -1
View File
@@ -7,7 +7,7 @@ SHELL := sh
KAMA ?= ../kama
PKGS ?= ../kama-packages
.PHONY: rootfs install recipe-check clean
.PHONY: rootfs install live-init recipe-check clean
rootfs:
sh scripts/build-root.sh
@@ -15,6 +15,10 @@ rootfs:
install:
sh installer/install.sh
# syntax-check the live init (what boots you into the installer)
live-init:
sh -n live/init && echo "OK live/init"
recipe-check:
@for f in $(PKGS)/*.sh; do \
sh -n "$$f" && echo "OK $$f" || echo "FAIL $$f"; \
+7 -4
View File
@@ -40,9 +40,11 @@ precisely the one you chose.
## How installation works
The ISO carries **only the installer** — nothing else. There is no prebuilt
base image on the disk. When you boot it, the installer connects to the
network, and then fetches and builds whatever you selected (init system,
kernel, libc, filesystem tooling, and tools) on the fly.
base image on the disk. Boot it and the live init (`live/init`) starts the
installer immediately — no shell prompt, you just make your choices and it
builds. The installer connects to the network, then fetches and builds
whatever you selected (init system, kernel, libc, filesystem tooling, and
tools) on the fly.
A working **network connection is therefore a hard requirement** for
installing Keru. The installer checks connectivity and offers in-installer
@@ -52,9 +54,10 @@ build begins.
## Repository layout
```
installer/ TUI installer — writes make.conf from your choices
installer/ TUI installer — auto-starts on boot, writes make.conf from your choices
profile/ make.conf template (the swappables + build flags)
scripts/ build pipeline: build-root, mkfs-root, common helpers
live/ live-ISO init — boots straight into the installer
docs/ philosophy + design docs + the recipe format spec
```
+61
View File
@@ -0,0 +1,61 @@
#!/bin/sh
# Keru live ISO init — jumps straight into the installer.
#
# The live ISO carries only the installer. On boot this script:
# 1. mounts the virtual filesystems
# 2. attaches the read-only installer root (squashfs, plain initramfs, or
# an unattached block device)
# 3. execs installer/install.sh on the console — so you boot, choose, and it
# crafts and installs the system. No shell prompt in the way.
# 4. if the installer exits (e.g. you declined to build), drops to an
# emergency shell instead of leaving you stranded.
#
# Ultra-minimal by design: /bin/sh is busybox. No init system in the live env.
# ---- console -----------------------------------------------------------
# Redirect the console early so messages land where you can see them.
CONSOLE="${console:-/dev/tty1}"
exec <"$CONSOLE" >"$CONSOLE" 2>"$CONSOLE"
# ---- virtual filesystems ----------------------------------------------
mount -t proc proc /proc 2>/dev/null
mount -t sysfs sys /sys 2>/dev/null
mount -t devtmpfs dev /dev 2>/dev/null || (mkdir -p /dev && mount -t tmpfs dev /dev 2>/dev/null)
mkdir -p /dev/pts /dev/shm
mount -t devpts devpts /dev/pts 2>/dev/null
mount -t tmpfs tmpfs /dev/shm 2>/dev/null
# ---- locate the installer root ----------------------------------------
# Where the installer payload lives. Tried in order:
# 1. $root — whatever the kernel booted (a squashfs / overlay already handled
# by an initramfs that then hands off here).
# 2. a squashfs node named *.sfs on a known device (label=KERU).
# 3. nothing — the installer is already on the root we're running from.
case "${root:-}" in
/dev/*)
# re-mount as the boot-time root: cannot pivot here, so use it directly
/bin/busybox mount -o move / "$root" 2>/dev/null || true
;;
'')
for _dev in /dev/disk/by-label/KERU*; do
[ -e "$_dev" ] || continue
_node="$(readlink -f "$_dev")"
mount "$_node" /squash 2>/dev/null || continue
INSTALLER=/squash
break
done
;;
esac
INSTALLER="${INSTALLER:-/}"
# ---- launch the installer ---------------------------------------------
if [ -e "$INSTALLER/installer/install.sh" ]; then
printf '\n[ keru ] booting installer...\n'
cd "$INSTALLER" && exec /bin/sh "$INSTALLER/installer/install.sh"
fi
# If we land here the installer is missing or returned. Never strand someone:
# fall back to an interactive rescue shell.
printf '\n[ keru ] installer not found or exited.\n'
printf '[ keru ] dropping to an emergency shell. (installer path: %s)\n' "$INSTALLER"
exec /bin/sh