simplify installer, drop eval, fix network check
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
# Keru OS <sub>ける</sub>
|
||||
|
||||
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
|
||||
profile system, and the build pipeline. The two things Keru depends on live in
|
||||
their own repositories:
|
||||
This repository is the **operating system itself** — the installer, the
|
||||
profile system, and the build pipeline. The two things Keru leans on live in
|
||||
their own homes:
|
||||
|
||||
- **[kama](https://github.com/AstralZX/kama)** — the package manager (a shell script)
|
||||
- **[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
|
||||
package manager that simply runs the commands in each recipe. No binary
|
||||
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.
|
||||
|
||||
@@ -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
|
||||
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
|
||||
|
||||
The ISO carries **only the installer** — nothing else. There is no prebuilt
|
||||
|
||||
@@ -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
|
||||
> 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
|
||||
|
||||
The through-line across Keru's lineage is clear: TOML packages, then a
|
||||
|
||||
+61
-65
@@ -1,88 +1,66 @@
|
||||
#!/usr/bin/env sh
|
||||
# keru-install — the Keru OS TUI installer
|
||||
#
|
||||
# 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.
|
||||
# keru-install — Keru OS installer. Runs from the live ISO, walks you
|
||||
# through your choices, writes make.conf, then builds your system.
|
||||
|
||||
set -eu
|
||||
|
||||
. "$(dirname "$0")/../scripts/common.sh"
|
||||
|
||||
# ---- defaults (mirror profile/make.conf) --------------------------------
|
||||
OUT="${MAKE_CONF_OUT:-/tmp/keru/make.conf}"
|
||||
DROP="/tmp/keru"
|
||||
mkdir -p "$DROP"
|
||||
mkdir -p /tmp/keru
|
||||
|
||||
# ---- menu helpers -------------------------------------------------------
|
||||
pick() { # prompt, array-of-labels, defaults -> writes choice to $CHOICE
|
||||
local prompt="$1"; shift
|
||||
local default="$1"; shift
|
||||
# show a menu of options, remember the pick in $CHOICE
|
||||
pick() {
|
||||
prompt="$1"; shift
|
||||
default="$1"; shift
|
||||
CHOICE="$default"
|
||||
if command -v dialog >/dev/null 2>&1; then
|
||||
local args=()
|
||||
local i=0
|
||||
for opt in "$@"; do
|
||||
args+=("$i" "$opt")
|
||||
i=$((i+1))
|
||||
done
|
||||
local sel
|
||||
sel=$(dialog --stdout --no-cancel --menu "$prompt" 15 60 8 \
|
||||
--default-item "$default" "${args[@]}") || true
|
||||
CHOICE=$(eval "printf '%s' \"\${$((sel+1)):-\$default}\"" 2>/dev/null || printf '%s' "$default")
|
||||
else
|
||||
printf '%s\n' "== $prompt =="
|
||||
local n=1
|
||||
n=0
|
||||
for opt in "$@"; do
|
||||
printf ' %s) %s\n' "$n" "$opt"
|
||||
n=$((n+1))
|
||||
printf ' %s) %s\n' "$n" "$opt"
|
||||
done
|
||||
printf 'Select [%s]: ' "$default"
|
||||
read -r sel
|
||||
[ -n "$sel" ] && CHOICE=$(eval "printf '%s' \"\${$sel}\"") || CHOICE="$default"
|
||||
case "$sel" in
|
||||
''|*[!0-9]*) CHOICE="$default" ;;
|
||||
*)
|
||||
if [ "$sel" -ge 1 ] && [ "$sel" -le "$n" ]; then
|
||||
i=0
|
||||
for opt in "$@"; do
|
||||
i=$((i+1))
|
||||
[ "$i" -eq "$sel" ] && { CHOICE="$opt"; break; }
|
||||
done
|
||||
else
|
||||
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() {
|
||||
local ok=0
|
||||
# try a few reachability probes
|
||||
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 ok=1; break; fi
|
||||
# fallback: plain connect test via /dev/tcp
|
||||
case "$host" in
|
||||
*.*.*.*) : ;; # ip already covered by ping
|
||||
esac
|
||||
ok=0
|
||||
for host in 1.1.1.1 github.com mirror.keru.org; do
|
||||
if command -v ping >/dev/null 2>&1 && ping -c1 -W2 "$host" >/dev/null 2>&1; then
|
||||
ok=1; break
|
||||
fi
|
||||
done
|
||||
if [ "$ok" = "0" ]; then
|
||||
if command -v nc >/dev/null 2>&1; then
|
||||
nc -z -w5 mirror.keru.org 443 >/dev/null 2>&1 && ok=1
|
||||
if command -v nc >/dev/null 2>&1 && nc -z -w5 github.com 443 >/dev/null 2>&1; then
|
||||
ok=1
|
||||
elif [ -e /dev/tcp ] && (exec 3<>/dev/tcp/github.com/443) >/dev/null 2>&1; then
|
||||
ok=1
|
||||
fi
|
||||
fi
|
||||
[ "$ok" = "1" ]
|
||||
}
|
||||
|
||||
# ---- network configuration ------------------------------------------------
|
||||
configure_network() {
|
||||
msg "network configuration"
|
||||
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
|
||||
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"
|
||||
@@ -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 "built from the network during installation. a connection is required."
|
||||
|
||||
if require_network; then
|
||||
msg "network: connected"
|
||||
else
|
||||
warn "network: not detected"
|
||||
read -r -p "Configure the network now? [Y/n] " cfg
|
||||
while ! require_network; do
|
||||
warn "network: not connected"
|
||||
read -r -p "Connect to the network now (runs nmtui)? [Y/n] " cfg
|
||||
case "$cfg" in
|
||||
n|N|no) die "a network connection is required to install Keru" ;;
|
||||
*) configure_network ;;
|
||||
esac
|
||||
require_network || die "still no network connection — cannot install"
|
||||
done
|
||||
msg "network: connected"
|
||||
fi
|
||||
|
||||
# ---- swappable selections ------------------------------------------------
|
||||
banner "Keru OS — craft your system"
|
||||
|
||||
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
|
||||
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"
|
||||
cat > "$OUT" <<EOF
|
||||
# Generated by keru-install — hand-tune then rebuild if you like.
|
||||
|
||||
Reference in New Issue
Block a user