system

the Chamesle handbook, init, live ISO and install helpers
git clone https://github.com/tortr-rs/system
Log | Files | Refs | README | LICENSE

commit 4a66d3dbf1b8cd5339fd39dd7a2ab6470af406b3
parent 40acd9db4a2d9b641ba03891fd56787c8f040a5d
Author: torter <koubbamohamedrayan@gmail.com>
Date:   Wed, 25 Nov 2026 08:04:31 +0000

installer: keyboard first, kernel choice on glibc; hosts, BIOS boot partition check, kbd on the ISO

Diffstat:
Mhandbook/handbook.md | 7++++++-
Miso/profile/packages | 2++
Mtools/chamesle-boot | 1+
Mtools/chamesle-bootstrap | 2++
Mtools/chamesle-disk | 4++++
Mtools/chamesle-install | 30+++++++++++++++++++++++++++---
6 files changed, 42 insertions(+), 4 deletions(-)

diff --git a/handbook/handbook.md b/handbook/handbook.md @@ -133,7 +133,9 @@ It asks for the passphrase. dhcpcd gives the interface an address once it is con ## 3. Installing -The live system has `chamesle-install`, which asks for the disk, the file system (ZFS, btrfs or ext4), the bootloader +The live system has `chamesle-install`, which asks for the keyboard (loaded right away, and set for the console and X +on the new system), the disk, on x86_64 musl or glibc (and on glibc the kernel: linux-lts, or linux for the newest +hardware), the file system (ZFS, btrfs or ext4), the bootloader (limine or GRUB), the firmware (what the machine has is ticked), wifi, the host name, the root password and a user, and then does this chapter on the whole disk. The log is `/var/log/chamesle-install.log`, and a copy is kept on the new system. The rest of the chapter is the same install by hand, for another layout or to know what it did. @@ -164,6 +166,9 @@ partitions. Three of them work for BIOS and UEFI both: | 2 | 512M | EFI System | `/boot`, FAT32 | | 3 | the rest | Linux filesystem | `/`, ZFS | +On a machine that boots by BIOS, a GPT disk needs the 1M BIOS boot partition; without it chamesle-disk and +chamesle-boot stop and say so. A dos label works too. + Write the table and quit cfdisk. chamesle-disk lists the partitions and asks which one is the boot partition and which is the root. Then it does, in this order: diff --git a/iso/profile/packages b/iso/profile/packages @@ -24,3 +24,5 @@ btrfs-progs iwd-openrc dbus-openrc wipefs +kbd +kbd-legacy diff --git a/tools/chamesle-boot b/tools/chamesle-boot @@ -96,6 +96,7 @@ fi disk=/dev/$(lsblk -no PKNAME "$bootdev" | head -1) bios=1 if [ "$(lsblk -dno PTTYPE "$disk")" = gpt ] && ! lsblk -no PARTTYPE "$disk" | grep -qi 21686148-6449-6e6f-744e-656564454649; then bios=; fi +[ -z "$bios" ] && [ ! -d /sys/firmware/efi ] && die "this machine boots by BIOS and $disk is GPT with no BIOS boot partition: add a 1M one in cfdisk (type BIOS boot), or use a dos label" if [ $loader = grub ]; then case $(cat "$t/etc/mag/arch" 2>/dev/null) in x86) efi=i386-efi;; *) efi=x86_64-efi;; esac diff --git a/tools/chamesle-bootstrap b/tools/chamesle-bootstrap @@ -61,6 +61,8 @@ else mag install chamesle-base $firmware ${kernel:-linux-lts} "$@" fi echo "$name" > "$target/etc/hostname" +# startx's xauth wants the host name to resolve +printf '127.0.0.1\tlocalhost %s\n::1\t\tlocalhost %s\n' "$name" "$name" > "$target/etc/hosts" [ -e "$target/etc/resolv.conf" ] || cp /etc/resolv.conf "$target/etc/" 2>/dev/null || : echo echo "the base is in $target. go on with the fstab, a password and the boot entry (handbook, 3.4)." diff --git a/tools/chamesle-disk b/tools/chamesle-disk @@ -53,6 +53,7 @@ else printf 'Type the name of the disk (%s) to go on: ' "${disk##*/}" read -r answer [ "$answer" = "${disk##*/}" ] || [ "$answer" = "$disk" ] || die "not confirmed, nothing was changed" + [ -d /sys/firmware/efi ] || echo "This machine boots by BIOS: on a gpt label, make a 1M partition of type BIOS boot, or pick dos." cfdisk "$disk" || die "cfdisk failed" sleep 1 echo @@ -68,6 +69,9 @@ else boot=$(ask "Which partition is the boot partition (vfat, the EFI system partition)") || exit 1 root=$(ask "Which partition is the root ($fs)") || exit 1 [ "$boot" != "$root" ] || die "boot and root cannot be the same partition" + if [ ! -d /sys/firmware/efi ] && [ "$(lsblk -dno PTTYPE "$disk")" = gpt ] && ! lsblk -no PARTTYPE "$disk" | grep -qi 21686148-6449-6e6f-744e-656564454649; then + die "this machine boots by BIOS and $disk is GPT with no BIOS boot partition: add a 1M one (type BIOS boot) in cfdisk, or use dos" + fi fi wipefs -aq "$boot" "$root" diff --git a/tools/chamesle-install b/tools/chamesle-install @@ -9,6 +9,16 @@ d() { dialog --stdout --backtitle "$T installer" "$@"; } msg() { d --msgbox "$1" 0 0; } log=/var/log/chamesle-install.log +# console keymap and X layout; the console one is loaded right away for the rest of the questions +km=$(d --default-item us --menu "The keyboard" 0 0 8 \ + us "US (QWERTY)" fr "French (AZERTY)" de "German (QWERTZ)" gb "British" es "Spanish" it "Italian" \ + be "Belgian (AZERTY)" pt "Portuguese" ch-fr "Swiss French" us-dvorak "Dvorak" pl "Polish") || die "left" +case $km in *-*) xkb="${km%%-*} ${km#*-}";; *) xkb=$km;; esac +# the console's names for it; on musl the xkb keymaps do not load, the legacy ones do, by their path +case $km in gb) km=uk;; be|pt) km=$km-latin1;; ch-fr) km=fr_CH;; us-dvorak) km=dvorak;; pl) km=pl2;; esac +kmap() { find /usr/share/keymaps/legacy -name "$km.map.gz" | head -n 1; } +loadkeys "$(kmap)" >/dev/null 2>&1 + # three tries: right after boot the first lookup can be slow online() { for i in 1 2 3; do curl -fsS -m 8 -o /dev/null https://chamesle.org/repo/x86_64/APKINDEX.tar.gz 2>/dev/null && return; sleep 2; done; return 1; } while ! online; do @@ -54,7 +64,11 @@ loader=$(d --menu "The bootloader" 0 0 8 \ # the firmware the hardware here wants, ticked already has() { for v in /sys/bus/pci/devices/*; do [ "$(cat $v/vendor)" = "$1" ] && case $(cat $v/class) in $2*) return 0;; esac; done; return 1; } on() { has "$@" && echo on || echo off; } +kernel= if [ $libc = glibc ]; then + kernel=$(d --menu "The kernel" 0 0 8 \ + linux-lts "the long term one (6.18)" \ + linux "the newest (7.x): new hardware, sound on some laptops wants it") || die "left" intel=off { has 0x8086 0x0280 || has 0x8086 0x03; } && intel=on fw=$(d --separate-output --checklist "Firmware for the hardware (ticked: what this machine has)" 0 0 8 \ @@ -66,7 +80,7 @@ if [ $libc = glibc ]; then linux-firmware-broadcom "Broadcom wifi" $(on 0x14e4 0x0280) \ linux-firmware-nvidia "NVIDIA graphics" $(on 0x10de 0x03)) || die "left" nvidia= - has 0x10de 0x03 && d --yesno "There is an NVIDIA card. Install NVIDIA's driver (nvidia-open), not nouveau?" 0 0 && nvidia="nvidia-open-lts nvidia-utils" + has 0x10de 0x03 && d --yesno "There is an NVIDIA card. Install NVIDIA's driver (nvidia-open), not nouveau?" 0 0 && nvidia="nvidia-open$([ $kernel = linux-lts ] && echo -lts) nvidia-utils" else fw=$(d --separate-output --checklist "Firmware for the hardware (ticked: what this machine has)" 0 0 8 \ linux-firmware-intel "Intel wifi and bluetooth" $(on 0x8086 0x0280) \ @@ -101,7 +115,7 @@ user=$(d --inputbox "Your user name (empty for none)" 0 0) || die "left" user=$(echo "$user" | tr -cd 'a-z0-9_-') [ -n "$user" ] && userpw=$(pw "The password of $user") -d --yesno "Install now?\n\n disk $disk (ERASED)\n Chamesle $libc\n file system $fs\n bootloader $loader\n firmware $(echo $fw)\n network $wifi\n host name $host\n user ${user:-none}" 0 0 || die "nothing was changed" +d --yesno "Install now?\n\n disk $disk (ERASED)\n Chamesle $libc${kernel:+, $kernel}\n keyboard $km\n file system $fs\n bootloader $loader\n firmware $(echo $fw)\n network $wifi\n host name $host\n user ${user:-none}" 0 0 || die "nothing was changed" pkgs= case $libc/$wifi in @@ -110,6 +124,8 @@ musl/networkmanager) pkgs="networkmanager networkmanager-wifi networkmanager-tui glibc/iwd) pkgs="iwd iwd-openrc";; glibc/networkmanager) pkgs="networkmanager networkmanager-openrc";; esac +pkgs="$pkgs kbd" +[ $libc = musl ] && pkgs="$pkgs kbd-legacy" if [ $libc = glibc ]; then first= rest="$(echo $fw) $nvidia" else @@ -124,7 +140,7 @@ step() { echo "==> $1" >> $log; d --infobox "$1" 3 60; } chamesle-disk -t $fs -y "$disk" >> $log 2>&1 || exit 1 step "Installing the base (a few minutes)" n=0 - until chamesle-bootstrap -l $libc -n "$host" ${first:+-f $first} /mnt $rest $pkgs >> $log 2>&1; do + until chamesle-bootstrap -l $libc -n "$host" ${kernel:+-k $kernel} ${first:+-f $first} /mnt $rest $pkgs >> $log 2>&1; do n=$((n + 1)) [ $n -lt 3 ] || exit 1 sleep 5 @@ -148,6 +164,14 @@ step() { echo "==> $1" >> $log; d --infobox "$1" 3 60; } arch-chroot /mnt rc-update add $s default >> $log 2>&1;; esac [ $libc = glibc ] && [ $wifi != networkmanager ] && arch-chroot /mnt rc-update add dhcpcd default >> $log 2>&1 + # the keymap service is keymaps on glibc, loadkeys on musl + if [ $libc = glibc ]; then ks=keymaps k=$km; else ks=loadkeys k=$(kmap); fi + sed -i "s|^keymap=.*|keymap=\"$k\"|" /mnt/etc/conf.d/$ks + arch-chroot /mnt rc-update add $ks boot >> $log 2>&1 + mkdir -p /mnt/etc/X11/xorg.conf.d + set -- $xkb + printf 'Section "InputClass"\n\tIdentifier "keyboard"\n\tMatchIsKeyboard "on"\n\tOption "XkbLayout" "%s"\n%bEndSection\n' "$1" \ + "${2:+\tOption \"XkbVariant\" \"$2\"\n}" > /mnt/etc/X11/xorg.conf.d/00-keyboard.conf step "Installing the bootloader ($loader)" chamesle-boot -b $loader /mnt >> $log 2>&1 || exit 1 cp $log /mnt/var/log/ 2>/dev/null