chamesle

chamesle.org: the site of Chamesle, a small Linux distribution
git clone https://github.com/tortr-rs/chamesle
Log | Files | Refs | README

commit 2967830af13d55da38f2e8f03639f49e0c2f8d5e
parent 45329394e8273de2554eb914bd5745e3a03c2700
Author: torter <koubbamohamedrayan@gmail.com>
Date:   Wed, 21 Oct 2026 02:47:17 +0000

real logo, boot splash, apk repo tools, website

Diffstat:
Aartwork/cutout.py | 94+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aartwork/logo.jpeg | 0
Aartwork/logo.png | 0
Martwork/render.sh | 26++++++++++++++++++--------
Dartwork/start.svg | 11-----------
Mbuild.sh | 10+++++++---
Adocs/CNAME | 1+
Adocs/img/logo.png | 0
Adocs/img/xfce.png | 0
Adocs/index.html | 89+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Adocs/style.css | 125+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Meditions/base.packages | 2+-
Akeys/apk/chamesle-20261021.rsa.pub | 14++++++++++++++
Moverlay/etc/dinit.d/display-manager | 1+
Moverlay/etc/dinit.d/getty-tty1 | 1+
Aoverlay/etc/dinit.d/plymouth-quit | 4++++
Aoverlay/etc/plymouth/plymouthd.conf | 4++++
Aoverlay/usr/share/icons/hicolor/128x128/apps/chamesle-start.png | 0
Aoverlay/usr/share/icons/hicolor/16x16/apps/chamesle-start.png | 0
Aoverlay/usr/share/icons/hicolor/24x24/apps/chamesle-start.png | 0
Aoverlay/usr/share/icons/hicolor/256x256/apps/chamesle-start.png | 0
Aoverlay/usr/share/icons/hicolor/32x32/apps/chamesle-start.png | 0
Aoverlay/usr/share/icons/hicolor/48x48/apps/chamesle-start.png | 0
Aoverlay/usr/share/icons/hicolor/64x64/apps/chamesle-start.png | 0
Doverlay/usr/share/icons/hicolor/scalable/apps/chamesle-start.svg | 11-----------
Aoverlay/usr/share/plymouth/themes/chamesle/chamesle.plymouth | 8++++++++
Aoverlay/usr/share/plymouth/themes/chamesle/chamesle.script | 33+++++++++++++++++++++++++++++++++
Aoverlay/usr/share/plymouth/themes/chamesle/logo.png | 0
Mtools/initrd/build-initrd.sh | 23+++++++++++++++++++++++
Mtools/initrd/init | 24+++++++++++++++++++++++-
Atools/repo/build-repo.sh | 73+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Atools/repo/xbps2apk.py | 103+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
32 files changed, 622 insertions(+), 35 deletions(-)

