simplify installer, drop eval, fix network check

This commit is contained in:
Astral
2026-09-01 10:57:46 +02:00
parent 535ccc1ffc
commit cb1da62339
3 changed files with 106 additions and 78 deletions
+11 -5
View File
@@ -1,11 +1,12 @@
# Keru OS <sub>ける</sub> # Keru OS <sub>ける</sub>
An independent, source-only Linux distribution built around one idea: you An independent, source-only Linux distribution built around one idea: you
don't install a system, you *craft* one — **ける・けいとうてき** (keru keitō-teki): a system assembled the way you want it. don't install a system, you *craft* one — **ける・けいとうてき** (keru keitō-teki): a
system assembled the way you want it.
This repository holds the **operating system itself** — the installer, the This repository is the **operating system itself** — the installer, the
profile system, and the build pipeline. The two things Keru depends on live in profile system, and the build pipeline. The two things Keru leans on live in
their own repositories: their own homes:
- **[kama](https://github.com/AstralZX/kama)** — the package manager (a shell script) - **[kama](https://github.com/AstralZX/kama)** — the package manager (a shell script)
- **[kama-packages](https://github.com/AstralZX/kama-packages)** — the recipe repository - **[kama-packages](https://github.com/AstralZX/kama-packages)** — the recipe repository
@@ -15,7 +16,7 @@ their own repositories:
Every package on Keru is built from source by **Kama**, a deliberately small Every package on Keru is built from source by **Kama**, a deliberately small
package manager that simply runs the commands in each recipe. No binary package manager that simply runs the commands in each recipe. No binary
packages, no opaque package machinery. The whole system — toolchain included — packages, no opaque package machinery. The whole system — toolchain included —
is compiled from original source. is compiled from original source. What you run, you built.
Nothing is fixed. Nothing you didn't ask for is forced on you. Nothing is fixed. Nothing you didn't ask for is forced on you.
@@ -37,6 +38,11 @@ Every init, every libc, every filesystem, everything. The selections are made
during install and fixed at first boot. The system that lands on your disk is during install and fixed at first boot. The system that lands on your disk is
precisely the one you chose. precisely the one you chose.
Keru is stable on the combinations it offers you. If you push past what's
proven — an untested libc/init pair, an unmaintained filesystem — the
installer **warns** you the combination is unstable, then gets out of your way.
You're never blocked, only told the truth.
## How installation works ## How installation works
The ISO carries **only the installer** — nothing else. There is no prebuilt The ISO carries **only the installer** — nothing else. There is no prebuilt
+26
View File
@@ -65,6 +65,32 @@ you fetch exactly the parts you picked.
> fit-to-request. If you want fast and prebaked, a binary distro is right > fit-to-request. If you want fast and prebaked, a binary distro is right
> there. If you want your machine, this is the one." > there. If you want your machine, this is the one."
## Stability: guaranteed on what's offered, never enforced on you
Keru's promise is that **the system won't break** — but honestly scoped: it
won't break **on the combinations it offers you**. That is what the installer
means by offering a choice: each option in `install.sh` is one Keru has proven
builds and boots. The offered set is curated *so that* it doesn't break.
Choice multiplies the test surface — six inits, four libcs, seven filesystems,
five kernels, and so on produce over a thousand possible systems. Guaranteeing
every one of them is only honest if it's *enforced by curation*: Keru offers
what works.
But the user is never locked out of going further. If you pick something that
isn't yet proven — a libc and init never tested together, an unmaintained
filesystem, an exotic kernel pair — Keru does **not** stop you. It **warns
you** the combination is unstable and lets you proceed.
> "Stability is a guarantee about what we offer, not a jail around the edge of
> it. If you want to push into the unproven, we tell you the truth and get out
> of your way."
So the full definition, in one line:
> **The system won't break for any choice Keru offers you; for anything beyond
> that, Keru warns and steps aside — you stay in control, never blocked.**
## Agreement on choice, not agreement on opinion ## Agreement on choice, not agreement on opinion
The through-line across Keru's lineage is clear: TOML packages, then a The through-line across Keru's lineage is clear: TOML packages, then a
+69 -73
View File
@@ -1,88 +1,66 @@
#!/usr/bin/env sh #!/usr/bin/env sh
# keru-install — the Keru OS TUI installer # keru-install — Keru OS installer. Runs from the live ISO, walks you
# # through your choices, writes make.conf, then builds your system.
# Walks you through crafting your exact system, then writes make.conf and
# kicks off the build. Everything is swappable here, at install time, and
# locked in when you boot.
#
# Designed to run from the Keru live ISO. Backed by dialog/whiptail if
# present; falls back to plain prompted input. All shell, no magic.
set -eu set -eu
. "$(dirname "$0")/../scripts/common.sh" . "$(dirname "$0")/../scripts/common.sh"
# ---- defaults (mirror profile/make.conf) --------------------------------
OUT="${MAKE_CONF_OUT:-/tmp/keru/make.conf}" OUT="${MAKE_CONF_OUT:-/tmp/keru/make.conf}"
DROP="/tmp/keru" mkdir -p /tmp/keru
mkdir -p "$DROP"
# ---- menu helpers ------------------------------------------------------- # show a menu of options, remember the pick in $CHOICE
pick() { # prompt, array-of-labels, defaults -> writes choice to $CHOICE pick() {
local prompt="$1"; shift prompt="$1"; shift
local default="$1"; shift default="$1"; shift
CHOICE="$default" CHOICE="$default"
if command -v dialog >/dev/null 2>&1; then printf '%s\n' "== $prompt =="
local args=() n=0
local i=0 for opt in "$@"; do
for opt in "$@"; do n=$((n+1))
args+=("$i" "$opt") printf ' %s) %s\n' "$n" "$opt"
i=$((i+1)) done
done printf 'Select [%s]: ' "$default"
local sel read -r sel
sel=$(dialog --stdout --no-cancel --menu "$prompt" 15 60 8 \ case "$sel" in
--default-item "$default" "${args[@]}") || true ''|*[!0-9]*) CHOICE="$default" ;;
CHOICE=$(eval "printf '%s' \"\${$((sel+1)):-\$default}\"" 2>/dev/null || printf '%s' "$default") *)
else if [ "$sel" -ge 1 ] && [ "$sel" -le "$n" ]; then
printf '%s\n' "== $prompt ==" i=0
local n=1 for opt in "$@"; do
for opt in "$@"; do i=$((i+1))
printf ' %s) %s\n' "$n" "$opt" [ "$i" -eq "$sel" ] && { CHOICE="$opt"; break; }
n=$((n+1)) done
done else
printf 'Select [%s]: ' "$default" CHOICE="$default"
read -r sel fi
[ -n "$sel" ] && CHOICE=$(eval "printf '%s' \"\${$sel}\"") || CHOICE="$default" ;;
fi esac
} }
# ---- network check -------------------------------------------------------
# The ISO carries only the installer. Everything else (kernels, init systems,
# libcs, filesystems, tools) is fetched and built at install time, so a working
# network connection is a hard prerequisite.
require_network() { require_network() {
local ok=0 ok=0
# try a few reachability probes for host in 1.1.1.1 github.com mirror.keru.org; do
for host in mirror.keru.org github.com 1.1.1.1; do if command -v ping >/dev/null 2>&1 && ping -c1 -W2 "$host" >/dev/null 2>&1; then
if command -v ping >/dev/null 2>&1 && ping -c1 -W2 "$host" >/dev/null 2>&1; then ok=1; break; fi ok=1; break
# fallback: plain connect test via /dev/tcp fi
case "$host" in
*.*.*.*) : ;; # ip already covered by ping
esac
done done
if [ "$ok" = "0" ]; then if [ "$ok" = "0" ]; then
if command -v nc >/dev/null 2>&1; then if command -v nc >/dev/null 2>&1 && nc -z -w5 github.com 443 >/dev/null 2>&1; then
nc -z -w5 mirror.keru.org 443 >/dev/null 2>&1 && ok=1 ok=1
elif [ -e /dev/tcp ] && (exec 3<>/dev/tcp/github.com/443) >/dev/null 2>&1; then
ok=1
fi fi
fi fi
[ "$ok" = "1" ] [ "$ok" = "1" ]
} }
# ---- network configuration ------------------------------------------------
configure_network() { configure_network() {
msg "network configuration"
if command -v nmtui >/dev/null 2>&1; then if command -v nmtui >/dev/null 2>&1; then
nmtui 2>/dev/null && return 0 nmtui >/dev/null 2>&1
else
warn "nmtui not available — bring up the network yourself, then continue"
fi fi
if command -v dialog >/dev/null 2>&1 && command -v wifi-menu >/dev/null 2>&1; then
dialog --stdout --menu "Network" 12 40 3 \
1 "Wireless (wifi-menu)" 2 "Ethernet (skip)" 3 "Manual (ip)" 2>/dev/null
fi
read -r -p "Bring up Ethernet (DHCP) now? [Y/n] " eth
case "$eth" in
n|N|no) : ;;
*) command -v dhcpcd >/dev/null 2>&1 && (dhcpcd >/dev/null 2>&1 &) || true ;;
esac
} }
banner "Keru OS — network required" banner "Keru OS — network required"
@@ -90,20 +68,16 @@ info "the ISO only carries the installer."
info "the system you choose (init, libc, fs, kernel, tools) is fetched and" info "the system you choose (init, libc, fs, kernel, tools) is fetched and"
info "built from the network during installation. a connection is required." info "built from the network during installation. a connection is required."
if require_network; then while ! require_network; do
msg "network: connected" warn "network: not connected"
else read -r -p "Connect to the network now (runs nmtui)? [Y/n] " cfg
warn "network: not detected"
read -r -p "Configure the network now? [Y/n] " cfg
case "$cfg" in case "$cfg" in
n|N|no) die "a network connection is required to install Keru" ;; n|N|no) die "a network connection is required to install Keru" ;;
*) configure_network ;; *) configure_network ;;
esac esac
require_network || die "still no network connection — cannot install" done
msg "network: connected" msg "network: connected"
fi
# ---- swappable selections ------------------------------------------------
banner "Keru OS — craft your system" banner "Keru OS — craft your system"
pick "Init system" runit runit s6 openrc systemd busybox-init sysvinit dinit shepherd pick "Init system" runit runit s6 openrc systemd busybox-init sysvinit dinit shepherd
@@ -124,7 +98,29 @@ SUDO="$CHOICE"
pick "Network tools" nmtui nmtui networkmanager connman systemd-networkd pick "Network tools" nmtui nmtui networkmanager connman systemd-networkd
NET="$CHOICE" NET="$CHOICE"
# ---- assemble make.conf ------------------------------------------------ warn_unstable() {
unstable=0
case "$LIBC:$INIT" in
uclibc-ng:*|musl:systemd)
warn "$LIBC + $INIT: not yet proven to build and boot together"
unstable=1 ;;
esac
case "$LIBC:$KERNEL" in
musl:linux-zen|uclibc-ng:*)
warn "$LIBC + $KERNEL: not yet proven to build and boot together"
unstable=1 ;;
esac
case "$TARGET_FS" in
zfs) warn "zfs + $LIBC: needs kernel module + ZFS userspace, not yet proven"
unstable=1 ;;
reiserfs) warn "reiserfs is unmaintained and has no stable future"
unstable=1 ;;
esac
[ "$unstable" = "1" ] && warn "this combination is unstable. Keru won't stop you — build at your own risk."
}
warn_unstable
msg "writing $OUT" msg "writing $OUT"
cat > "$OUT" <<EOF cat > "$OUT" <<EOF
# Generated by keru-install — hand-tune then rebuild if you like. # Generated by keru-install — hand-tune then rebuild if you like.