system

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

commit 1f2b31b3154c29beb0b6b91adefbe7b5caf9328c
parent f927f8321f4069b09d12abc13dfd763d9a3db20a
Author: torter <koubbamohamedrayan@gmail.com>
Date:   Mon, 23 Nov 2026 20:11:00 +0000

glibc: the name Chamesle everywhere Artix put its own, linux-lts as the kernel, chamesle-boot on /

Diffstat:
Mhandbook/handbook.md | 12+++++++-----
Apkg/chamesle-base-glibc/brand | 21+++++++++++++++++++++
Apkg/chamesle-base-glibc/brand.hook | 13+++++++++++++
Mpkg/chamesle-base-glibc/post-install | 1+
Apkg/chamesle-base-glibc/post-upgrade | 3+++
Mtools/chamesle-boot | 27+++++++++++++++------------
Mtools/chamesle-bootstrap | 4++--
Mtools/chamesle-install | 2+-
Mtools/mkpkgs | 4++++
9 files changed, 67 insertions(+), 20 deletions(-)

diff --git a/handbook/handbook.md b/handbook/handbook.md @@ -409,10 +409,10 @@ the root is btrfs or ext4. chamesle-disk -t btrfs -y /dev/sda chamesle-bootstrap -l glibc -n box -f "linux-firmware-intel linux-firmware-realtek" /mnt networkmanager networkmanager-openrc -The repos and keyrings come from `/usr/share/chamesle/glibc` on the live system. `-k` is the kernel (`linux`, or -`linux-lts`, `linux-zen`); `-f` the firmware, split by vendor as in Arch (`linux-firmware-amdgpu`, `-nvidia`, -`-atheros`, `-broadcom`, `-mediatek`, or `linux-firmware` for all of it). For an NVIDIA card, add `nvidia-open -nvidia-utils`. Users are made with `useradd`, services have their names from Artix (`NetworkManager`, `iwd`): +The repos and keyrings come from `/usr/share/chamesle/glibc` on the live system. `-k` is the kernel (`linux-lts`, or +`linux`, `linux-zen`); `-f` the firmware, split by vendor as in Arch (`linux-firmware-amdgpu`, `-nvidia`, +`-atheros`, `-broadcom`, `-mediatek`, or `linux-firmware` for all of it). For an NVIDIA card, add `nvidia-open-lts +nvidia-utils` (`nvidia-open` with `linux`). Users are made with `useradd`, services have their names from Artix (`NetworkManager`, `iwd`): echo root:PASSWORD | arch-chroot /mnt chpasswd arch-chroot /mnt useradd -m -G wheel,video,input,audio alice @@ -421,7 +421,9 @@ nvidia-utils`. Users are made with `useradd`, services have their names from Art arch-chroot /mnt rc-update add NetworkManager default chamesle-boot /mnt -chamesle-boot sees the glibc system and writes the entries for mkinitcpio's `initramfs-linux.img`. +chamesle-boot sees the glibc system and writes the entries for mkinitcpio's `initramfs-linux-lts.img`. +The base keeps the name Chamesle where Artix's packages would put theirs: os-release, the release files, GRUB's +menu and the line OpenRC boots with (`/usr/lib/chamesle/brand`, run again by a hook when those packages come). ## 4. mag diff --git a/pkg/chamesle-base-glibc/brand b/pkg/chamesle-base-glibc/brand @@ -0,0 +1,21 @@ +#!/bin/sh +# takes Artix's name out of what shows: os-release, the release files, GRUB and the line OpenRC boots with. +# runs after install and from the hook whenever filesystem, openrc, lsb-release or grub come again +cp /usr/share/chamesle/os-release /usr/lib/os-release +[ -e /etc/os-release ] || ln -s ../usr/lib/os-release /etc/os-release +[ -e /etc/artix-release ] && echo Chamesle > /etc/artix-release +[ -e /etc/lsb-release ] && sed -i 's/^DISTRIB_ID=.*/DISTRIB_ID=Chamesle/; s/^DISTRIB_DESCRIPTION=.*/DISTRIB_DESCRIPTION="Chamesle"/' /etc/lsb-release +[ -e /etc/default/grub ] && sed -i 's/^GRUB_DISTRIBUTOR=.*/GRUB_DISTRIBUTOR="Chamesle"/' /etc/default/grub +[ -e /boot/grub/grub.cfg ] && sed -i 's/Artix Linux/Chamesle/g' /boot/grub/grub.cfg +sed -i 's/:Artix Linux Package Management:/:Package Management:/' /etc/passwd +# OpenRC has "Artix Linux" compiled in: the same bytes, Chamesle and zeros, on a copy that is then moved over +for f in /usr/bin/openrc /usr/bin/openrc-run /usr/bin/openrc-shutdown /usr/bin/openrc-init /usr/bin/rc-service \ + /usr/bin/rc-update /usr/bin/rc-status /usr/bin/supervise-daemon /usr/bin/start-stop-daemon /usr/lib/librc.so.* /usr/lib/libeinfo.so.*; do + [ -f "$f" ] && [ ! -L "$f" ] || continue + at=$(/usr/bin/grep -obaF 'Artix Linux' "$f" | cut -d: -f1) + [ -n "$at" ] || continue + cp -p "$f" "$f.brand" + for o in $at; do printf 'Chamesle\0\0\0' | /usr/bin/dd of="$f.brand" bs=1 seek="$o" conv=notrunc status=none; done + mv "$f.brand" "$f" +done +exit 0 diff --git a/pkg/chamesle-base-glibc/brand.hook b/pkg/chamesle-base-glibc/brand.hook @@ -0,0 +1,13 @@ +[Trigger] +Operation = Install +Operation = Upgrade +Type = Package +Target = filesystem +Target = openrc +Target = lsb-release +Target = grub + +[Action] +Description = Putting the name Chamesle back... +When = PostTransaction +Exec = /usr/lib/chamesle/brand diff --git a/pkg/chamesle-base-glibc/post-install b/pkg/chamesle-base-glibc/post-install @@ -5,4 +5,5 @@ Chamesle. The handbook is /usr/share/doc/chamesle/handbook.md, mag help says how M grep -q '^permit persist :wheel' /etc/doas.conf 2>/dev/null || echo 'permit persist :wheel' >> /etc/doas.conf chmod 600 /etc/doas.conf +/usr/lib/chamesle/brand exit 0 diff --git a/pkg/chamesle-base-glibc/post-upgrade b/pkg/chamesle-base-glibc/post-upgrade @@ -0,0 +1,3 @@ +#!/bin/sh +/usr/lib/chamesle/brand +exit 0 diff --git a/tools/chamesle-boot b/tools/chamesle-boot @@ -20,11 +20,14 @@ case $loader in limine|grub) ;; *) die "-b is limine or grub";; esac [ "$(id -u)" = 0 ] || die "needs root" t=${1:-/mnt} t=${t%/} +# / is the running system: mounts and paths go by "/" +top=${t:-/} [ -x "$t/sbin/init" ] || die "$t has no system in it, run chamesle-bootstrap first" +inroot() { if [ -z "$t" ]; then "$@"; else arch-chroot "$t" "$@"; fi; } mnt() { awk -v m="$1" '$2 == m { print $1, $3, $4 }' /proc/mounts | tail -1; } -set -- $(mnt "$t") -[ $# = 3 ] || die "nothing is mounted on $t" +set -- $(mnt "$top") +[ $# = 3 ] || die "nothing is mounted on $top" rootdev=$1 rootfs=$2 rootopts=$3 set -- $(mnt "$t/boot") bootdev=$1 bootfs=$2 @@ -34,14 +37,14 @@ glibc= [ -e "$t/usr/lib/libc.so.6" ] && glibc=1 kernels= for k in "$t"/boot/vmlinuz-*; do [ -e "$k" ] && kernels="$kernels ${k##*/vmlinuz-}"; done -[ -n "$kernels" ] || die "no kernel in $t/boot, install a kernel first (linux-lts, or linux on glibc)" +[ -n "$kernels" ] || die "no kernel in $t/boot, install a kernel first (linux-lts)" img() { [ -e "$t/boot/initramfs-$1.img" ] && echo "initramfs-$1.img" || echo "initramfs-$1"; } # feature NAME PACKAGE...: puts NAME in the initramfs, with the packages it needs feature() { if [ -n "$glibc" ]; then shift - arch-chroot "$t" mag install "$@" || die "mag install $* failed" + inroot mag install "$@" || die "mag install $* failed" return fi conf=$t/etc/mkinitfs/mkinitfs.conf @@ -49,9 +52,9 @@ feature() { echo "adding $1 to the initramfs" f=$1 shift - arch-chroot "$t" mag install "$@" || die "mag install $* failed" + inroot mag install "$@" || die "mag install $* failed" sed -i "/^features=/s/\"\$/ $f\"/" "$conf" - for m in "$t"/lib/modules/*; do arch-chroot "$t" mkinitfs "${m##*/}" || die "mkinitfs failed"; done + for m in "$t"/lib/modules/*; do inroot mkinitfs "${m##*/}" || die "mkinitfs failed"; done } if [ "$rootfs" = zfs ] && [ -n "$glibc" ]; then @@ -96,12 +99,12 @@ if [ "$(lsblk -dno PTTYPE "$disk")" = gpt ] && ! lsblk -no PARTTYPE "$disk" | gr if [ $loader = grub ]; then case $(cat "$t/etc/mag/arch" 2>/dev/null) in x86) efi=i386-efi;; *) efi=x86_64-efi;; esac - if [ -n "$glibc" ]; then arch-chroot "$t" mag install grub >/dev/null || die "mag install grub failed" - else arch-chroot "$t" mag install grub grub-efi ${bios:+grub-bios} >/dev/null || die "mag install grub failed"; fi - arch-chroot "$t" grub-install --target=$efi --efi-directory=/boot --boot-directory=/boot --removable --no-nvram >/dev/null || die "grub-install for UEFI failed" + if [ -n "$glibc" ]; then inroot mag install grub >/dev/null || die "mag install grub failed" + else inroot mag install grub grub-efi ${bios:+grub-bios} >/dev/null || die "mag install grub failed"; fi + inroot grub-install --target=$efi --efi-directory=/boot --boot-directory=/boot --removable --no-nvram >/dev/null || die "grub-install for UEFI failed" echo "UEFI: GRUB in EFI/BOOT on $bootdev" if [ -n "$bios" ]; then - arch-chroot "$t" grub-install --target=i386-pc --boot-directory=/boot "$disk" >/dev/null || die "grub-install for BIOS failed" + inroot grub-install --target=i386-pc --boot-directory=/boot "$disk" >/dev/null || die "grub-install for BIOS failed" echo "BIOS: GRUB is on $disk" else echo "BIOS: $disk is GPT with no BIOS boot partition, so it boots by UEFI only" @@ -119,7 +122,7 @@ if [ $loader = grub ]; then exit 0 fi -[ -e "$t/usr/share/limine/limine-bios.sys" ] || arch-chroot "$t" mag install limine || die "mag install limine failed" +[ -e "$t/usr/share/limine/limine-bios.sys" ] || inroot mag install limine || die "mag install limine failed" c=$t/boot/limine.conf [ -e "$c" ] && mv "$c" "$c.old" && echo "the old limine.conf is limine.conf.old" @@ -141,6 +144,6 @@ cp "$t/usr/share/limine/limine-bios.sys" "$t/boot/" if [ -z "$bios" ]; then echo "BIOS: $disk is GPT with no BIOS boot partition, so it boots by UEFI only" else - arch-chroot "$t" limine bios-install "$disk" >/dev/null || die "limine bios-install $disk failed" + inroot limine bios-install "$disk" >/dev/null || die "limine bios-install $disk failed" echo "BIOS: limine is on $disk" fi diff --git a/tools/chamesle-bootstrap b/tools/chamesle-bootstrap @@ -11,7 +11,7 @@ usage() { echo " -l musl (default) or glibc" >&2 echo " -a x86_64, x86 and so on (default: this machine's)" >&2 echo " -n host name of the new system (default chamesle)" >&2 - echo " -k the kernel package (default linux-lts, linux on glibc), -f its firmware (default linux-firmware-none, none on glibc)" >&2 + echo " -k the kernel package (default linux-lts), -f its firmware (default linux-firmware-none, none on glibc)" >&2 exit 2 } arch= name=chamesle kernel= firmware= libc=musl @@ -50,7 +50,7 @@ if [ $libc = glibc ]; then # pacman's hooks (the initramfs, the users, tmpfiles) want /proc, /sys and /dev in there, as pacstrap gives them for m in proc sys dev run; do mount --rbind /$m "$target/$m" && mount --make-rslave "$target/$m"; done trap 'for m in run dev sys proc; do umount -R "$target/$m" 2>/dev/null; done' EXIT - mag install chamesle-base ${kernel:-linux} $firmware "$@" + mag install chamesle-base ${kernel:-linux-lts} $firmware "$@" rm -f "$target"/etc/mag/keys/*.gpg cp $conf/repos "$target/etc/mag/repos" # Artix's localmount would mount a second /sys over the cgroups: proc and sys are its services' to mount diff --git a/tools/chamesle-install b/tools/chamesle-install @@ -66,7 +66,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 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-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) \ diff --git a/tools/mkpkgs b/tools/mkpkgs @@ -45,6 +45,10 @@ if [ "$LIBC" = glibc ]; then b=$tmp/base common "$b" cp "$here/pkg/chamesle-base-glibc/repos" "$b/etc/mag/repos" + mkdir -p "$b/usr/lib/chamesle" "$b/usr/share/libalpm/hooks" + install -m755 "$here/pkg/chamesle-base-glibc/brand" "$b/usr/lib/chamesle/brand" + cp "$here/pkg/chamesle-base-glibc/brand.hook" "$b/usr/share/libalpm/hooks/zz-chamesle-brand.hook" + cp "$here/pkg/chamesle-base/os-release" "$b/usr/share/chamesle/os-release" mkdir -p "$b/etc/xdg/fastfetch" cp "$here/files/etc/xdg/fastfetch/config.jsonc" "$b/etc/xdg/fastfetch/" mkdir -p "$b/etc/sysctl.d" "$b/var/lib/pacman/local"