diff --git a/artwork/cutout.py b/artwork/cutout.py @@ -0,0 +1,94 @@ +#!/usr/bin/env python3 +# makes the white around the logo transparent, then crops it square +# usage: cutout.py in.png out.png (8-bit rgb/rgba png) +import struct, sys, zlib +from collections import deque + + +def read_png(path): + data = open(path, 'rb').read() + pos, idat = 8, b'' + while pos < len(data): + n, kind = struct.unpack('>I4s', data[pos:pos + 8]) + body = data[pos + 8:pos + 8 + n] + if kind == b'IHDR': + w, h, depth, ctype = struct.unpack('>IIBB', body[:10]) + elif kind == b'IDAT': + idat += body + pos += 12 + n + bpp = 4 if ctype == 6 else 3 + raw, stride, prev, px = zlib.decompress(idat), w * bpp, bytearray(w * bpp), [] + for y in range(h): + f = raw[y * (stride + 1)] + line = bytearray(raw[y * (stride + 1) + 1:(y + 1) * (stride + 1)]) + for i in range(stride): + a = line[i - bpp] if i >= bpp else 0 + b = prev[i] + c = prev[i - bpp] if i >= bpp else 0 + if f == 1: + line[i] = (line[i] + a) & 255 + elif f == 2: + line[i] = (line[i] + b) & 255 + elif f == 3: + line[i] = (line[i] + (a + b) // 2) & 255 + elif f == 4: + p = a + b - c + pa, pb, pc = abs(p - a), abs(p - b), abs(p - c) + line[i] = (line[i] + (a if pa <= pb and pa <= pc else b if pb <= pc else c)) & 255 + prev = line + for x in range(w): + r, g, bl = line[x * bpp:x * bpp + 3] + px.append([r, g, bl, line[x * bpp + 3] if bpp == 4 else 255]) + return w, h, px + + +def write_png(path, w, h, px): + raw = b''.join(b'\0' + bytes(v for p in px[y * w:(y + 1) * w] for v in p) for y in range(h)) + def chunk(t, b): + return struct.pack('>I', len(b)) + t + b + struct.pack('>I', zlib.crc32(t + b) & 0xffffffff) + with open(path, 'wb') as f: + f.write(b'\x89PNG\r\n\x1a\n') + f.write(chunk(b'IHDR', struct.pack('>IIBBBBB', w, h, 8, 6, 0, 0, 0))) + f.write(chunk(b'IDAT', zlib.compress(raw, 9))) + f.write(chunk(b'IEND', b'')) + + +w, h, px = read_png(sys.argv[1]) +white = lambda p: min(p[:3]) >= 232 + +# flood fill from the edges, the hole and the gaps are connected to it +bg = bytearray(w * h) +q = deque(i for i in range(w * h) if (i < w or i >= w * (h - 1) or i % w in (0, w - 1)) and white(px[i])) +for i in q: + bg[i] = 1 +while q: + i = q.popleft() + x = i % w + for j in (i - 1 if x else -1, i + 1 if x < w - 1 else -1, i - w, i + w): + if 0 <= j < w * h and not bg[j] and white(px[j]): + bg[j] = 1 + q.append(j) + +for i, p in enumerate(px): + if bg[i]: + p[3] = 0 + continue + # soft edge: take the white back out of the blended pixels + if min(p[:3]) > 150 and any(0 <= j < w * h and bg[j] for j in (i - 1, i + 1, i - w, i + w)): + a = max(255 - c for c in p[:3]) / 255 + if a < 0.02: + p[3] = 0 + else: + p[:3] = [max(0, min(255, round((c - 255 * (1 - a)) / a))) for c in p[:3]] + p[3] = round(255 * a) + +xs = [i % w for i, p in enumerate(px) if p[3]] +ys = [i // w for i, p in enumerate(px) if p[3]] +x0, x1, y0, y1 = min(xs), max(xs), min(ys), max(ys) +side = int(max(x1 - x0, y1 - y0) * 1.04) + 1 +ox, oy = (side - (x1 - x0 + 1)) // 2, (side - (y1 - y0 + 1)) // 2 +out = [[0, 0, 0, 0] for _ in range(side * side)] +for y in range(y0, y1 + 1): + for x in range(x0, x1 + 1): + out[(y - y0 + oy) * side + (x - x0 + ox)] = px[y * w + x] +write_png(sys.argv[2], side, side, out) diff --git a/artwork/logo.jpeg b/artwork/logo.jpeg Binary files differ. diff --git a/artwork/logo.png b/artwork/logo.png Binary files differ. diff --git a/artwork/render.sh b/artwork/render.sh @@ -1,10 +1,20 @@ #!/bin/sh -# Render the artwork the editions ship (the PNGs are committed; run this after changing an SVG). Needs resvg. +# renders the wallpaper, logo icons and boot splash into overlay/ +# logo.png is the cut out logo (cutout.py), logo.jpeg the original set -eu -HERE=$(cd "$(dirname "$0")" && pwd) -OUT=$HERE/../overlay/usr/share -RESVG=${RESVG:-resvg} -mkdir -p "$OUT/backgrounds/chamesle" "$OUT/icons/hicolor/scalable/apps" -$RESVG -w 1920 -h 1080 "$HERE/wallpaper.svg" "$OUT/backgrounds/chamesle/default.png" -cp "$HERE/start.svg" "$OUT/icons/hicolor/scalable/apps/chamesle-start.svg" -echo "rendered into $OUT" +cd "$(dirname "$0")" +out=../overlay/usr/share +resvg=${RESVG:-resvg} + +mkdir -p $out/backgrounds/chamesle $out/plymouth/themes/chamesle +$resvg -w 1920 -h 1080 wallpaper.svg $out/backgrounds/chamesle/default.png + +tmp=$(mktemp -d) +cp logo.png $tmp/ +printf '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="512" height="512"><image width="512" height="512" xlink:href="logo.png"/></svg>\n' > $tmp/logo.svg +for s in 16 24 32 48 64 128 256; do + mkdir -p $out/icons/hicolor/${s}x$s/apps + $resvg --resources-dir $tmp -w $s -h $s $tmp/logo.svg $out/icons/hicolor/${s}x$s/apps/chamesle-start.png +done +$resvg --resources-dir $tmp -w 512 -h 512 $tmp/logo.svg $out/plymouth/themes/chamesle/logo.png +rm -rf $tmp diff --git a/artwork/start.svg b/artwork/start.svg @@ -1,11 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64"> - <!-- Chamesle start button (placeholder until the real logo): a rounded tile with a C --> - <defs> - <linearGradient id="g" x1="0" y1="0" x2="1" y2="1"> - <stop offset="0" stop-color="#22c55e"/> - <stop offset="1" stop-color="#0ea5e9"/> - </linearGradient> - </defs> - <rect x="4" y="4" width="56" height="56" rx="14" fill="url(#g)"/> - <path d="M42 22.5 A13 13 0 1 0 42 41.5" fill="none" stroke="#ffffff" stroke-width="7" stroke-linecap="round"/> -</svg> diff --git a/build.sh b/build.sh @@ -46,7 +46,7 @@ mkdir -p "$ROOT/dev" "$ROOT/proc" mount --rbind /dev "$ROOT/dev"; mount --make-rslave "$ROOT/dev"; mount -t proc proc "$ROOT/proc" trap 'umount "$ROOT/proc" 2>/dev/null; umount -lR "$ROOT/dev" 2>/dev/null; true' EXIT XBPS_ARCH=x86_64 xbps-install -S -y -r "$ROOT" -R "$REPO" -R "$REPO/nonfree" -c "$CACHE" $(packages) -umount "$ROOT/proc"; umount -lR "$ROOT/dev"; trap - EXIT +umount "$ROOT/proc" 2>/dev/null || true; umount -lR "$ROOT/dev" 2>/dev/null || true; trap - EXIT if [ -e "$ROOT/usr/bin/runit" ]; then echo "build: runit got installed; dinit must be the only init" >&2; exit 1; fi echo "=== [2/5] CHAMESLE: SERVICES, LOOK AND BRANDING" @@ -121,10 +121,14 @@ cat > "$ISO_DIR/boot/grub/grub.cfg" <<EOF set default=0 set timeout=5 insmod all_video +insmod gfxterm +set gfxmode=1280x800,1024x768,auto +set gfxpayload=keep +terminal_output gfxterm if [ ! -f /live/vmlinuz ]; then search --no-floppy --set=root --file /live/vmlinuz; fi menuentry "Try or install $TITLE" { - linux /live/vmlinuz quiet loglevel=3 + linux /live/vmlinuz quiet splash loglevel=3 initrd /live/initrd.img } menuentry "$TITLE (safe graphics)" { @@ -132,7 +136,7 @@ menuentry "$TITLE (safe graphics)" { initrd /live/initrd.img } menuentry "$TITLE (copy to RAM)" { - linux /live/vmlinuz chamesle.toram=1 quiet loglevel=3 + linux /live/vmlinuz chamesle.toram=1 quiet splash loglevel=3 initrd /live/initrd.img } menuentry "$TITLE (show boot messages)" { diff --git a/docs/CNAME b/docs/CNAME @@ -0,0 +1 @@ +chamesle.org diff --git a/docs/img/logo.png b/docs/img/logo.png Binary files differ. diff --git a/docs/img/xfce.png b/docs/img/xfce.png Binary files differ. diff --git a/docs/index.html b/docs/index.html @@ -0,0 +1,89 @@ +<!doctype html> +<html lang="en"> +<head> +<meta charset="utf-8"> +<meta name="viewport" content="width=device-width, initial-scale=1"> +<title>Chamesle Linux</title> +<meta name="description" content="A Linux desktop that gets out of your way. Xfce edition out now."> +<link rel="icon" href="img/logo.png"> +<link rel="stylesheet" href="style.css"> +</head> +<body> + +<header> + <a class="brand" href="./"><img src="img/logo.png" alt="" width="36" height="36"> Chamesle</a> + <nav> + <a href="#download">Download</a> + <a href="#packages">Packages</a> + <a href="https://github.com/tortr-rs/chamesle">Source</a> + </nav> +</header> + +<main> + +<section class="intro"> + <h1>Linux for people who just want their computer to work.</h1> + <p>Chamesle is a desktop Linux distro. You boot it, it looks like what you're used to, and you get apps from + Flathub without hunting around. If you like poking at things there's a full package manager + underneath, but you never have to touch them.</p> + <p><a class="button" href="#download">Get 0.1 "Margit"</a> <span class="small">Xfce edition, 64-bit, 1.8&nbsp;GB</span></p> +</section> + +<figure class="shot"> + <img src="img/xfce.png" alt="The Chamesle Xfce desktop: a blue wave wallpaper and a taskbar along the bottom" width="1280" height="800"> + <figcaption>The Xfce edition, right after it boots.</figcaption> +</figure> + +<section> + <h2>What you get</h2> + <p>Out of the box: Firefox, a file manager, Flathub already set up, printing, Bluetooth, + Wi-Fi, and the firmware and drivers most laptops need. An installer, an app store and a driver manager are next on the list.</p> + <p>Under the hood it uses <b>dinit</b> to start things, so it boots fast and doesn't get in your way. + There's no telemetry. There's no account to sign into.</p> +</section> + +<section> + <h2>Editions</h2> + <table> + <tr><td><b>Xfce</b></td><td>Out now. Light, and laid out like Windows: start menu bottom left, clock bottom right.</td></tr> + <tr><td>MATE</td><td>Coming. For older machines.</td></tr> + <tr><td>Cinnamon</td><td>Coming.</td></tr> + <tr><td>GNOME</td><td>Coming.</td></tr> + <tr><td>KDE Plasma</td><td>Coming.</td></tr> + </table> +</section> + +<section id="packages"> + <h2>Packages</h2> + <p>Starting with the next release, Chamesle uses <b>apk</b>:</p> +<pre><code>sudo apk update +sudo apk add gimp +sudo apk upgrade</code></pre> + <p>Packages come from our own signed repository. They're built from Void Linux's glibc packages, so there's + a lot of them.</p> +</section> + +<section id="download"> + <h2>Download</h2> + <p><a class="button" href="https://sourceforge.net/projects/chameslerepos/files/iso/">Chamesle 0.1 Xfce (x86_64)</a></p> + <p>Write it to a USB stick with <a href="https://etcher.balena.io/">Etcher</a> or + <a href="https://www.ventoy.net/">Ventoy</a>, boot from it, and you're in a live session. It doesn't touch your disk. + (There's no installer in 0.1 yet.)</p> + <p class="small">Needs a 64-bit PC, 2&nbsp;GB of RAM (4 is nicer). The live session runs from the stick. + This is an early release, so expect rough edges and tell us about them.</p> +</section> + +<section> + <h2>Help out</h2> + <p>Everything is on <a href="https://github.com/tortr-rs/chamesle">GitHub</a>. Bug reports are welcome, + and so are pull requests.</p> +</section> + +</main> + +<footer> + <p>Chamesle Linux. Packages are built from <a href="https://voidlinux.org/">Void Linux</a>; source for every package is available on request.</p> +</footer> + +</body> +</html> diff --git a/docs/style.css b/docs/style.css @@ -0,0 +1,125 @@ +:root { + --bg: #fbfbf9; + --text: #1d2330; + --muted: #5b6475; + --line: #e2e3df; + --blue: #1f5fc4; + --code: #eef0ec; +} +@media (prefers-color-scheme: dark) { + :root { + --bg: #14171d; + --text: #e4e6ea; + --muted: #9aa2b1; + --line: #2a2f39; + --blue: #6aa4ff; + --code: #1d2129; + } +} + +* { box-sizing: border-box; } + +body { + margin: 0; + background: var(--bg); + color: var(--text); + font: 17px/1.6 "Noto Sans", "Segoe UI", Roboto, sans-serif; +} + +a { color: var(--blue); } + +header, main, footer { + max-width: 760px; + margin: 0 auto; + padding: 0 16px; +} + +header { + display: flex; + align-items: center; + justify-content: space-between; + flex-wrap: wrap; + gap: 8px; + padding-top: 18px; + padding-bottom: 18px; +} +.brand { + display: flex; + align-items: center; + gap: 10px; + font-weight: 700; + font-size: 20px; + color: var(--text); + text-decoration: none; +} +nav a { + margin-left: 18px; + color: var(--muted); + text-decoration: none; +} +nav a:hover { color: var(--text); } + +h1 { + font-size: 36px; + line-height: 1.2; + margin: 40px 0 16px; + letter-spacing: -0.5px; +} +h2 { + font-size: 22px; + margin: 48px 0 8px; +} + +.button { + display: inline-block; + background: var(--blue); + color: #fff; + padding: 9px 18px; + border-radius: 6px; + text-decoration: none; + font-weight: 600; +} +@media (prefers-color-scheme: dark) { .button { color: #0b1220; } } +.button:hover { filter: brightness(1.08); } + +.small { color: var(--muted); font-size: 14px; } + +.shot { margin: 36px -40px 0; } +.shot img { + width: 100%; + height: auto; + border-radius: 8px; + box-shadow: 0 10px 40px rgba(0, 0, 0, .25); +} +.shot figcaption { + text-align: center; + color: var(--muted); + font-size: 14px; + margin-top: 10px; +} +@media (max-width: 840px) { .shot { margin: 28px 0 0; } } + +table { border-collapse: collapse; width: 100%; } +td { + padding: 8px 10px 8px 0; + border-bottom: 1px solid var(--line); + vertical-align: top; +} +td:first-child { width: 110px; } + +pre { + background: var(--code); + padding: 12px 14px; + border-radius: 6px; + overflow-x: auto; + font-size: 15px; +} + +footer { + margin-top: 64px; + padding-top: 16px; + padding-bottom: 40px; + border-top: 1px solid var(--line); + color: var(--muted); + font-size: 14px; +} diff --git a/editions/base.packages b/editions/base.packages @@ -4,7 +4,7 @@ # core system base-files bash coreutils findutils diffutils grep sed gawk which file less gzip bzip2 xz zstd tar unzip -util-linux shadow procps-ng psmisc kmod eudev dbus elogind polkit dinit busybox xbps +util-linux shadow procps-ng psmisc kmod eudev dbus elogind polkit dinit busybox xbps plymouth iproute2 iputils NetworkManager openssh curl wget ca-certificates rsync sudo nano glibc-locales tzdata man-db diff --git a/keys/apk/chamesle-20261021.rsa.pub b/keys/apk/chamesle-20261021.rsa.pub @@ -0,0 +1,14 @@ +-----BEGIN PUBLIC KEY----- +MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAilrNi6zdoWeoEjiIBJzB +PtttTGrYNkLKjpBf2n59BHbWGI0Lmbvd+2YyiPxfVjwYu9SourXSEvD1zABBppH3 +i8SRnwHVkS1ohhGpgHnDt4ozADnSOmUC7CUK4lyErx4Xh/C6B05cF7m4SpnITddk +XwIlXsZlQ69TMykxARcmkxIMj4ZEbkmazIR4NAbehosRQAsqbRbnRXtyL0zBiWWN +NQCam6RlKs8dZ24GqeC7ZYyO3EFZpH3RysV/jKKaqE0GVIEPkj+KQYpHZ4pHQRd7 +atRnty5RnsaQ7U9hCrhhQ295WHqejmKrvkonP1WHStfbNrUOvGqkJDsHf4Y5SnOC +2bhCyAun2ZfYmaZsHg+AAJNGsprx91sLWVsFYcB9mxYH6tKwis7wiBqLBh828tlt +Kt8sDetc7MmFciAtA01j+beg1RUVQYfuGgqh3urHZDJV0vJnP6nminxNpAyedgCi +yXLQieClA9Innr3ehN3Suj/qgwJoYYUq4qCfAV0d6RFDHoVT3B/UN0r999LyL2O2 +Bhx7KHKXO5juLSBjgAwoIQPM5bOl3Dz6uKGvAEOm2IKVt6Xr+KH0TV4dVblSnVZt +eQ5338+6m69FwZQPRCoZtWHvkikTkFYabNuktqwU1sc+ho++0Qsq3jeRnWzVZWea +mPsfyej9eVMCMw1LbQKmH9kCAwEAAQ== +-----END PUBLIC KEY----- diff --git a/overlay/etc/dinit.d/display-manager b/overlay/etc/dinit.d/display-manager @@ -4,6 +4,7 @@ command = /usr/bin/lightdm depends-on = dbus depends-on = elogind waits-for = polkitd +waits-for = plymouth-quit waits-for = udev-trigger waits-for = network restart = true diff --git a/overlay/etc/dinit.d/getty-tty1 b/overlay/etc/dinit.d/getty-tty1 @@ -3,5 +3,6 @@ type = process command = /usr/bin/agetty tty1 38400 linux depends-on = system-identity waits-for = console-setup +waits-for = plymouth-quit restart = true smooth-recovery = true diff --git a/overlay/etc/dinit.d/plymouth-quit b/overlay/etc/dinit.d/plymouth-quit @@ -0,0 +1,4 @@ +# hand the screen over from the boot splash +type = scripted +command = /bin/sh -c "plymouth quit --retain-splash || true" +depends-on = early-filesystems diff --git a/overlay/etc/plymouth/plymouthd.conf b/overlay/etc/plymouth/plymouthd.conf @@ -0,0 +1,4 @@ +[Daemon] +Theme=chamesle +ShowDelay=0 +DeviceTimeout=8 diff --git a/overlay/usr/share/icons/hicolor/128x128/apps/chamesle-start.png b/overlay/usr/share/icons/hicolor/128x128/apps/chamesle-start.png Binary files differ. diff --git a/overlay/usr/share/icons/hicolor/16x16/apps/chamesle-start.png b/overlay/usr/share/icons/hicolor/16x16/apps/chamesle-start.png Binary files differ. diff --git a/overlay/usr/share/icons/hicolor/24x24/apps/chamesle-start.png b/overlay/usr/share/icons/hicolor/24x24/apps/chamesle-start.png Binary files differ. diff --git a/overlay/usr/share/icons/hicolor/256x256/apps/chamesle-start.png b/overlay/usr/share/icons/hicolor/256x256/apps/chamesle-start.png Binary files differ. diff --git a/overlay/usr/share/icons/hicolor/32x32/apps/chamesle-start.png b/overlay/usr/share/icons/hicolor/32x32/apps/chamesle-start.png Binary files differ. diff --git a/overlay/usr/share/icons/hicolor/48x48/apps/chamesle-start.png b/overlay/usr/share/icons/hicolor/48x48/apps/chamesle-start.png Binary files differ. diff --git a/overlay/usr/share/icons/hicolor/64x64/apps/chamesle-start.png b/overlay/usr/share/icons/hicolor/64x64/apps/chamesle-start.png Binary files differ. diff --git a/overlay/usr/share/icons/hicolor/scalable/apps/chamesle-start.svg b/overlay/usr/share/icons/hicolor/scalable/apps/chamesle-start.svg @@ -1,11 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64"> - <!-- Chamesle start button (placeholder until the real logo): a rounded tile with a C --> - <defs> - <linearGradient id="g" x1="0" y1="0" x2="1" y2="1"> - <stop offset="0" stop-color="#22c55e"/> - <stop offset="1" stop-color="#0ea5e9"/> - </linearGradient> - </defs> - <rect x="4" y="4" width="56" height="56" rx="14" fill="url(#g)"/> - <path d="M42 22.5 A13 13 0 1 0 42 41.5" fill="none" stroke="#ffffff" stroke-width="7" stroke-linecap="round"/> -</svg> diff --git a/overlay/usr/share/plymouth/themes/chamesle/chamesle.plymouth b/overlay/usr/share/plymouth/themes/chamesle/chamesle.plymouth @@ -0,0 +1,8 @@ +[Plymouth Theme] +Name=Chamesle +Description=The Chamesle logo turning slowly on black +ModuleName=script + +[script] +ImageDir=/usr/share/plymouth/themes/chamesle +ScriptFile=/usr/share/plymouth/themes/chamesle/chamesle.script diff --git a/overlay/usr/share/plymouth/themes/chamesle/chamesle.script b/overlay/usr/share/plymouth/themes/chamesle/chamesle.script @@ -0,0 +1,33 @@ +// Chamesle boot splash: the logo spinning in the middle of a black screen. +Window.SetBackgroundTopColor(0, 0, 0); +Window.SetBackgroundBottomColor(0, 0, 0); + +logo.image = Image("logo.png"); +// about a quarter of the screen's height, whatever the resolution +size = Math.Int(Window.GetHeight() / 4); +logo.image = logo.image.Scale(size, size); +logo.sprite = Sprite(); +angle = 0; + +fun refresh_callback() { + angle = angle + 0.04; + if (angle > 6.2832) angle = angle - 6.2832; + turned = logo.image.Rotate(angle); + logo.sprite.SetImage(turned); + logo.sprite.SetX(Window.GetX() + Window.GetWidth() / 2 - turned.GetWidth() / 2); + logo.sprite.SetY(Window.GetY() + Window.GetHeight() / 2 - turned.GetHeight() / 2); +} +Plymouth.SetRefreshFunction(refresh_callback); + +// a LUKS passphrase prompt (encrypted installs): a line of dots under the logo +fun display_password_callback(prompt, bullets) { + text = prompt + " "; + for (i = 0; i < bullets; i++) text = text + "*"; + message.image = Image.Text(text, 1, 1, 1); + message.sprite = Sprite(message.image); + message.sprite.SetX(Window.GetX() + Window.GetWidth() / 2 - message.image.GetWidth() / 2); + message.sprite.SetY(Window.GetY() + Window.GetHeight() * 0.8); +} +Plymouth.SetDisplayPasswordFunction(display_password_callback); +fun display_normal_callback() { message.sprite = Sprite(); } +Plymouth.SetDisplayNormalFunction(display_normal_callback); diff --git a/overlay/usr/share/plymouth/themes/chamesle/logo.png b/overlay/usr/share/plymouth/themes/chamesle/logo.png Binary files differ. diff --git a/tools/initrd/build-initrd.sh b/tools/initrd/build-initrd.sh @@ -12,6 +12,7 @@ R=$W/root # the image's merged /usr layout: /bin, /sbin -> usr/bin, /lib, /lib64 -> usr/lib mkdir -p "$R"/usr/bin "$R"/usr/lib "$R"/{proc,sys,dev,mnt,newroot,overlay,etc} ln -s usr/bin "$R/bin"; ln -s usr/bin "$R/sbin"; ln -s usr/lib "$R/lib"; ln -s usr/lib "$R/lib64" +ln -s lib "$R/usr/lib64" # void's loader looks in /usr/lib64 # resolve PATH (absolute, inside the image) through symlinks, inside the image resolve() { @@ -49,6 +50,28 @@ applets=$(BB --list) [ -n "$applets" ] || { echo "initrd: cannot list busybox's applets" >&2; exit 1; } for a in $applets; do [ -e "$R/usr/bin/$a" ] || ln -s busybox "$R/usr/bin/$a"; done echo "$applets" | grep -x modprobe >/dev/null || { echo "initrd: busybox has no modprobe applet" >&2; exit 1; } +# plymouth for the boot splash (init starts it when the kernel line says "splash") +if [ -x "$ROOT/usr/bin/plymouthd" ]; then + echo "== plymouth" + copy_elf /usr/bin/plymouthd + copy_elf /usr/bin/plymouth + copy_elf /usr/bin/udevd + copy_elf /usr/bin/udevadm + install -Dm644 "$ROOT/usr/lib/udev/rules.d/71-plymouth-seat.rules" "$R/usr/lib/udev/rules.d/71-plymouth-seat.rules" + for p in script text details label renderers/frame-buffer renderers/drm; do + [ -e "$ROOT/usr/lib/plymouth/$p.so" ] && copy_elf "/usr/lib/plymouth/$p.so" + done + theme=$(sed -n 's/^Theme=//p' "$ROOT/etc/plymouth/plymouthd.conf" 2>/dev/null) + mkdir -p "$R/usr/share/plymouth/themes" "$R/etc/plymouth" + cp "$ROOT/usr/share/plymouth/plymouthd.defaults" "$R/usr/share/plymouth/" + cp "$ROOT/etc/plymouth/plymouthd.conf" "$R/etc/plymouth/" 2>/dev/null || true + [ -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) + [ -n "$font" ] && install -Dm644 "$font" "$R/usr/share/fonts/DejaVuSans.ttf" +fi + install -m755 "$HERE/init" "$R/init" [ -z "$BUILD_ID" ] || echo "$BUILD_ID" > "$R/build-id" diff --git a/tools/initrd/init b/tools/initrd/init @@ -23,7 +23,9 @@ export PATH=/bin:/sbin:/usr/bin:/usr/sbin exec </dev/console >/dev/console 2>&1 log() { echo "[live] $*"; } +SPLASH=0 emergency() { + [ "$SPLASH" = 1 ] && { plymouth quit; SPLASH=0; } echo "[live] $*" echo "[live] starting a shell; leave it with 'exit' to try again" setsid cttyhack sh @@ -81,6 +83,19 @@ load_hw_modules() { } load_hw_modules +# boot splash +if grep -qw splash /proc/cmdline && [ -x /usr/bin/plymouthd ]; then + mkdir -p /run/plymouth /run/udev /dev/pts + mount -t devpts devpts /dev/pts 2>/dev/null + # plymouth only finds the framebuffer through udev + if [ -x /usr/bin/udevd ]; then + udevd --daemon --resolve-names=never 2>/dev/null + udevadm trigger --action=add --subsystem-match=graphics --subsystem-match=drm + udevadm settle --timeout=5 + fi + plymouthd --mode=boot --attach-to-session --pid-file=/run/plymouth/pid && plymouth show-splash && SPLASH=1 +fi + [ "$SHELL_FIRST" = 1 ] && emergency "chamesle.shell=1" # The initramfs carries a build id and so does the ISO's /live directory: with several Chamesle ISOs on one @@ -162,7 +177,12 @@ if [ -n "$ROOT" ]; then if is_luks "$DEV"; then log "encrypted root partition: enter the passphrase to unlock it" until [ -e /dev/mapper/root ]; do - cryptsetup open "$DEV" root || log "wrong passphrase, try again" + if [ "$SPLASH" = 1 ]; then + plymouth ask-for-password --prompt="Passphrase" --command="cryptsetup open --key-file=- $DEV root" || + plymouth display-message --text="Wrong passphrase, try again" + else + cryptsetup open "$DEV" root || log "wrong passphrase, try again" + fi done DEV=/dev/mapper/root fi @@ -229,4 +249,6 @@ mount -t tmpfs -o mode=0755,nosuid,nodev tmpfs /newroot/run # (/proc has been moved into the new root by now: QUIET comes from the command line parsed at the start) INIT_ARGS= [ "$QUIET" = 1 ] && [ "$INIT" = /usr/bin/dinit ] && [ "$DEBUG" = 0 ] && INIT_ARGS=--quiet +[ "$SPLASH" = 1 ] && plymouth update-root-fs --new-root-dir=/newroot +udevadm control --exit 2>/dev/null exec switch_root /newroot "$INIT" $INIT_ARGS diff --git a/tools/repo/build-repo.sh b/tools/repo/build-repo.sh @@ -0,0 +1,73 @@ +#!/bin/bash +# build the chamesle apk repo out of void's glibc packages +# tools/repo/build-repo.sh everything the editions use (from the xbps cache) +# ALL=1 tools/repo/build-repo.sh the whole void repo (big, ~50G) +# needs apk-tools 3. the signing key lives outside the repo, in ~/.config/chamesle/ +set -euo pipefail +HERE=$(cd "$(dirname "$0")" && pwd) +APK=${APK:-apk} +VOID=${VOID_REPO:-https://repo-default.voidlinux.org/current} +CACHE=${XBPS_CACHE:-$HOME/.cache/chamesle-xbps} +OUT=${OUT:-$HERE/../../work/repo} +KEYDIR=${KEYDIR:-$HOME/.config/chamesle} +JOBS=${JOBS:-$(nproc)} +ARCH=x86_64 +export APK + +KEY=$(ls "$KEYDIR"/chamesle-*.rsa 2>/dev/null | head -n1 || true) +if [ -z "$KEY" ]; then + mkdir -p "$KEYDIR"; chmod 700 "$KEYDIR" + KEY=$KEYDIR/chamesle-$(date +%Y%m%d).rsa + openssl genrsa -out "$KEY" 4096 2>/dev/null + openssl rsa -in "$KEY" -pubout -out "$KEY.pub" 2>/dev/null + echo "new signing key: $KEY (back it up, don't commit it)" +fi +mkdir -p "$HERE/../../keys/apk" +cp "$KEY.pub" "$HERE/../../keys/apk/" +export SIGN_KEY=$KEY + +mkdir -p "$OUT/$ARCH" "$CACHE" +if [ "${ALL:-0}" = 1 ]; then + # every package in void's index, fetched one by one (skips what's cached) + for r in "$VOID" "$VOID/nonfree"; do + curl -sfL "$r/$ARCH-repodata" | tar -xO --zstd index.plist 2>/dev/null | python3 -c ' +import plistlib, sys +r = sys.argv[1] +for name, p in plistlib.loads(sys.stdin.buffer.read()).items(): + print(r + "/" + p["pkgver"] + "." + p["architecture"] + ".xbps")' "$r" + done > "$OUT/void.list" + echo "$(wc -l < "$OUT/void.list") packages in void" + while read -r u; do [ -e "$CACHE/${u##*/}" ] || echo "$u"; done < "$OUT/void.list" > "$OUT/fetch.list" + echo "$(wc -l < "$OUT/fetch.list") to download" + (cd "$CACHE" && xargs -a "$OUT/fetch.list" -P 8 -n 20 curl -sfL --remote-name-all --retry 3) || true +fi + +# only convert what isn't there yet +todo=$OUT/todo.list +: > "$todo" +for x in "$CACHE"/*.xbps; do + b=$(basename "$x" ".$ARCH.xbps"); b=${b%.noarch.xbps} + v=${b##*-}; n=${b%-*} + [ -e "$OUT/$ARCH/$n-${v%_*}-r${v##*_}.apk" ] || echo "$x" >> "$todo" +done +echo "$(wc -l < "$todo") packages to convert" +xargs -a "$todo" -P "$JOBS" -I{} python3 "$HERE/xbps2apk.py" {} "$OUT/$ARCH" 2>> "$OUT/errors.log" || true + +# drop old versions, then index +python3 - "$OUT/$ARCH" <<'EOF' +import os, re, subprocess, sys +d = sys.argv[1]; latest = {} +for f in sorted(os.listdir(d)): + m = re.match(r'^(.+)-([^-]+-r[0-9]+)\.apk$', f) + if m: + latest.setdefault(m.group(1), []).append(f) +for name, files in latest.items(): + files.sort(key=lambda f: [int(x) if x.isdigit() else x for x in re.split(r'(\d+)', f)]) + for old in files[:-1]: + os.remove(os.path.join(d, old)) +EOF +"$APK" mkndx --keys-dir "$HERE/../../keys/apk" --sign-key "$KEY" --description "chamesle $(date +%Y-%m-%d)" \ + --output "$OUT/$ARCH/Packages.adb" "$OUT/$ARCH"/*.apk +echo "$(ls "$OUT/$ARCH"/*.apk | wc -l) packages in $OUT/$ARCH" +[ -s "$OUT/errors.log" ] && echo "failed: $(wc -l < "$OUT/errors.log") (see $OUT/errors.log)" +true diff --git a/tools/repo/xbps2apk.py b/tools/repo/xbps2apk.py @@ -0,0 +1,103 @@ +#!/usr/bin/env python3 +# turn a void .xbps into an apk v3 package +# usage: xbps2apk.py PKG.xbps OUTDIR (APK=path/to/apk, SIGN_KEY=key.rsa) +import os, plistlib, re, shutil, subprocess, sys, tempfile + +APK = os.environ.get('APK', 'apk') +src, outdir = sys.argv[1], sys.argv[2] + + +def ver(v): + # void: 1.2.3_4 -> apk: 1.2.3-r4 + v, _, rev = v.rpartition('_') + v = v.lower().replace('+', '').replace('~', '_') + # 1.4rc5 -> 1.4_rc5, 0.99.beta20 -> 0.99_beta20, 10.6p1 -> 10.6_p1 + v = re.sub(r'\.?(alpha|beta|pre|rc|p)([0-9]+)', r'_\1\2', v) + if not re.fullmatch(r'[0-9]+(\.[0-9]+)*[a-z]?(_(alpha|beta|pre|rc|cvs|svn|git|hg|p)[0-9]*)*', v): + v = re.match(r'[0-9]+(\.[0-9]+)*', v).group(0) + '_p0' + return f'{v}-r{rev}' + + +def dep(d): + # glibc>=2.41_1, foo-1.0_1, foo<2, bar>=0 + d = re.sub(r'(.)[<>]=?[^<>=]*$', r'\1', d) if re.search(r'[<>=].*[<>]', d) else d + m = re.match(r'^([^<>=]+?)([<>]=?|=)(.+)$', d) + if m: + name, op, v = m.groups() + if '_' in v and re.match(r'^[0-9]', v): + v = ver(v) + elif op == '>=' and v == '0': + return name + return f'{name}{op}{v}' + m = re.match(r'^(.+)-([^-]+_[0-9]+)$', d) + if m: + return f'{m.group(1)}={ver(m.group(2))}' + return d + + +def soname(lib): + m = re.search(r'\.so\.([0-9]+)', lib) + return f'so:{lib}={m.group(1) if m else 0}' + + +tmp = tempfile.mkdtemp(prefix='x2a.') +try: + root = os.path.join(tmp, 'root') + os.mkdir(root) + subprocess.run(['tar', '-xpf', src, '-C', root], check=True) + with open(os.path.join(root, 'props.plist'), 'rb') as f: + p = plistlib.load(f) + for meta in ('props.plist', 'files.plist'): + os.remove(os.path.join(root, meta)) + + name = p['pkgname'] + v = ver(p['version']) + arch = p.get('architecture', 'noarch') + deps = [dep(d) for d in p.get('run_depends', [])] + deps += ['so:' + l for l in p.get('shlib-requires', [])] + provides = [soname(l) for l in p.get('shlib-provides', [])] + provides += [dep(x).replace('>=', '=') for x in p.get('provides', [])] + replaces = [re.split(r'[<>=]', x)[0] for x in p.get('replaces', [])] + + info = { + 'name': name, 'version': v, 'arch': arch, + 'description': p.get('short_desc', name), + 'license': p.get('license', 'unknown'), + 'url': p.get('homepage', ''), + 'origin': p.get('sourcepkg', name), + 'maintainer': 'Chamesle Linux <packages@chamesle.org>', + } + args = [APK, 'mkpkg', '--files', root, '--output', os.path.join(outdir, f'{name}-{v}.apk')] + for k, val in info.items(): + if val: + args += ['--info', f'{k}:{val}'] + for k, lst in (('depends', deps), ('provides', provides), ('replaces', replaces)): + lst = [x for x in dict.fromkeys(lst) if x and x != name] + if lst: + args += ['--info', f'{k}:' + ' '.join(lst)] + + # void's INSTALL/REMOVE take "pre"/"post" as the first argument + for script, kinds in (('INSTALL', ('pre-install', 'post-install', 'pre-upgrade', 'post-upgrade')), + ('REMOVE', ('pre-deinstall', 'post-deinstall'))): + path = os.path.join(root, script) + if not os.path.exists(path): + continue + body = open(path).read() + os.remove(path) + for kind in kinds: + when = kind.split('-')[0] + upd = 'yes' if kind.endswith('upgrade') else 'no' + out = os.path.join(tmp, kind) + with open(out, 'w') as f: + f.write(f'#!/bin/sh\nset -- {when} {name} {p["version"]} {upd} no x86_64\n' + f'export XBPS_TARGET_ARCH=x86_64\n{body}') + os.chmod(out, 0o755) + args += ['--script', f'{kind}:{out}'] + + if os.environ.get('SIGN_KEY'): + args += ['--sign-key', os.environ['SIGN_KEY']] + r = subprocess.run(args, capture_output=True, text=True) + if r.returncode: + sys.exit(f'{os.path.basename(src)}: {r.stderr.strip() or r.stdout.strip()}') +finally: + shutil.rmtree(tmp, ignore_errors=True)