commit 02f7b12e3bbf6bca8fe88fc1f4d4588fcd4e2472
parent 470678f61d9b4afdfbc092b50e307741513bf67d
Author: torter <koubbamohamedrayan@gmail.com>
Date: Mon, 26 Oct 2026 05:18:28 -0400
0.6.0 netinst: one 618 MB iso, jiggity asks everything then installs the desktop you pick (chamesle-desktop), themes as a package
Diffstat:
15 files changed, 544 insertions(+), 64 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -3,3 +3,4 @@ out/
*.iso
*.iso.sha256
__pycache__/
+tools/pkg/chamesle-fluent/files/
diff --git a/VERSION b/VERSION
@@ -1 +1 @@
-0.5.0
+0.6.0
diff --git a/build.sh b/build.sh
@@ -1,6 +1,7 @@
#!/bin/bash
# builds the iso for one edition
# sudo EDITION=xfce ./build.sh -> out/chamesle-VERSION-EDITION-x86_64.iso
+# sudo EDITION=netinst ./build.sh -> out/chamesle-VERSION-x86_64.iso, the one that installs any of them
# REPO= a dir or url with x86_64/Packages.adb (default work/repo, else the public one), WORK= OUT=
# needs apk-tools 3, mksquashfs, xorriso, grub-mkrescue (bios + efi), readelf, zstd, cpio, depmod, curl
set -euo pipefail
@@ -17,7 +18,11 @@ edval() { local e v; for e in $EDITION $BASE; do v=$(sed -n "s/^$1=//p" "$HERE/e
EDITION_NAME=$(sed -n 's/^name=//p' "$HERE/editions/$EDITION/edition" 2>/dev/null); EDITION_NAME=${EDITION_NAME:-$EDITION}
WORK=${WORK:-$HERE/work/$EDITION}; ROOT=$WORK/root; ISO_DIR=$WORK/iso
OUT=${OUT:-$HERE/out}; ISO=$OUT/chamesle-$VERSION-$EDITION-x86_64.iso
+NETINST=$(edval netinst)
+[ "$NETINST" = yes ] && ISO=$OUT/chamesle-$VERSION-x86_64.iso
PUBLIC_REPO=https://downloads.sourceforge.net/project/chameslerepos
+# where the netinst installs from: the public repo. NETREPO="v3 URL;v3 URL" to test against others
+NETREPO=${NETREPO:-v3 $PUBLIC_REPO}
REPO=${REPO:-$( [ -f "$HERE/work/repo/x86_64/Packages.adb" ] && echo "$HERE/work/repo" || echo "$PUBLIC_REPO")}
APK=${APK:-apk}
IN=$HERE/tools/in-image.sh
@@ -54,6 +59,23 @@ rm -rf "$ROOT/tmp/scripts"
umount "$ROOT/proc" 2>/dev/null || true; umount -lR "$ROOT/dev" 2>/dev/null || true; trap - EXIT
# what the installed system updates from
echo "v3 $PUBLIC_REPO" > "$ROOT/etc/apk/repositories"
+mkdir -p "$ROOT/usr/share/chamesle"
+cp "$ROOT/etc/apk/repositories" "$ROOT/usr/share/chamesle/repositories"
+if [ "$NETINST" = yes ]; then
+ echo "$NETREPO" | tr ';' '\n' > "$ROOT/etc/apk/repositories"
+ # the kernel brings all of linux-firmware: only the wi-fi and ethernet parts stay. the installed system gets
+ # the rest back, chamesle-desktop reinstalls what /etc/chamesle/trimmed names
+ FWD=$ROOT/usr/lib/firmware; rm -rf "$WORK/firmware"; mv "$FWD" "$WORK/firmware"; mkdir -p "$FWD"
+ for d in $(sed 's/#.*//' "$HERE/editions/$EDITION/firmware"); do
+ mkdir -p "$FWD/$(dirname "$d")"
+ cp -a "$WORK/firmware/$d" "$FWD/$(dirname "$d")/"
+ done
+ mkdir -p "$ROOT/etc/chamesle"
+ pkg info --quiet | grep -E '^(linux-firmware|intel-ucode)' > "$ROOT/etc/chamesle/trimmed"
+ # iwlwifi: the 3 newest of each chip, the kernel takes the newest it knows
+ ls "$ROOT/usr/lib/firmware/intel/iwlwifi" | sed -n 's/-\([0-9]*\)\.ucode\.zst$/ \1/p' | sort -k1,1 -k2,2nr |
+ awk 'n[$1]++ >= 3 { print $1 "-" $2 ".ucode.zst" }' | sed "s|^|$ROOT/usr/lib/firmware/intel/iwlwifi/|" | xargs -r rm -f
+fi
# flathub apps on the iso (play: steam). this machine's flatpak installs them into the image's system flatpaks
FLATPAKS=$(edval flatpaks)
if [ -n "$FLATPAKS" ]; then
@@ -76,7 +98,10 @@ for l in "$ROOT"/etc/dinit.d/boot.d/*; do
c=$(sed -n 's/^command *= *\([^ ]*\).*/\1/p' "$ROOT/etc/dinit.d/${l##*/}" 2>/dev/null)
[ -n "$c" ] && [ ! -e "$ROOT$c" ] && rm -f "$l"
done
-"$HERE/tools/themes.sh" "$ROOT"
+# every edition, for chamesle-desktop: what jiggity installs on the netinst, and sudo chamesle-desktop later
+ED_DIR=$ROOT/usr/share/chamesle/editions; mkdir -p "$ED_DIR"
+cp -a "$HERE"/editions/* "$ED_DIR/"
+ls "$HERE/overlay/etc/dinit.d/boot.d" > "$ED_DIR/services"
# the installer's slideshow starts with this edition's desktop (the website's picture of it) and how to get around
SLIDES=$ROOT/usr/share/live-installer/slideshow
SHOT=; for e in $EDITION $BASE; do [ -z "$SHOT" ] && [ -f "$HERE/docs/img/$e.png" ] && SHOT=$HERE/docs/img/$e.png; done
@@ -120,6 +145,11 @@ ln -sf /usr/share/zoneinfo/UTC "$ROOT/etc/localtime"
"$IN" "$ROOT" /usr/bin/fc-cache -f
"$IN" "$ROOT" /usr/bin/gtk-update-icon-cache -q -f /usr/share/icons/hicolor 2>/dev/null || true
+if [ "$NETINST" = yes ]; then
+# no live session: every boot entry is jiggity on tty1
+rm -f "$ROOT/etc/dinit.d/boot.d/display-manager"
+mkdir -p "$ROOT/etc/chamesle"; echo console > "$ROOT/etc/chamesle/login"
+else
echo "=== [3/5] THE LIVE USER"
# live user: no password, autologin, sudo. the installer removes all that
"$IN" "$ROOT" /usr/bin/useradd -m -c "Live session" -s /bin/bash -G wheel,audio,video,input,network,storage,optical,scanner,lp,plugdev,users live
@@ -174,6 +204,7 @@ if [ -n "$GNOME_LOOK" ]; then
rm -rf "$ROOT/tmp/live-dconf"
fi
"$IN" "$ROOT" /usr/bin/chown -R live:live /home/live
+fi
rm -f "$ROOT/etc/machine-id" "$ROOT/var/lib/dbus/machine-id"
rm -rf "$ROOT/var/cache/apk"/*
@@ -239,6 +270,21 @@ submenu "More options" {
}
}
EOF
+if [ "$NETINST" = yes ]; then
+ # no live session to try: install, nothing else. no drivers that need firmware the iso hasn't got: the
+ # firmware's own screen does for text
+ sed -i '/^# two choices/,$d' "$ISO_DIR/boot/grub/grub.cfg"
+ cat >> "$ISO_DIR/boot/grub/grub.cfg" <<'EOF'
+menuentry "Install Chamesle" {
+ linux /live/vmlinuz chamesle.install=1 modprobe.blacklist=amdgpu,radeon,nouveau,xe quiet loglevel=3
+ initrd /live/initrd.img
+}
+menuentry "Install Chamesle (show boot messages)" {
+ linux /live/vmlinuz chamesle.install=1 modprobe.blacklist=amdgpu,radeon,nouveau,xe loglevel=4 console=tty0 console=ttyS0,115200
+ initrd /live/initrd.img
+}
+EOF
+fi
"$GRUB_MKRESCUE" -o "$ISO" "$ISO_DIR" -volid CHAMESLE
(cd "$OUT" && sha256sum "$(basename "$ISO")" > "$(basename "$ISO").sha256")
ls -lh "$ISO"
diff --git a/editions/base.packages b/editions/base.packages
@@ -31,6 +31,9 @@ sof-firmware alsa-ucm-conf
flatpak xdg-desktop-portal xdg-user-dirs firefox
noto-fonts-ttf noto-fonts-emoji dejavu-fonts-ttf
+# the fluent theme and icons
+chamesle-fluent
+
# toolchain for get
gcc make pkg-config cmake meson ninja perl python3 autoconf automake libtool patch bison flex git
diff --git a/editions/netinst/edition b/editions/netinst/edition
@@ -0,0 +1,5 @@
+name=Setup
+# the one iso: jiggity in text, it installs the desktop you pick from the repo (chamesle-desktop)
+netinst=yes
+login=console
+desktop-packages=no
diff --git a/editions/netinst/firmware b/editions/netinst/firmware
@@ -0,0 +1,4 @@
+# what of /usr/lib/firmware is on the iso, so wi-fi and ethernet work while installing. the installed system gets
+# all of it. iwlwifi keeps the 3 newest of each chip
+intel/iwlwifi ath9k_htc ath10k ath11k/WCN6855 ath11k/QCA6390 ath12k/WCN7850 mediatek rtw88 rtw89 rtlwifi rtl_nic
+brcm cypress
diff --git a/editions/netinst/overlay/etc/dinit.d/getty-tty1 b/editions/netinst/overlay/etc/dinit.d/getty-tty1
@@ -0,0 +1,8 @@
+# text login on tty1, with jiggity's text screens first when they're needed
+type = process
+command = /usr/lib/chamesle/console-getty
+depends-on = system-identity
+waits-for = console-setup
+waits-for = plymouth-quit
+restart = true
+smooth-recovery = true
diff --git a/editions/netinst/packages b/editions/netinst/packages
@@ -0,0 +1,20 @@
+# the netinst: just enough to run jiggity and get online. the desktop and the rest come from the repo while it
+# installs, linux-firmware too: only the wi-fi and ethernet firmware in ./firmware is on the iso
+
+# core system
+base-files bash coreutils findutils diffutils grep sed gawk which file less
+gzip bzip2 xz zstd tar
+util-linux shadow procps-ng psmisc kmod eudev dbus elogind polkit dinit busybox apk-tools plymouth chamesle-plymouth
+iproute2 iputils NetworkManager wpa_supplicant curl ca-certificates rsync
+sudo nano tzdata ncurses kbd
+
+# kernel, microcode
+chamesle-kernel-cachyos intel-ucode
+
+# disks, filesystems, boot
+chamesle-grub grub grub-x86_64-efi grub-i386-efi efibootmgr os-prober
+e2fsprogs dosfstools ntfs-3g exfatprogs btrfs-progs xfsprogs cryptsetup lvm2 gptfdisk parted
+
+# jiggity in text, dracut for the installed system
+python3 python3-parted xkeyboard-config dracut
+
diff --git a/overlay/usr/bin/chamesle-desktop b/overlay/usr/bin/chamesle-desktop
@@ -0,0 +1,75 @@
+#!/bin/sh
+# chamesle-desktop NAME: puts one of chamesle's desktops on this system, the same one its iso used to have
+# chamesle-desktop the list
+# sudo chamesle-desktop kde
+# jiggity runs it in the new system while it installs. CHAMESLE_PROGRESS=FD gets apk's progress
+set -eu
+D=/usr/share/chamesle/editions
+
+if [ $# = 0 ]; then
+ for e in "$D"/*/edition; do
+ e=${e%/edition}; e=${e##*/}
+ [ "$e" = netinst ] || printf '%-10s %s\n' "$e" "$(sed -n 's/^name=//p' "$D/$e/edition")"
+ done
+ exit 0
+fi
+ED=$1
+[ -f "$D/$ED/packages" ] && [ "$ED" != netinst ] || { echo "chamesle-desktop: no desktop '$ED' (chamesle-desktop lists them)" >&2; exit 1; }
+[ "$(id -u)" = 0 ] || { echo "chamesle-desktop: needs root: sudo chamesle-desktop $ED" >&2; exit 1; }
+BASE=$(sed -n 's/^base=//p' "$D/$ED/edition")
+EDS="$BASE $ED"
+val() { for e in $ED $BASE; do v=$(sed -n "s/^$1=//p" "$D/$e/edition"); [ -n "$v" ] && { echo "$v"; return; }; done; return 0; }
+NAME=$(sed -n 's/^name=//p' "$D/$ED/edition")
+
+BASEPKGS=$D/base.packages; [ "$(val desktop-packages)" = no ] && BASEPKGS=
+pkgs=$(sed 's/#.*//' $BASEPKGS $(for e in $EDS; do echo "$D/$e/packages"; done) | tr ' \t' '\n\n' | grep -v '^$' | sort -u)
+echo "chamesle-desktop: $NAME, $(echo "$pkgs" | wc -l) packages and what they need"
+prog=; [ -n "${CHAMESLE_PROGRESS:-}" ] && prog="--progress-fd $CHAMESLE_PROGRESS"
+# the netinst came without most of the firmware: all of it, now that there's a disk to put it on
+if [ -s /etc/chamesle/trimmed ]; then
+ apk fix --no-interactive $prog --reinstall $(cat /etc/chamesle/trimmed)
+ rm /etc/chamesle/trimmed
+fi
+apk add --no-interactive $prog '!runit' '!runit-void' $pkgs
+
+fp=$(val flatpaks)
+if [ -n "$fp" ]; then
+ echo "chamesle-desktop: $fp from flathub"
+ flatpak remote-add --system --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
+ flatpak install --system -y --noninteractive flathub $fp
+fi
+
+for e in $EDS; do [ -d "$D/$e/overlay" ] && cp -a "$D/$e/overlay/." /; done
+# services: on for what's installed now, off for what isn't (the server has no bluetooth or printing)
+for s in $(cat "$D/services"); do
+ [ -f /etc/dinit.d/$s ] || continue
+ ok=1
+ for c in $(sed -n 's/^command *= *//p' /etc/dinit.d/$s); do
+ case $c in /*) [ -e "$c" ] || ok=;; esac
+ done
+ if [ -n "$ok" ]; then ln -sfn ../$s /etc/dinit.d/boot.d/$s; else rm -f /etc/dinit.d/boot.d/$s; fi
+done
+# xfce's stock wallpapers -> ours, for monitors xfce4-desktop.xml doesn't name
+if [ -d /usr/share/backgrounds/xfce ]; then
+ for f in xfce-x.svg xfce-shapes.svg xfce-stripes.png xfce-teal.png xfce-verticals.png; do
+ ln -sf ../chamesle/default.png /usr/share/backgrounds/xfce/$f
+ done
+fi
+# the windows key opens the start menu
+KS=/etc/xdg/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml
+if [ -f "$KS" ] && ! grep -q xfce4-popup-whiskermenu "$KS"; then
+ sed -i 's|^\( *\)<property name="<Super>e" type="string" value="thunar"/>|&\n\1<property name="Super_L" type="string" value="xfce4-popup-whiskermenu"/>|' "$KS"
+fi
+
+# what starts: a sign-in screen and the edition's session, or the console
+SESSION=$(val installed-session); [ -n "$SESSION" ] || SESSION=$(val session); SESSION=${SESSION:-${BASE:-$ED}}
+LOGIN=$(val login); LOGIN=${LOGIN:-sddm}
+mkdir -p /etc/chamesle
+echo "$SESSION" > /etc/chamesle/session
+echo "$LOGIN" > /etc/chamesle/login
+[ "$LOGIN" = console ] && rm -f /etc/dinit.d/boot.d/display-manager
+echo "$ED" > /usr/share/chamesle/edition
+sed -i "s/^PRETTY_NAME=\"\(Chamesle Linux [^(]*\)(.*)\"/PRETTY_NAME=\"\1($NAME)\"/; s/^VARIANT=.*/VARIANT=\"$NAME\"/; s/^VARIANT_ID=.*/VARIANT_ID=$ED/" /etc/os-release
+fc-cache -f >/dev/null 2>&1 || true
+gtk-update-icon-cache -q -f /usr/share/icons/hicolor 2>/dev/null || true
+echo "chamesle-desktop: $NAME is on, it starts after a restart"
diff --git a/overlay/usr/lib/chamesle/console-setup b/overlay/usr/lib/chamesle/console-setup
@@ -1,4 +1,4 @@
#!/bin/sh
# what console-getty runs instead of login: jiggity's text screens
-export TERM=linux LANG=en_US.UTF-8
+export TERM=linux LANG=C.UTF-8
exec /usr/bin/python3 /usr/lib/jiggity/text.py "$1"
diff --git a/overlay/usr/lib/jiggity/account.py b/overlay/usr/lib/jiggity/account.py
@@ -37,35 +37,52 @@ def bad_username(u):
return ""
-def make(zone, user, name, pw):
- groups = [g.split(":")[0] for g in open("/etc/group")]
- subprocess.run(["useradd", "-m", "-s", "/bin/bash", "-c", name, "-G",
- ",".join(g for g in GROUPS if g in groups), user])
- subprocess.run(["chpasswd", "-c", "SHA512"], input="%s:%s\n" % (user, pw), text=True)
- subprocess.run(["ln", "-sf", "/usr/share/zoneinfo/" + zone, "/etc/localtime"])
- with open("/etc/timezone", "w") as f:
+def make(zone, user, name, pw, host=None, root="/"):
+ # root: the new system, when jiggity makes the account while it installs
+ r = root.rstrip("/")
+ inside = [] if root == "/" else ["chroot", root]
+ groups = [g.split(":")[0] for g in open(r + "/etc/group")]
+ subprocess.run(inside + ["useradd", "-m", "-s", "/bin/bash", "-c", name, "-G",
+ ",".join(g for g in GROUPS if g in groups), user])
+ subprocess.run(inside + ["chpasswd", "-c", "SHA512"], input="%s:%s\n" % (user, pw), text=True)
+ subprocess.run(["ln", "-sf", "/usr/share/zoneinfo/" + zone, r + "/etc/localtime"])
+ with open(r + "/etc/timezone", "w") as f:
f.write(zone + "\n")
- host = re.sub(r"[^a-z0-9-]", "", user.lower())[:20] + "-pc"
- with open("/etc/hostname", "w") as f:
+ host = host or hostname_from(user)
+ with open(r + "/etc/hostname", "w") as f:
f.write(host + "\n")
- with open("/etc/hosts", "w") as f:
+ with open(r + "/etc/hosts", "w") as f:
f.write("127.0.0.1\tlocalhost\n127.0.1.1\t%s\n::1\tlocalhost ip6-localhost ip6-loopback\n" % host)
- subprocess.run(["hostname", host])
- remember_session(user)
- os.unlink(MARK)
+ if root == "/":
+ subprocess.run(["hostname", host])
+ remember_session(user, r)
+ if os.path.exists(r + MARK):
+ os.unlink(r + MARK)
+
+
+def hostname_from(user):
+ return re.sub(r"[^a-z0-9-]", "", user.lower())[:20] + "-pc"
+
+
+# what's wrong with a computer name, or ""
+def bad_hostname(h):
+ if not re.fullmatch(r"[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?", h or ""):
+ return "A computer name is lowercase letters, numbers and dashes."
+ return ""
# sddm lists wayland sessions first and would pick one (xfce's isn't ready): the edition's own session is the
# last one used, so it's the one that starts
-def remember_session(user):
+def remember_session(user, r=""):
try:
- name = open("/etc/chamesle/session").read().strip()
+ name = open(r + "/etc/chamesle/session").read().strip()
except OSError:
return
for d in ("/usr/share/xsessions", "/usr/share/wayland-sessions"):
path = "%s/%s.desktop" % (d, name)
- if os.path.exists(path) and os.path.isdir("/var/lib/sddm"):
- with open("/var/lib/sddm/state.conf", "w") as f:
+ if os.path.exists(r + path) and os.path.isdir(r + "/var/lib/sddm"):
+ with open(r + "/var/lib/sddm/state.conf", "w") as f:
f.write("[Last]\nSession=%s\nUser=%s\n" % (path, user))
- subprocess.run(["chown", "sddm:sddm", "/var/lib/sddm/state.conf"], stderr=subprocess.DEVNULL)
+ subprocess.run((["chroot", r] if r else []) + ["chown", "sddm:sddm", "/var/lib/sddm/state.conf"],
+ stderr=subprocess.DEVNULL)
return
diff --git a/overlay/usr/lib/jiggity/install.py b/overlay/usr/lib/jiggity/install.py
@@ -1,9 +1,13 @@
-# progress(step, percent): 0 partition, 1 copy, 2 configure, 3 bootloader, 4 cleanup
+# progress(step, percent): 0 partition, 1 copy, 2 configure, 3 bootloader, 4 cleanup.
+# the netinst puts the desktop in after the copy: 2 desktop, and the rest one later
import glob
import os
+import shutil
import subprocess
+import sys
import time
+import account
import disks
from disks import run
@@ -39,8 +43,11 @@ def set_grub(key, value):
f.write("\n".join(lines).rstrip("\n") + "\n")
-def install(row, passphrase, language, keyboard, progress):
+def install(row, passphrase, language, keyboard, progress, desktop=None, user=None):
os.makedirs(T, exist_ok=True)
+ if desktop:
+ step = progress
+ progress = lambda n, pc: step(n + (n >= 2), pc)
progress(0, 0)
plan = disks.make(row, passphrase is not None)
progress(0, 40)
@@ -92,9 +99,13 @@ def install(row, passphrase, language, keyboard, progress):
run("rm", "-rf", T + path)
if os.path.exists(T + "/etc/gdm/custom.conf"):
run("sed", "-i", "/^# the live session only$/d; /^AutomaticLogin/d", T + "/etc/gdm/custom.conf")
- chroot("userdel", "-r", "live")
+ if "\nlive:" in "\n" + open(T + "/etc/passwd").read():
+ chroot("userdel", "-r", "live")
chroot("passwd", "-dl", "root")
- open(T + "/etc/chamesle/firstboot", "w").close()
+ if desktop:
+ add_desktop(desktop, step)
+ else:
+ open(T + "/etc/chamesle/firstboot", "w").close()
progress(2, 30)
with open(T + "/etc/fstab", "w") as f:
@@ -129,6 +140,8 @@ def install(row, passphrase, language, keyboard, progress):
' Option "XkbLayout" "%s"\n Option "XkbVariant" "%s"\nEndSection\n' % (layout, variant or ""))
with open(T + "/etc/vconsole.conf", "w") as f:
f.write("KEYMAP=%s\n" % (layout + ("-" + variant if variant else "")))
+ if user:
+ account.make(user["zone"], user["user"], user["name"], user["password"], user["host"], T)
progress(2, 100)
if passphrase is not None:
@@ -166,3 +179,28 @@ def install(row, passphrase, language, keyboard, progress):
if passphrase is not None:
subprocess.run(["cryptsetup", "close", "chamesle"])
progress(4, 100)
+
+
+# the netinst: the desktop from the repo, with apk's progress. the wi-fi jiggity connected to comes along
+def add_desktop(desktop, step):
+ step(2, 0)
+ shutil.copy("/etc/resolv.conf", T + "/etc/resolv.conf")
+ nm = "/etc/NetworkManager/system-connections"
+ if os.path.isdir(nm):
+ os.makedirs(T + nm, exist_ok=True)
+ for f in os.listdir(nm):
+ shutil.copy2(os.path.join(nm, f), T + nm)
+ r, w = os.pipe()
+ print("jiggity: chamesle-desktop", desktop)
+ p = subprocess.Popen(["chroot", T, "/usr/bin/env", "CHAMESLE_PROGRESS=%d" % w, "/usr/bin/chamesle-desktop", desktop],
+ pass_fds=(w,), stdout=sys.stderr, stderr=sys.stderr)
+ os.close(w)
+ with os.fdopen(r) as f:
+ for line in f:
+ done, _, total = line.strip().partition("/")
+ if done.isdigit() and total.isdigit() and int(total):
+ step(2, min(99, int(done) * 100 // int(total)))
+ if p.wait():
+ raise RuntimeError("installing the desktop failed, check the internet connection")
+ shutil.copy("/usr/share/chamesle/repositories", T + "/etc/apk/repositories")
+ step(2, 100)
diff --git a/overlay/usr/lib/jiggity/text.py b/overlay/usr/lib/jiggity/text.py
@@ -1,12 +1,15 @@
#!/usr/bin/python3
# jiggity in text, for editions without a desktop: blue like windows setup used to be
-# text.py install from the usb's Install entry
+# text.py install from the usb's Install entry. on the netinst it asks everything, then installs
# text.py firstboot the first start: time zone, network, account
import curses
+import locale
import os
+import re
import subprocess
import sys
import threading
+import time
sys.path.insert(0, "/usr/lib/jiggity")
import account
@@ -129,7 +132,286 @@ def yes(title, note):
return False
+def netinst():
+ try:
+ return open("/usr/share/chamesle/edition").read().strip() == "netinst"
+ except OSError:
+ return False
+
+
+# what the netinst offers: the editions, the way the website lists them
+DESKTOPS = [
+ ("xfce", "Light and quick, set up like Windows. The one to start with."),
+ ("mate", "Very light and rock solid, for older machines."),
+ ("cinnamon", "Linux Mint's desktop, the most polished Windows-style one."),
+ ("gnome", "Modern and clean, with an overview of your windows and a dock."),
+ ("kde", "Familiar at first, and you can change almost anything about it."),
+ ("astro", "GNOME with the sky apps: Stellarium, KStars, Siril and Gpredict."),
+ ("ranni", "KDE Plasma set up to feel like a Mac."),
+ ("play", "KDE Plasma for games, with Steam, GameMode and controllers."),
+ ("tty", "The console, with floating windows on top, on ttywm."),
+ ("server", "No desktop. SSH is on from the first start."),
+]
+
+
+def edition_name(e):
+ try:
+ for line in open("/usr/share/chamesle/editions/%s/edition" % e):
+ if line.startswith("name="):
+ return line[5:].strip()
+ except OSError:
+ pass
+ return e
+
+
+def nm(*args):
+ return subprocess.run(["nmcli"] + list(args), text=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+
+
+def wifi_list():
+ r = subprocess.run(["nmcli", "-t", "-f", "SSID,SIGNAL,SECURITY", "device", "wifi", "list", "--rescan", "yes"],
+ text=True, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)
+ seen, out = set(), []
+ for line in r.stdout.splitlines():
+ f = re.split(r"(?<!\\):", line)
+ if len(f) < 3 or not f[0] or f[0] in seen:
+ continue
+ seen.add(f[0])
+ out.append((f[0].replace("\\:", ":"), int(f[1] or 0), f[2]))
+ return sorted(out, key=lambda n: -n[1])
+
+
+# online by cable, or by the wi-fi picked here. False for esc
+def network():
+ while True:
+ frame("Connecting to the internet", "")
+ text(5, "Looking for a connection...")
+ scr.refresh()
+ for _ in range(10):
+ if account.online():
+ say("Connected", "Chamesle is online, so it can download the desktop you pick.")
+ return True
+ time.sleep(0.5)
+ nets = wifi_list()
+ items = ["%-40s %3d%%%s" % (n[:40], sig, " locked" if sec else "") for n, sig, sec in nets]
+ items += ["Look again", "I plugged in a cable"]
+ i = choose("Connecting to the internet", "Chamesle downloads your desktop while it installs, so it needs the "
+ "internet. Plug in a cable, or pick your Wi-Fi.", items)
+ if i is None:
+ return False
+ if i >= len(nets):
+ continue
+ ssid, sig, sec = nets[i]
+ cmd = ["device", "wifi", "connect", ssid]
+ if sec:
+ pw = ask("Connecting to %s" % ssid, "", "Wi-Fi password:", True)
+ if pw is None:
+ continue
+ cmd += ["password", pw]
+ frame("Connecting to %s" % ssid, "")
+ text(5, "Connecting...")
+ scr.refresh()
+ if nm(*cmd).returncode:
+ say("Couldn't connect to %s" % ssid, "Check the password and try again.")
+
+
+def run_netinst():
+ kbds = keyboards()
+ us = next((i for i, k in enumerate(kbds) if k[1] == "us" and not k[2]), 0)
+ zs = account.zones()
+ zone_names = [z.replace("_", " ").replace("/", " / ") for z in zs]
+ c = {"lang": 0, "kb": us, "zone": zs.index("Europe/London") if "Europe/London" in zs else 0, "name": "",
+ "user": "", "pw": "", "host": "", "row": None, "passphrase": None, "desktop": 0}
+
+ def p_lang():
+ i = choose("Language to install", "", [ENGLISH.get(code, n) for n, code in LANGUAGES], c["lang"])
+ if i is None:
+ return False
+ c["lang"] = i
+ return True
+
+ def p_keyboard():
+ i = choose("Keyboard", "", [k[0] for k in kbds], c["kb"])
+ if i is None:
+ return False
+ c["kb"] = i
+ layout, variant = kbds[i][1:]
+ subprocess.run(["loadkeys", layout + ("-" + variant if variant else "")], stdout=subprocess.DEVNULL,
+ stderr=subprocess.DEVNULL)
+ return True
+
+ def p_zone():
+ i = choose("Your time zone", "It sets your clock. Type a city to find yours.", zone_names, c["zone"])
+ if i is None:
+ return False
+ c["zone"] = i
+ return True
+
+ def p_you():
+ name = ask("Who's going to use this PC?", "", "Your name:", value=c["name"])
+ if name is None:
+ return False
+ while True:
+ user = ask("Who's going to use this PC?", "Lowercase letters and numbers, starting with a letter.",
+ "Username:", value=c["user"] or account.username_from(name))
+ if user is None:
+ return False
+ bad = account.bad_username(user)
+ if user and not bad:
+ break
+ say("Who's going to use this PC?", bad or "Pick a username.")
+ while True:
+ pw = ask("Who's going to use this PC?", "", "Password:", True)
+ if pw is None:
+ return False
+ if not pw:
+ continue
+ if ask("Who's going to use this PC?", "Type it again.", "Confirm: ", True) == pw:
+ break
+ say("Who's going to use this PC?", "The passwords don't match.")
+ while True:
+ host = ask("Name this computer", "How it shows up to other computers on the network.",
+ "Computer name:", value=c["host"] or account.hostname_from(user))
+ if host is None:
+ return False
+ bad = account.bad_hostname(host)
+ if not bad:
+ break
+ say("Name this computer", bad)
+ c.update(name=name, user=user, pw=pw, host=host)
+ return True
+
+ def p_disk():
+ while True:
+ rows = disks.scan()
+ if not rows:
+ say("No drives found", "Check that the drive is connected, then press ENTER to look again.")
+ continue
+ items = []
+ for r in rows:
+ free = " %s free" % disks.size_text(r.free) if r.kind != "drive" else ""
+ items.append("%s%-40s %9s%s %s" % ("" if r.kind == "drive" else " ", r.label[:40],
+ disks.size_text(r.total), free, r.type_text))
+ off = [i for i, r in enumerate(rows) if not r.usable]
+ first = next((i for i in range(len(rows)) if i not in off), 0)
+ i = choose("Where do you want to install Chamesle?",
+ "Pick a drive to use all of it, or its unallocated space to keep what's on it. Chamesle needs "
+ "at least %s. Nothing changes until the last step." % disks.size_text(disks.MIN_SIZE),
+ items, first, off)
+ if i is None:
+ return False
+ c["row"] = rows[i]
+ break
+ c["passphrase"] = None
+ if yes("Encrypt Chamesle?", "With a passphrase you type every time the computer starts. If you forget it, "
+ "your files can't be recovered."):
+ while True:
+ p1 = ask("Encrypt Chamesle", "At least 8 characters.", "Passphrase:", True)
+ if p1 is None:
+ break
+ if len(p1) < 8:
+ say("Encrypt Chamesle", "The passphrase needs at least 8 characters.")
+ continue
+ if ask("Encrypt Chamesle", "Type it again.", "Confirm: ", True) != p1:
+ say("Encrypt Chamesle", "The passphrases don't match.")
+ continue
+ c["passphrase"] = p1
+ break
+ return True
+
+ def p_desktop():
+ items = ["%-12s %s" % (edition_name(e), d) for e, d in DESKTOPS]
+ i = choose("Pick your desktop", "You can add another one later with: sudo chamesle-desktop NAME", items,
+ c["desktop"])
+ if i is None:
+ return False
+ c["desktop"] = i
+ return True
+
+ def p_summary():
+ row = c["row"]
+ where = ("all of %s (everything on it is erased)" % row.label.split(":")[0] if row.kind == "drive"
+ else "the unallocated space on %s" % row.label.split(":")[0])
+ lines = [("Language", ENGLISH.get(LANGUAGES[c["lang"]][1], LANGUAGES[c["lang"]][0])),
+ ("Keyboard", kbds[c["kb"]][0]), ("Time zone", zone_names[c["zone"]]),
+ ("You", "%s (%s)" % (c["name"] or c["user"], c["user"])), ("Computer name", c["host"]),
+ ("Install on", where), ("Encrypted", "yes" if c["passphrase"] else "no"),
+ ("Desktop", edition_name(DESKTOPS[c["desktop"]][0]))]
+ while True:
+ frame("Ready to install", "ENTER=Install ESC=Back")
+ y = text(5, "Check this. When you press ENTER, Chamesle installs and the disk is changed. It needs nothing "
+ "more from you until it's done.")
+ for k, v in lines:
+ scr.addstr(y, 6, "%-15s %s" % (k + ":", v))
+ y += 1
+ scr.refresh()
+ k = scr.get_wch()
+ if k in ("\n", curses.KEY_ENTER):
+ return True
+ if k == "\x1b":
+ return False
+
+ pages = [p_lang, p_keyboard, network, p_zone, p_you, p_disk, p_desktop, p_summary]
+ n = 0
+ while n < len(pages):
+ if pages[n]():
+ n += 1
+ else:
+ n = max(0, n - 1)
+
+ desktop = DESKTOPS[c["desktop"]][0]
+ user = {"zone": zs[c["zone"]], "user": c["user"], "name": c["name"], "password": c["pw"], "host": c["host"]}
+ steps = STEPS[:2] + ["Downloading and installing %s" % edition_name(desktop)] + STEPS[2:]
+ work(steps, c["row"], c["passphrase"], LANGUAGES[c["lang"]][1], kbds[c["kb"]][1:], desktop, user)
+ say("Chamesle is installed", "Take out the USB stick, then press ENTER to restart into your new %s desktop."
+ % edition_name(desktop) if desktop != "server" else
+ "Take out the USB stick, then press ENTER to restart. Sign in with your username, or over SSH.")
+ subprocess.run(["reboot"])
+
+
+# installs with a screen of steps. returns when it's done, or says what went wrong and restarts
+def work(steps, row, passphrase, language, keyboard, desktop=None, user=None):
+ state = {"step": 0, "percent": 0, "error": None, "done": False}
+
+ def go():
+ try:
+ install.install(row, passphrase, language, keyboard, progress=progress, desktop=desktop, user=user)
+ except Exception as e:
+ print("jiggity: the installation failed:", e, file=sys.stderr)
+ state["error"] = str(e)
+ state["done"] = True
+
+ def progress(step, percent):
+ state["step"], state["percent"] = step, percent
+
+ threading.Thread(target=go, daemon=True).start()
+ scr.timeout(500)
+ while not state["done"]:
+ frame("Installing Chamesle", "Please wait")
+ for i, s in enumerate(steps):
+ if i < state["step"] or (i == state["step"] and state["percent"] >= 100):
+ line = "[x] " + s
+ elif i == state["step"]:
+ line = "[ ] " + s + (" (%d%%)" % state["percent"] if s.startswith(("Copying", "Downloading")) else "...")
+ else:
+ line = "[ ] " + s
+ scr.addstr(6 + i, 6, line, curses.A_BOLD if i == state["step"] else 0)
+ scr.refresh()
+ try:
+ scr.get_wch()
+ except curses.error:
+ pass
+ scr.timeout(-1)
+ if state["error"]:
+ say("Chamesle couldn't be installed", "%s. The details are in /var/log/jiggity.log. Press ENTER to restart."
+ % state["error"].rstrip("."))
+ subprocess.run(["reboot"])
+ sys.exit(1)
+
+
def run_install():
+ if netinst():
+ return run_netinst()
lang = choose("Language to install", "", [ENGLISH.get(c, n) for n, c in LANGUAGES])
if lang is None:
lang = 0
@@ -177,43 +459,9 @@ def run_install():
passphrase = p1
break
- state = {"step": 0, "percent": 0, "error": None, "done": False}
-
- def work():
- try:
- install.install(row, passphrase, LANGUAGES[lang][1], kbds[kb][1:], progress=progress)
- except Exception as e:
- print("jiggity: the installation failed:", e, file=sys.stderr)
- state["error"] = str(e)
- state["done"] = True
-
- def progress(step, percent):
- state["step"], state["percent"] = step, percent
-
- threading.Thread(target=work, daemon=True).start()
- scr.timeout(500)
- while not state["done"]:
- frame("Installing Chamesle", "Please wait")
- for i, s in enumerate(STEPS):
- if i < state["step"] or (i == state["step"] and state["percent"] >= 100):
- line = "[x] " + s
- elif i == state["step"]:
- line = "[ ] " + s + (" (%d%%)" % state["percent"] if i == 1 else "...")
- else:
- line = "[ ] " + s
- scr.addstr(6 + i, 6, line, curses.A_BOLD if i == state["step"] else 0)
- scr.refresh()
- try:
- scr.get_wch()
- except curses.error:
- pass
- scr.timeout(-1)
- if state["error"]:
- say("Chamesle couldn't be installed", "%s. The details are in /var/log/jiggity.log. Press ENTER to restart."
- % state["error"].rstrip("."))
- else:
- say("Chamesle needs to restart to continue", "Take out the USB stick when the screen goes dark. After the "
- "restart you'll set up your account. Press ENTER to restart.")
+ work(STEPS, row, passphrase, LANGUAGES[lang][1], kbds[kb][1:])
+ say("Chamesle needs to restart to continue", "Take out the USB stick when the screen goes dark. After the "
+ "restart you'll set up your account. Press ENTER to restart.")
subprocess.run(["reboot"])
@@ -271,5 +519,6 @@ if __name__ == "__main__":
log = open("/var/log/jiggity.log", "a", buffering=1)
os.dup2(log.fileno(), 2)
sys.stdout = sys.stderr = log
+ locale.setlocale(locale.LC_ALL, "")
curses.set_escdelay(25)
curses.wrapper(main)
diff --git a/tools/initrd/build-initrd.sh b/tools/initrd/build-initrd.sh
@@ -62,7 +62,7 @@ if [ -x "$ROOT/usr/bin/plymouthd" ]; then
[ -n "$theme" ] && cp -a "$ROOT/usr/share/plymouth/themes/$theme" "$R/usr/share/plymouth/themes/"
# a font for the passphrase prompt
cp -a "$ROOT/etc/fonts" "$R/etc/" 2>/dev/null || true
- font=$(find "$ROOT/usr/share/fonts" -name DejaVuSans.ttf | head -n1)
+ font=$(find "$ROOT/usr/share/fonts" -name DejaVuSans.ttf 2>/dev/null | head -n1 || true)
[ -n "$font" ] && install -Dm644 "$font" "$R/usr/share/fonts/DejaVuSans.ttf"
fi
diff --git a/tools/pkg/chamesle-fluent/recipe b/tools/pkg/chamesle-fluent/recipe
@@ -0,0 +1,14 @@
+name=chamesle-fluent
+version=2026.07.27
+rel=0
+desc="Fluent GTK and Xfwm4 themes and Fluent icons (vinceliuice), the look every Chamesle desktop uses"
+url=https://github.com/vinceliuice/Fluent-gtk-theme
+license=GPL-3.0-or-later
+source=
+makedeps=""
+depends=""
+# files/ isn't in git: tools/themes.sh tools/pkg/chamesle-fluent/files makes it
+
+build() {
+ cp -a . "$pkgdir/"
+}