commit c8f711a05ea1b30f10236fcfbff3dfbce531cb45 parent 925cb8d36c682a6a5af7cf77b1939e46c28d9176 Author: torter <koubbamohamedrayan@gmail.com> Date: Sat, 24 Oct 2026 15:14:37 -0400 0.4: snapshots before updates, the Astro flavor, cinnamon wi-fi and spices fixes, safer installs Diffstat:
34 files changed, 448 insertions(+), 36 deletions(-)
diff --git a/VERSION b/VERSION @@ -1 +1 @@ -0.3.0 +0.4.0 diff --git a/build.sh b/build.sh @@ -8,7 +8,13 @@ HERE=$(cd "$(dirname "$0")" && pwd) EDITION=${EDITION:-xfce} [ -f "$HERE/editions/$EDITION/packages" ] || { echo "build: no edition '$EDITION' (editions/*/packages)" >&2; exit 1; } VERSION=$(cat "$HERE/VERSION"); CODENAME=$(cat "$HERE/CODENAME" 2>/dev/null || true) -EDITION_NAME=$(sed -n 's/^name=//p' "$HERE/editions/$EDITION/edition" 2>/dev/null || echo "$EDITION") +# a flavor (astro) is an edition on top of another one: base=gnome brings that edition's packages, overlay, session and +# login, the flavor adds its own +BASE=$(sed -n 's/^base=//p' "$HERE/editions/$EDITION/edition" 2>/dev/null) +EDS="$BASE $EDITION" +# edval KEY: from the edition file, else from its base's +edval() { local e v; for e in $EDITION $BASE; do v=$(sed -n "s/^$1=//p" "$HERE/editions/$e/edition" 2>/dev/null); [ -n "$v" ] && { echo "$v"; return; }; done; return 0; } +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 PUBLIC_REPO=https://downloads.sourceforge.net/project/chameslerepos @@ -21,7 +27,7 @@ for t in "$APK" mksquashfs xorriso readelf zstd cpio depmod curl; do command -v command -v grub-mkrescue >/dev/null || command -v grub2-mkrescue >/dev/null || missing="$missing grub-mkrescue" [ -z "$missing" ] || { echo "build: missing tools:$missing" >&2; exit 1; } GRUB_MKRESCUE=$(command -v grub-mkrescue || command -v grub2-mkrescue) -packages() { sed 's/#.*//' "$HERE/editions/base.packages" "$HERE/editions/$EDITION/packages" | tr ' \t' '\n\n' | grep -v '^$' | sort -u; } +packages() { sed 's/#.*//' "$HERE/editions/base.packages" $(for e in $EDS; do echo "$HERE/editions/$e/packages"; done) | tr ' \t' '\n\n' | grep -v '^$' | sort -u; } echo "=== [1/5] INSTALLING THE SYSTEM ($EDITION_NAME, from $REPO)" rm -rf "$WORK"; mkdir -p "$ROOT/etc/apk/keys" "$ISO_DIR/live" "$OUT" @@ -49,7 +55,7 @@ echo "v3 $PUBLIC_REPO" > "$ROOT/etc/apk/repositories" echo "=== [2/5] CHAMESLE: SERVICES, LOOK AND BRANDING" cp -a "$HERE/overlay/." "$ROOT/" -[ -d "$HERE/editions/$EDITION/overlay" ] && cp -a "$HERE/editions/$EDITION/overlay/." "$ROOT/" +for e in $EDS; do [ -d "$HERE/editions/$e/overlay" ] && cp -a "$HERE/editions/$e/overlay/." "$ROOT/"; done "$HERE/tools/themes.sh" "$ROOT" # xfce's stock wallpapers -> ours, for monitors xfce4-desktop.xml doesn't name for f in xfce-x.svg xfce-shapes.svg xfce-stripes.png xfce-teal.png xfce-verticals.png; do @@ -95,8 +101,8 @@ echo 'live ALL=(ALL:ALL) NOPASSWD: ALL' > "$ROOT/etc/sudoers.d/live"; chmod 440 # same for the password prompts of the store, drivers and updates: live has no password to type mkdir -p "$ROOT/etc/polkit-1/rules.d" printf 'polkit.addRule(function(action, subject) {\n if (subject.user == "live") return polkit.Result.YES;\n});\n' > "$ROOT/etc/polkit-1/rules.d/49-live.rules" -SESSION=$(sed -n 's/^session=//p' "$HERE/editions/$EDITION/edition" 2>/dev/null || echo "$EDITION") -LOGIN=$(sed -n 's/^login=//p' "$HERE/editions/$EDITION/edition" 2>/dev/null); LOGIN=${LOGIN:-lightdm} +SESSION=$(edval session); SESSION=${SESSION:-${BASE:-$EDITION}} +LOGIN=$(edval login); LOGIN=${LOGIN:-lightdm} if [ "$LOGIN" = gdm ]; then # gdm has a single config file, the installer takes these lines out again. the session comes from accountsservice sed -i 's/^\[daemon\]$/&\n# the live session only\nAutomaticLoginEnable=True\nAutomaticLogin=live/' "$ROOT/etc/gdm/custom.conf" @@ -118,8 +124,9 @@ Exec=sh -c 'f=$HOME/Desktop/chamesle-install.desktop; gio set "$f" metadata::xfc NoDisplay=true EOF # gnome has no desktop icons: the installer goes first in the dock instead -GNOME_LOOK=$ROOT/usr/share/glib-2.0/schemas/50_chamesle-gnome.gschema.override -if [ -f "$GNOME_LOOK" ]; then +# the dock of a flavor wins over gnome's: its override sorts last +GNOME_LOOK=$(grep -l '^favorite-apps=' "$ROOT"/usr/share/glib-2.0/schemas/*_chamesle-*.gschema.override 2>/dev/null | sort | tail -n1 || true) +if [ -n "$GNOME_LOOK" ]; then mkdir -p "$ROOT/home/live/.config/dconf" "$ROOT/tmp/live-dconf" { echo '[org/gnome/shell]'; sed -n "s/^favorite-apps=\[/&'chamesle-install.desktop', /p" "$GNOME_LOOK"; } > "$ROOT/tmp/live-dconf/live" "$IN" "$ROOT" /usr/bin/dconf compile /home/live/.config/dconf/user /tmp/live-dconf diff --git a/editions/astro/edition b/editions/astro/edition @@ -0,0 +1,3 @@ +name=Astro +# a flavor: the gnome edition with astronomy on top +base=gnome diff --git a/editions/astro/packages b/editions/astro/packages @@ -0,0 +1,5 @@ +# astro flavor: the gnome edition plus apps for the night sky +# stellarium: the planetarium. kstars: sky charts and telescope control. siril: stacking and processing astrophotos. +# gpredict: where satellites and the iss are right now +stellarium kstars siril gpredict +chamesle-astro diff --git a/overlay/etc/dracut.conf.d/chamesle.conf b/overlay/etc/dracut.conf.d/chamesle.conf @@ -1,2 +1,4 @@ # plymouth from the initramfs keeps hold of the screen and X never gets its VT omit_dracutmodules+=" plymouth " +# the root is btrfs on installs from 0.4 on +filesystems+=" btrfs " diff --git a/overlay/usr/lib/live-installer/installer.py b/overlay/usr/lib/live-installer/installer.py @@ -40,12 +40,10 @@ class InstallerEngine: subprocess.run(["chroot", "/target", "useradd", "-m", "-s", "/bin/bash", "-c", self.setup.real_name, "-G", ",".join(groups), self.setup.username]) - fp = open("/target/dev/shm/.passwd", "w") - fp.write(self.setup.username + ":" + self.setup.password1 + "\n") - fp.close() - # -c: hash it here, the pam setup for chpasswd doesn't store anything - self.do_run_in_chroot("cat /dev/shm/.passwd | chpasswd -c SHA512") - os.system("rm -f /target/dev/shm/.passwd") + # through stdin: never in a file or on a command line. -c: hash it here, the pam setup for chpasswd + # doesn't store anything + subprocess.run(["chroot", "/target", "chpasswd", "-c", "SHA512"], + input="%s:%s\n" % (self.setup.username, self.setup.password1), text=True) if self.setup.autologin and os.path.exists("/target/etc/gdm/custom.conf"): os.system("sed -i 's/^\\[daemon\\]$/&\\nAutomaticLoginEnable=True\\nAutomaticLogin=%s/' /target/etc/gdm/custom.conf" @@ -316,9 +314,12 @@ class InstallerEngine: # Encrypt root partition if self.setup.luks: print(" --> Encrypting root partition %s" % self.auto_root_partition) - os.system("echo -n %s | cryptsetup luksFormat -c aes-xts-plain64 -h sha256 -s 512 %s" % (shlex.quote(self.setup.passphrase1), self.auto_root_partition)) + # the passphrase goes in on stdin, where ps can't see it and echo can't eat a leading -n or -e + subprocess.run(["cryptsetup", "luksFormat", "--batch-mode", "-c", "aes-xts-plain64", "-h", "sha256", "-s", "512", + "--key-file=-", self.auto_root_partition], input=self.setup.passphrase1, text=True) print(" --> Opening root partition %s" % self.auto_root_partition) - os.system("echo -n %s | cryptsetup luksOpen %s chamesle" % (shlex.quote(self.setup.passphrase1), self.auto_root_partition)) + subprocess.run(["cryptsetup", "luksOpen", "--key-file=-", self.auto_root_partition, "chamesle"], + input=self.setup.passphrase1, text=True) self.auto_root_partition = "/dev/mapper/chamesle" # Setup LVM @@ -333,8 +334,6 @@ class InstallerEngine: os.system("lvcreate -y -n swap -L 2GB chamesle") print(" --> LVM: Extending LV root") os.system(r"lvextend -l 100%FREE /dev/chamesle/root") - print(" --> LVM: Formatting LV root") - os.system("mkfs.ext4 /dev/mapper/chamesle-root -FF") print(" --> LVM: Formatting LV swap") os.system("mkswap -f /dev/mapper/chamesle-swap") print(" --> LVM: Enabling LV swap") @@ -342,7 +341,7 @@ class InstallerEngine: self.auto_root_partition = "/dev/mapper/chamesle-root" self.auto_swap_partition = "/dev/mapper/chamesle-swap" - self.do_mount(self.auto_root_partition, "/target", "ext4", None) + self.make_root_btrfs(self.auto_root_partition) if (self.auto_boot_partition is not None): os.system("mkdir -p /target/boot") self.do_mount(self.auto_boot_partition, "/target/boot", "ext4", None) @@ -350,6 +349,18 @@ class InstallerEngine: os.system("mkdir -p /target/boot/efi") self.do_mount(self.auto_efi_partition, "/target/boot/efi", "vfat", None) + def make_root_btrfs(self, device): + # btrfs, with the system in @ and your files in @home: the system gets snapshotted before updates + # (chamesle-snapshot), your files never + print(" --> Formatting %s as btrfs (@ and @home)" % device) + self.exec_cmd("mkfs.btrfs -f %s" % device) + self.do_mount(device, "/target", "btrfs", None) + os.system("btrfs subvolume create /target/@ /target/@home") + os.system("umount /target") + self.do_mount(device, "/target", "btrfs", "subvol=@") + os.makedirs("/target/home", exist_ok=True) + self.do_mount(device, "/target/home", "btrfs", "subvol=@home") + def create_alongside(self): win = self.setup.windows self.update_progress(15, True, False, _("Shrinking Windows (this can take a while)")) @@ -359,8 +370,7 @@ class InstallerEngine: self.auto_boot_partition = self.auto_swap_partition = None self.auto_efi_partition = alongside.find_esp(win["disk"]) if self.setup.gptonefi else None self.update_progress(25, False, False, _("Formatting partitions...")) - self.exec_cmd("mkfs.ext4 -F %s" % root) - self.do_mount(root, "/target", "ext4", None) + self.make_root_btrfs(root) if self.auto_efi_partition is not None: # windows' own EFI partition, shared, not formatted os.system("mkdir -p /target/boot/efi") @@ -470,7 +480,9 @@ class InstallerEngine: if(not self.setup.skip_mount): if self.setup.automated: fstab.write("# %s\n" % self.auto_root_partition) - fstab.write("%s / ext4 defaults 0 1\n" % self.get_blkid(self.auto_root_partition)) + root_uuid = self.get_blkid(self.auto_root_partition) + fstab.write("%s / btrfs defaults,subvol=@ 0 0\n" % root_uuid) + fstab.write("%s /home btrfs defaults,subvol=@home 0 0\n" % root_uuid) if self.auto_swap_partition is not None: fstab.write("# %s\n" % self.auto_swap_partition) fstab.write("%s none swap sw 0 0\n" % self.get_blkid(self.auto_swap_partition)) @@ -736,7 +748,7 @@ class Setup(object): print("autologin: ", self.autologin) print("ecryptfs: ", self.ecryptfs) print("hostname: %s " % self.hostname) - print("passwords: %s - %s" % (self.password1, self.password2)) + print("password: %s" % ("set" if self.password1 else "none")) print("grub_device: %s " % self.grub_device) print("skip_mount: %s" % self.skip_mount) print("automated: %s" % self.automated) @@ -745,7 +757,7 @@ class Setup(object): print("luks: %s" % self.luks) print("badblocks: %s" % self.badblocks) print("lvm: %s" % self.lvm) - print("passphrase: %s - %s" % (self.passphrase1, self.passphrase2)) + print("passphrase: %s" % ("set" if self.passphrase1 else "none")) if (not self.skip_mount): print("target_disk: %s " % self.target_disk) if self.gptonefi: diff --git a/overlay/usr/lib/live-installer/partitioning.py b/overlay/usr/lib/live-installer/partitioning.py @@ -265,7 +265,7 @@ def partitions_popup_menu(widget, event): menuItem = Gtk.SeparatorMenuItem() menu.append(menuItem) menuItem = Gtk.MenuItem(_("Assign to /")) - menuItem.connect("activate", lambda w: assign_mount_point(partition, '/', 'ext4')) + menuItem.connect("activate", lambda w: assign_mount_point(partition, '/', 'btrfs')) menu.append(menuItem) menuItem = Gtk.MenuItem(_("Assign to /home")) menuItem.connect("activate", lambda w: assign_mount_point(partition, '/home', '')) @@ -460,7 +460,8 @@ def full_disk_format(device, create_boot=False, create_swap=True): # swap - equal to RAM for hibernate to work well (but capped at ~8GB) (create_swap, SWAP_MOUNT_POINT, 'swap', 'mkswap {}', min(8800, int(round(1.1/1024 * int(getoutput("awk '/^MemTotal/{ print $2 }' /proc/meminfo")), -2)))), # root - (True, '/', 'ext4', 'mkfs.ext4 -F {}', 0), + # root: btrfs, made with its subvolumes by the installer (make_root_btrfs) + (True, '/', 'btrfs', 'mkfs.btrfs -f {}', 0), ) run_parted = lambda cmd: os.system('parted --script --align optimal {} {} ; sync'.format(device.path, cmd)) start_mb = 2 diff --git a/tools/pkg/chamesle-astro/files/usr/share/backgrounds/chamesle/astro.jpg b/tools/pkg/chamesle-astro/files/usr/share/backgrounds/chamesle/astro.jpg Binary files differ. diff --git a/tools/pkg/chamesle-astro/files/usr/share/glib-2.0/schemas/60_chamesle-astro.gschema.override b/tools/pkg/chamesle-astro/files/usr/share/glib-2.0/schemas/60_chamesle-astro.gschema.override @@ -0,0 +1,23 @@ +# chamesle astro, on top of 50_chamesle-gnome: dark, warm at night, and the sky apps in the dock. +# wallpaper: "Cosmic Cliffs" in the Carina Nebula, NASA, ESA, CSA, STScI (public domain) +[org.gnome.desktop.background] +picture-uri='file:///usr/share/backgrounds/chamesle/astro.jpg' +picture-uri-dark='file:///usr/share/backgrounds/chamesle/astro.jpg' +picture-options='zoom' + +[org.gnome.desktop.screensaver] +picture-uri='file:///usr/share/backgrounds/chamesle/astro.jpg' +picture-options='zoom' + +[org.gnome.desktop.interface] +color-scheme='prefer-dark' +icon-theme='Chamesle' + +# warm screen from sunset to sunrise, easier on night vision +[org.gnome.settings-daemon.plugins.color] +night-light-enabled=true +night-light-temperature=uint32 2700 + +[org.gnome.shell] +enabled-extensions=['dash-to-dock@micxgx.gmail.com', 'appindicatorsupport@rgcjonas.gmail.com'] +favorite-apps=['firefox.desktop', 'org.gnome.Nautilus.desktop', 'org.stellarium.Stellarium.desktop', 'org.kde.kstars.desktop', 'org.siril.Siril.desktop', 'gpredict.desktop', 'org.chamesle.Store.desktop', 'org.gnome.Console.desktop'] diff --git a/tools/pkg/chamesle-cinnamon/post-install b/tools/pkg/chamesle-astro/post-install diff --git a/tools/pkg/chamesle-cinnamon/post-install b/tools/pkg/chamesle-astro/post-upgrade diff --git a/tools/pkg/chamesle-astro/recipe b/tools/pkg/chamesle-astro/recipe @@ -0,0 +1,13 @@ +name=chamesle-astro +version=0.4.0 +rel=1 +desc="Chamesle Astro: GNOME for looking at the sky, with a Webb wallpaper and a dark desktop" +url=https://chamesle.org +license=GPL-3.0-or-later +source= +makedeps="" +depends="chamesle-gnome" + +build() { + cp -a . "$pkgdir/" +} diff --git a/tools/pkg/chamesle-base/recipe b/tools/pkg/chamesle-base/recipe @@ -1,5 +1,5 @@ name=chamesle-base -version=0.3.0 +version=0.4.0 rel=1 desc="Chamesle system setup: sound, kernel modules at boot, a few small touches" url=https://chamesle.org @@ -8,7 +8,8 @@ source= makedeps="" # ncurses-term: the terminal descriptions htop, nano and friends need (xterm-256color, tmux, kitty...) # pipewire: started at login by the links in files/, with wireplumber and the pulseaudio server -depends="kmod sudo fastfetch ncurses-term pipewire wireplumber" +# chamesle-snapshots: a snapshot before every update, on btrfs installs (nothing happens on older ext4 ones) +depends="kmod sudo fastfetch ncurses-term pipewire wireplumber chamesle-snapshots" build() { cp -a . "$pkgdir/" diff --git a/tools/pkg/chamesle-cinnamon/files/etc/apk/commit_hooks.d/chamesle-cinnamon-spices.post-commit b/tools/pkg/chamesle-cinnamon/files/etc/apk/commit_hooks.d/chamesle-cinnamon-spices.post-commit @@ -0,0 +1,8 @@ +#!/bin/sh +# cinnamon 6.6 crashes downloading themes and applets when the server sends no size ("int() argument must be +# ... not 'NoneType'"). newer cinnamon counts a missing size as 0; so do we, again after every cinnamon update +[ "$1" = post-commit ] || exit 0 +f=/usr/share/cinnamon/cinnamon-settings/bin/Spices.py +grep -qF "int(response.headers.get('content-length'))" $f 2>/dev/null && + sed -i "s/int(response.headers.get('content-length'))/int(response.headers.get('content-length') or 0)/" $f +exit 0 diff --git a/tools/pkg/chamesle-cinnamon/post-install b/tools/pkg/chamesle-cinnamon/post-install @@ -1,3 +1,11 @@ #!/bin/sh glib-compile-schemas /usr/share/glib-2.0/schemas 2>/dev/null +/etc/apk/commit_hooks.d/chamesle-cinnamon-spices.post-commit post-commit +# unlock the keyring with the login password, so saving a wi-fi password doesn't ask for a keyring password too +p=/etc/pam.d/lightdm +if [ -f $p ] && ! grep -q pam_gnome_keyring $p; then + sed -i -e '/^auth .*pam_unix.so/a -auth optional pam_gnome_keyring.so' \ + -e '/^password .*pam_unix.so/a -password optional pam_gnome_keyring.so use_authtok' $p + echo '-session optional pam_gnome_keyring.so auto_start' >> $p +fi exit 0 diff --git a/tools/pkg/chamesle-cinnamon/post-upgrade b/tools/pkg/chamesle-cinnamon/post-upgrade @@ -1,3 +1,11 @@ #!/bin/sh glib-compile-schemas /usr/share/glib-2.0/schemas 2>/dev/null +/etc/apk/commit_hooks.d/chamesle-cinnamon-spices.post-commit post-commit +# unlock the keyring with the login password, so saving a wi-fi password doesn't ask for a keyring password too +p=/etc/pam.d/lightdm +if [ -f $p ] && ! grep -q pam_gnome_keyring $p; then + sed -i -e '/^auth .*pam_unix.so/a -auth optional pam_gnome_keyring.so' \ + -e '/^password .*pam_unix.so/a -password optional pam_gnome_keyring.so use_authtok' $p + echo '-session optional pam_gnome_keyring.so auto_start' >> $p +fi exit 0 diff --git a/tools/pkg/chamesle-cinnamon/recipe b/tools/pkg/chamesle-cinnamon/recipe @@ -1,12 +1,14 @@ name=chamesle-cinnamon -version=0.2.0 -rel=2 -desc="The Chamesle look for Cinnamon: wallpaper, theme settings, login screen" +version=0.4.1 +rel=0 +desc="The Chamesle look for Cinnamon: wallpaper, theme settings, login screen, and fixes for its settings" url=https://chamesle.org license=GPL-3.0-or-later source= makedeps="" -depends="chamesle-artwork" +# gnome-keyring: cinnamon looks for saved wi-fi passwords there before asking for one, and without it the +# lookup fails, no password box shows up and the network says the password is wrong +depends="chamesle-artwork gnome-keyring" build() { cp -a . "$pkgdir/" diff --git a/tools/pkg/chamesle-plymouth/files/usr/share/plymouth/themes/chamesle/bullet.png b/tools/pkg/chamesle-plymouth/files/usr/share/plymouth/themes/chamesle/bullet.png Binary files differ. diff --git a/tools/pkg/chamesle-plymouth/files/usr/share/plymouth/themes/chamesle/chamesle.plymouth b/tools/pkg/chamesle-plymouth/files/usr/share/plymouth/themes/chamesle/chamesle.plymouth @@ -0,0 +1,8 @@ +[Plymouth Theme] +Name=Chamesle +Description=The Chamesle logo with a spinner under it +ModuleName=script + +[script] +ImageDir=/usr/share/plymouth/themes/chamesle +ScriptFile=/usr/share/plymouth/themes/chamesle/chamesle.script diff --git a/tools/pkg/chamesle-plymouth/files/usr/share/plymouth/themes/chamesle/chamesle.script b/tools/pkg/chamesle-plymouth/files/usr/share/plymouth/themes/chamesle/chamesle.script @@ -0,0 +1,85 @@ +# the chamesle boot screen: the logo in the middle, a spinner under it, and the disk password box when the +# disk is encrypted + +Window.SetBackgroundTopColor(0.965, 0.969, 0.976); +Window.SetBackgroundBottomColor(0.965, 0.969, 0.976); + +cx = Window.GetX() + Window.GetWidth() / 2; +cy = Window.GetY() + Window.GetHeight() / 2; + +logo = Image("logo.png"); +logo_sprite = Sprite(logo); +logo_sprite.SetPosition(cx - logo.GetWidth() / 2, cy - logo.GetHeight() / 2 - 40, 1); + +spinner = Image("spinner.png"); +track = Image("track.png"); +spin_y = cy + logo.GetHeight() / 2 + 40; +track_sprite = Sprite(track); +track_sprite.SetPosition(cx - track.GetWidth() / 2, spin_y, 1); +spin_sprite = Sprite(); +spin_sprite.SetPosition(cx - spinner.GetWidth() / 2, spin_y, 2); +angle = 0; + +fun refresh() { + angle += 0.12; + spin_sprite.SetImage(spinner.Rotate(angle)); +} +Plymouth.SetRefreshFunction(refresh); + +# the disk password: the spinner makes room for a box with a bullet per letter +entry = Image("entry.png"); +bullet = Image("bullet.png"); +entry_sprite = Sprite(); +prompt_sprite = Sprite(); +bullets = []; + +fun hide_password() { + entry_sprite.SetOpacity(0); + prompt_sprite.SetOpacity(0); + for (i = 0; bullets[i]; i++) bullets[i].SetOpacity(0); + spin_sprite.SetOpacity(1); + track_sprite.SetOpacity(1); +} + +fun display_password(prompt, count) { + spin_sprite.SetOpacity(0); + track_sprite.SetOpacity(0); + if (!prompt) prompt = "Password for the disk"; + p = Image.Text(prompt, 0.235, 0.259, 0.314, 1, "Inter 12"); + prompt_sprite.SetImage(p); + prompt_sprite.SetPosition(cx - p.GetWidth() / 2, spin_y - 4, 3); + prompt_sprite.SetOpacity(1); + ex = cx - entry.GetWidth() / 2; + ey = spin_y + p.GetHeight() + 8; + entry_sprite.SetImage(entry); + entry_sprite.SetPosition(ex, ey, 3); + entry_sprite.SetOpacity(1); + for (i = 0; bullets[i]; i++) bullets[i].SetOpacity(0); + # as many bullets as fit in the box + shown = Math.Min(count, 20); + for (i = 0; i < shown; i++) { + bullets[i] = Sprite(bullet); + bullets[i].SetPosition(ex + 18 + i * 14, ey + entry.GetHeight() / 2 - bullet.GetHeight() / 2, 4); + bullets[i].SetOpacity(1); + } +} + +fun display_normal() { hide_password(); } + +Plymouth.SetDisplayPasswordFunction(display_password); +Plymouth.SetDisplayNormalFunction(display_normal); + +# one line of text at the bottom for messages ("checking the disk" and the like) +message_sprite = Sprite(); +fun show_message(text) { + m = Image.Text(text, 0.45, 0.48, 0.53, 1, "Inter 10"); + message_sprite.SetImage(m); + message_sprite.SetPosition(cx - m.GetWidth() / 2, Window.GetY() + Window.GetHeight() - 60, 5); +} +Plymouth.SetMessageFunction(show_message); + +fun quit() { + spin_sprite.SetOpacity(0); + track_sprite.SetOpacity(0); +} +Plymouth.SetQuitFunction(quit); diff --git a/tools/pkg/chamesle-plymouth/files/usr/share/plymouth/themes/chamesle/entry.png b/tools/pkg/chamesle-plymouth/files/usr/share/plymouth/themes/chamesle/entry.png Binary files differ. diff --git a/tools/pkg/chamesle-plymouth/files/usr/share/plymouth/themes/chamesle/logo.png b/tools/pkg/chamesle-plymouth/files/usr/share/plymouth/themes/chamesle/logo.png Binary files differ. diff --git a/tools/pkg/chamesle-plymouth/files/usr/share/plymouth/themes/chamesle/spinner.png b/tools/pkg/chamesle-plymouth/files/usr/share/plymouth/themes/chamesle/spinner.png Binary files differ. diff --git a/tools/pkg/chamesle-plymouth/files/usr/share/plymouth/themes/chamesle/track.png b/tools/pkg/chamesle-plymouth/files/usr/share/plymouth/themes/chamesle/track.png Binary files differ. diff --git a/tools/pkg/chamesle-plymouth/recipe b/tools/pkg/chamesle-plymouth/recipe @@ -0,0 +1,13 @@ +name=chamesle-plymouth +version=0.7.0 +rel=1 +desc="The Chamesle boot screen: the logo with a spinner under it" +url=https://chamesle.org +license=GPL-3.0-or-later +source= +makedeps="" +depends="plymouth" + +build() { + cp -a . "$pkgdir/" +} diff --git a/tools/pkg/chamesle-snapshots/files/etc/apk/commit_hooks.d/chamesle-snapshot.pre-commit b/tools/pkg/chamesle-snapshots/files/etc/apk/commit_hooks.d/chamesle-snapshot.pre-commit @@ -0,0 +1,9 @@ +#!/bin/sh +# a snapshot before every update (apk upgrade, the updater and the store), so a bad one can be undone from the +# boot menu. installing or removing an app doesn't take one, and neither does an upgrade with nothing to do. +# a pre-commit hook that fails stops the update, so this one never does +[ "$1" = pre-commit ] || exit 0 +tr '\0' ' ' < /proc/$PPID/cmdline 2>/dev/null | grep -qw upgrade || exit 0 +[ -n "$(apk list --upgradable 2>/dev/null)" ] || exit 0 +/usr/bin/chamesle-snapshot take || echo "chamesle-snapshot: no snapshot this time, updating anyway" >&2 +exit 0 diff --git a/tools/pkg/chamesle-snapshots/files/etc/grub.d/42_chamesle_snapshots b/tools/pkg/chamesle-snapshots/files/etc/grub.d/42_chamesle_snapshots @@ -0,0 +1,8 @@ +#!/bin/sh +# the snapshots from before updates (chamesle-snapshot). their menu is a file of its own, rewritten after each +# update, so updates don't have to rerun grub-mkconfig +cat <<EOT +if [ -f \${config_directory}/chamesle-snapshots.cfg ]; then + source \${config_directory}/chamesle-snapshots.cfg +fi +EOT diff --git a/tools/pkg/chamesle-snapshots/files/etc/xdg/autostart/chamesle-snapshot.desktop b/tools/pkg/chamesle-snapshots/files/etc/xdg/autostart/chamesle-snapshot.desktop @@ -0,0 +1,6 @@ +[Desktop Entry] +Type=Application +Name=Snapshot check +Comment=Offers to keep the system you started from a snapshot +Exec=chamesle-snapshot notice +NoDisplay=true diff --git a/tools/pkg/chamesle-snapshots/files/usr/bin/chamesle-snapshot b/tools/pkg/chamesle-snapshots/files/usr/bin/chamesle-snapshot @@ -0,0 +1,156 @@ +#!/bin/bash +# system snapshots: one before every update, the last 3 kept, each one bootable from the boot menu +# chamesle-snapshot list +# chamesle-snapshot take (root; the apk hook runs it before upgrades) +# chamesle-snapshot restore [ID] (root; ID defaults to the snapshot you started from) +# chamesle-snapshot notice (at login: offers to keep the snapshot you started from) +# only on btrfs with the system in the @ subvolume, what the installer makes from 0.4 on. the snapshots are of @ +# only: your files are in @home and never go back in time +set -euo pipefail +KEEP=3 +TOP=/run/chamesle-snapshots # the whole btrfs, mounted while we work on it +BOOT=/boot/chamesle-snapshots # kernel and initramfs of each snapshot, where grub can read them +CFG=/boot/grub/chamesle-snapshots.cfg + +die() { echo "chamesle-snapshot: $*" >&2; exit 1; } +# where / comes from: /@ normally, /@snapshots/ID when started from a snapshot +fsroot() { findmnt -no FSROOT /; } +supported() { + [ "$(findmnt -no FSTYPE / 2>/dev/null)" = btrfs ] || return 1 + case $(fsroot) in /@|/@snapshots/*) return 0;; esac + return 1 +} +started_from() { case $(fsroot) in /@snapshots/*) basename "$(fsroot)";; esac; } +device() { findmnt -no SOURCE / | sed 's/\[.*//'; } +val() { sed -n "s/^$2=//p" "$BOOT/$1/info" 2>/dev/null; } +ids() { ls -1 "$BOOT" 2>/dev/null | grep -E '^[0-9]{8}-[0-9]{6}$' | sort || true; } + +mount_top() { + mkdir -p $TOP + mountpoint -q $TOP || mount -o subvolid=5 "$(device)" $TOP + trap 'umount -R $TOP 2>/dev/null; rmdir $TOP 2>/dev/null; true' EXIT +} + +# the "before an update" submenu, newest first +menu() { + if [ -z "$(ids)" ]; then rm -f $CFG; return; fi + local uuid args access rel id + # grub's own helpers, which use variables that aren't set + set +u + . /usr/share/grub/grub-mkconfig_lib + uuid=$(findmnt -no UUID /) + # the same options the system started with, pointed at the snapshot + args=$(tr ' ' '\n' < /proc/cmdline | grep -vE '^(BOOT_IMAGE|root|rootflags|initrd)=' | grep -v '^$' | tr '\n' ' ') + access=$(prepare_grub_to_access_device $(grub-probe --target=device $BOOT) | sed 's/^/\t/') + rel=$(grub-mkrelpath $BOOT) + set -u + # without these lines grub would look on the wrong disk: better no new entries than broken ones + grep -q search <<< "$access" || { echo "chamesle-snapshot: grub can't find /boot, boot menu not updated" >&2; return 0; } + { + echo "submenu 'Chamesle Linux, from before an update' {" + for id in $(ids | sort -r); do + echo " menuentry 'Before the update of $(val $id date)' {" + echo "$access" + echo " linux $rel/$id/vmlinuz root=UUID=$uuid rootflags=subvol=@snapshots/$id $args" + echo " initrd $rel/$id/initramfs.img" + echo " }" + done + echo "}" + } > $CFG.new + mv $CFG.new $CFG +} + +take() { + supported || exit 0 + [ -z "$(started_from)" ] || { echo "chamesle-snapshot: started from a snapshot, not taking another one" >&2; exit 0; } + local k id + # the kernel the system boots now, which the snapshot has the modules for + k=$(ls /boot/vmlinuz-* 2>/dev/null | sed 's#.*/vmlinuz-##' | sort -V | tail -n1) + [ -n "$k" ] && [ -f /boot/initramfs-$k.img ] || die "no kernel and initramfs in /boot" + mount_top + id=$(date +%Y%m%d-%H%M%S) + mkdir -p $TOP/@snapshots $BOOT/$id + btrfs -q subvolume snapshot $TOP/@ $TOP/@snapshots/$id + cp --reflink=auto /boot/vmlinuz-$k $BOOT/$id/vmlinuz + cp --reflink=auto /boot/initramfs-$k.img $BOOT/$id/initramfs.img + printf 'date=%s\nkernel=%s\n' "$(LC_ALL=C date '+%-d %b %Y, %H:%M')" "$k" > $BOOT/$id/info + # a system replaced by restore, and snapshots without their boot files, can't be started: they go first + for d in $TOP/@snapshots/*; do + [ -d "$d" ] && [ ! -f "$BOOT/${d##*/}/info" ] && btrfs -q subvolume delete "$d" || true + done + for id in $(ids | head -n -$KEEP); do + btrfs -q subvolume delete $TOP/@snapshots/$id 2>/dev/null || true + rm -rf "${BOOT:?}/$id" + done + for id in $(ids); do [ -d $TOP/@snapshots/$id ] || rm -rf "${BOOT:?}/$id"; done + menu +} + +list() { + supported || { echo "no snapshots: they need a system installed on btrfs (from Chamesle 0.4 on)"; return; } + local id now + now=$(started_from) + for id in $(ids | sort -r); do + echo "$id before the update of $(val $id date)$([ "$id" = "$now" ] && echo ' (running now)')" + done +} + +restore() { + supported || die "snapshots need a system installed on btrfs" + local id=${1:-$(started_from)} k new + [ -n "$id" ] || die "which one? see chamesle-snapshot list" + [[ $id =~ ^[0-9]{8}-[0-9]{6}$ ]] && [ -f $BOOT/$id/info ] || die "no snapshot $id" + mount_top + [ -d $TOP/@snapshots/$id ] || die "no snapshot $id" + # the system being replaced stays until the next update, in case + mv $TOP/@ $TOP/@snapshots/replaced-$(date +%Y%m%d-%H%M%S) + btrfs -q subvolume snapshot $TOP/@snapshots/$id $TOP/@ + # finish from inside the restored system, so the boot menu is made the way it sees itself + new=$TOP/new + mkdir -p $new + mount -o subvol=@ "$(device)" $new + # rslave: unmounting these again can't take the real /dev and /sys with it + for d in dev proc sys; do mount --rbind /$d $new/$d; mount --make-rslave $new/$d; done + mountpoint -q /boot && mount --bind /boot $new/boot + chroot $new /usr/bin/chamesle-snapshot settle $id + echo "done: restart and Chamesle starts as it was before the update of $(val $id date)" +} + +# inside the restored system: its kernel back in /boot, kernels it has no modules for out, then the boot menu +settle() { + local id=$1 k f v + if mountpoint -q /boot; then + k=$(val $id kernel) + cp $BOOT/$id/vmlinuz /boot/vmlinuz-$k + cp $BOOT/$id/initramfs.img /boot/initramfs-$k.img + for f in /boot/vmlinuz-*; do + v=${f#/boot/vmlinuz-} + [ -d /usr/lib/modules/$v ] || rm -f /boot/vmlinuz-$v /boot/initramfs-$v.img /boot/config-$v /boot/System.map-$v + done + fi + grub-mkconfig -o /boot/grub/grub.cfg >/dev/null 2>&1 + menu +} + +# at login, when started from a snapshot from the boot menu +notice() { + local id + id=$(started_from) + [ -n "$id" ] || exit 0 + zenity --question --width 420 --title "Started from before an update" \ + --text "This is Chamesle as it was before the update of $(val $id date).\n\nIf that update broke something, keep this one and it's your system from the next restart. Your files stay as they are either way." \ + --ok-label "Keep this one" --cancel-label "Not now" || exit 0 + if pkexec /usr/bin/chamesle-snapshot restore $id; then + zenity --info --width 380 --title "Done" --text "Restart, and Chamesle starts as it is now." + else + zenity --error --width 380 --title "That didn't work" --text "Nothing was changed. Try again, or ask on the board." + fi +} + +case ${1:-} in +take|list|menu) "$1";; +restore) restore "${2:-}";; +settle) settle "$2";; +notice) notice;; +*) sed -n '2,8s/^# \?//p' "$0" >&2; exit 2;; +esac diff --git a/tools/pkg/chamesle-snapshots/post-install b/tools/pkg/chamesle-snapshots/post-install @@ -0,0 +1,6 @@ +#!/bin/sh +# puts the "before an update" submenu in the boot menu. systems on ext4 (installed before 0.4) don't get snapshots +if [ -f /boot/grub/grub.cfg ] && [ "$(findmnt -no FSTYPE / 2>/dev/null)" = btrfs ]; then + grub-mkconfig -o /boot/grub/grub.cfg >/dev/null 2>&1 +fi +exit 0 diff --git a/tools/pkg/chamesle-snapshots/post-upgrade b/tools/pkg/chamesle-snapshots/post-upgrade @@ -0,0 +1,6 @@ +#!/bin/sh +# puts the "before an update" submenu in the boot menu. systems on ext4 (installed before 0.4) don't get snapshots +if [ -f /boot/grub/grub.cfg ] && [ "$(findmnt -no FSTYPE / 2>/dev/null)" = btrfs ]; then + grub-mkconfig -o /boot/grub/grub.cfg >/dev/null 2>&1 +fi +exit 0 diff --git a/tools/pkg/chamesle-snapshots/recipe b/tools/pkg/chamesle-snapshots/recipe @@ -0,0 +1,13 @@ +name=chamesle-snapshots +version=0.4.0 +rel=1 +desc="A snapshot of the system before every update, bootable from the boot menu" +url=https://chamesle.org +license=GPL-3.0-or-later +source= +makedeps="" +depends="btrfs-progs grub util-linux coreutils zenity" + +build() { + cp -a . "$pkgdir/" +} diff --git a/tools/repo/upload.sh b/tools/repo/upload.sh @@ -14,7 +14,9 @@ case "${1:-}" in iso) ;; publish) - rsync -av --partial --progress -e ssh work/publish/x86_64/ "$DEST/x86_64/" + # the packages first, then the index that names them: never an index pointing at files that aren't there yet + rsync -av --partial --progress -e ssh --exclude Packages.adb work/publish/x86_64/ "$DEST/x86_64/" + rsync -av --partial --progress -e ssh work/publish/x86_64/Packages.adb "$DEST/x86_64/" exit 0 ;; core) diff --git a/tools/themes.sh b/tools/themes.sh @@ -8,10 +8,17 @@ GTK_SHA256=bedc51e07ca4edaeb3bdd50e9e2a27c10f1b049f460b10e3b5668d11ff2b03cd ICONS_TAG=2026-07-27 ICONS_SHA256=24a8aca29a5b652a0e60ff8e5f12b86fe4b9c4c969565fad7c3fa7c1742b3631 W=$(mktemp -d); trap 'rm -rf "$W"' EXIT +# downloads are kept here, so every edition's build doesn't fetch them from github again +SRC=${SRC_CACHE:-$HOME/.cache/chamesle-src} fetch() { # REPO TAG SHA256 - curl -fsSL --retry 5 --retry-all-errors -o "$W/$1.tar.gz" "https://github.com/vinceliuice/$1/archive/refs/tags/$2.tar.gz" - [ "$(sha256sum "$W/$1.tar.gz" | cut -d' ' -f1)" = "$3" ] || { echo "themes: checksum mismatch for $1" >&2; exit 1; } - tar -xzf "$W/$1.tar.gz" -C "$W" + f=$SRC/$1-$2.tar.gz + if [ ! -f "$f" ]; then + mkdir -p "$SRC" + curl -fsSL --retry 5 --retry-all-errors -C - -o "$f.part" "https://github.com/vinceliuice/$1/archive/refs/tags/$2.tar.gz" + mv "$f.part" "$f" + fi + [ "$(sha256sum "$f" | cut -d' ' -f1)" = "$3" ] || { echo "themes: checksum mismatch for $1" >&2; rm -f "$f"; exit 1; } + tar -xzf "$f" -C "$W" } fetch Fluent-gtk-theme "$GTK_TAG" "$GTK_SHA256" fetch Fluent-icon-theme "$ICONS_TAG" "$ICONS_SHA256"