From 04c7694e3f9712c7fb76a92c9213f00cbd57a9cd Mon Sep 17 00:00:00 2001 From: humocs-man Date: Sat, 31 Oct 2026 17:44:19 +0100 Subject: [PATCH] fix: Review-Funde 2-6 und Kleinigkeiten beheben MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fontconfig-Drop-in nach /etc/fonts/conf.d, Noto Serif ergänzt - Flatpak-Erstboot: Timeout und Pflicht-Ref-Check vor dem Marker - .dockerignore für schlanken Build-Kontext - tmpfiles-Regel mit zz-Prefix für deterministische Reihenfolge - seed-labwc-skel: Fail-fast-Backup, Modus-Erhalt, Env-Migrationen - W-d-Migration trifft nur aktive Keybinds (Platzhalter-Kommentar) - labwc-appmenu: OnlyShowIn/NotShowIn berücksichtigen - notify-bootc-user: SIGTERM mit --kill-after statt SIGKILL - Doku/Kommentare korrigiert, AGENTS.md aufgenommen --- .dockerignore | 22 +++ AGENTS.md | 125 ++++++++++++++++++ Containerfile | 16 ++- README.md | 2 +- build/20-desktop-labwc.sh | 1 + build/README.md | 14 +- configs/bootc-timer-override.conf | 4 +- configs/flatpak-preinstall.service | 8 ++ configs/skel/.config/labwc/environment | 10 +- ...eed.conf => zz-noctalia-greeter-seed.conf} | 6 + scripts/flatpak-preinstall-check.sh | 56 ++++++++ scripts/kanshi-autoconfig | 2 +- scripts/labwc-appmenu | 21 +++ scripts/notify-bootc-user.sh | 4 +- scripts/seed-labwc-skel.sh | 99 +++++++++++--- 15 files changed, 358 insertions(+), 32 deletions(-) create mode 100644 .dockerignore create mode 100644 AGENTS.md rename configs/tmpfiles/{noctalia-greeter-seed.conf => zz-noctalia-greeter-seed.conf} (67%) create mode 100755 scripts/flatpak-preinstall-check.sh diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..2806273 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,22 @@ +# Build-Kontext minimal halten. Der Containerfile nutzt nur build/, configs/, +# scripts/ und cosign.pub; der Rest sind lokale Artefakte (ISO-Builds legen +# output/ und _build* an) bzw. Metadaten. +.git +.gitea +output/ +_build* +*.iso +*.qcow2 +*.raw +*.log +cosign.key +**/__pycache__/ +**/*.pyc +previous.manifest.json +changelog.md +output.env +.env +.env.* + +# configs/auth.json wird bewusst NICHT ignoriert: der Containerfile COPYt es +# ins Image (Justfile/CI erzeugen es aus configs/auth.json.template). diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..1d6b28d --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,125 @@ +# AGENTS.md — fluffy-pancake + +Personal bootc OS image (Fedora base). **This is not an application**: there is no +app entrypoint, no test suite, no package manager of our own. The deliverable is +a container image and an installer ISO built from it. + +## Branches (they are NOT interchangeable) + +| Branch | Base | Desktop | Targets | Tags | +|---|---|---|---|---| +| `main` | `fedora-kinoite:44` | Plasma | qcow2/raw **and** ISO | `:stable` (+ dated) | +| `feat/labwc-noctalia` (this one) | `fedora-bootc:44` minimal | labwc + Noctalia Shell v5 + greetd | **ISO only** | `test-` | + +The `Justfile` differs per branch. Do not port `main`'s qcow2/raw targets here. + +## Layout + +- `Containerfile` — the image. Multi-stage: `FROM scratch AS build-ctx` holds only + `build/`, then numbered package layers, a "config" layer (`COPY` of `configs/`, + `scripts/`), cleanup, and `bootc container lint` as the last line. +- `build/NN-*.sh` — build-time package installs, bind-mounted **one file per layer** + from `build-ctx`. The number is both execution order and cache isolation. +- `configs/` — files copied into the image (systemd drop-ins, skel, greetd, + `containers/policy.json`, `auth.json.template`). +- `scripts/` — helper scripts that land in `/usr/bin` of the image. +- `iso/iso.toml` — Bootc Image Builder ISO config + Anaconda kickstart; + `iso/disk.toml` — filesystem sizing. +- `.gitea/workflows/build-v2.yml` — the only build workflow. + +## Commands + +```bash +just lint # shellcheck over every *.sh (build/ + scripts/) +just format # shfmt --write over every *.sh +just check # `just --unstable --fmt --check` on Justfile + *.just +just fix # ditto, formatting +just build # podman build of the Containerfile +just rebuild-iso # local podman build -> ISO (needs root/sudo) +just build-iso # pull published image from registry -> ISO +just run-vm-iso # boot the ISO in QEMU (needs /dev/kvm) +just clean # remove output/ and _build* dirs +``` + +`just lint` ist jetzt grün: Die früheren 5 Findings (`SC2086` in +`build/10-repos.sh` und `build/22-noctalia.sh`, `SC2043` in +`build/23-plymouth.sh`) wurden behoben. `just format` runs shfmt +with default options (tabs) while the scripts are indented with spaces — it will +reindent every script, so don't run it repo-wide unless that reformat is intended. + +There is **no test suite**. Verification chain is: `just lint` → container build +(ends in `bootc container lint`) → ISO build → boot the ISO and look at the screen. + +Required local binaries: `just`, `podman`, `shellcheck`, `shfmt`. (This sandbox +currently has only `shellcheck`, so builds cannot be run here.) + +## Gotchas an agent will otherwise get wrong + +1. **`configs/auth.json` is gitignored (secret) but the Containerfile `COPY`s it.** + A bare `podman build` fails at that COPY. `just build`/`just rebuild-iso` + generate a dummy from `configs/auth.json.template` + (`READONLY_TOKEN_PLACEHOLDER`). CI substitutes the real token from secret + `READONLY_AUTH_BASE64`. +2. **`iso/iso.toml` hardcodes `humocs-man.duckdns.org/humocs-man/fluffy-pancake:stable`.** + The Justfile `sed`s exactly that literal to retarget test ISOs. If you change + the registry/image name in the Justfile you must change the literal too — + otherwise a locally built ISO silently installs `:stable` instead of the test image. +3. **ISO builds need rootful podman.** BIB runs `--privileged` and mounts + `/var/lib/containers/storage`; local images are built as `localhost/` + and copied into rootful storage via `podman save`/`load`. `just sudoif` handles + the root/sudo dance. +4. **Package manager is `dnf5`**, never `dnf`/`yum`, always with `-y`. +5. **bootc discards `/var` at deployment.** Anything written to `/var` during the + build is gone on first boot. Seed `/var` via `tmpfiles.d` + (`configs/tmpfiles/`) or a first-boot systemd unit (`configs/flatpak-preinstall.service`). + Only `/etc` and `/usr` survive. +6. **Systemd overrides go to `/usr/lib/systemd/system/.d/*.conf`** + (vendor drop-in), never `/etc/systemd/system/`. Use `chmod 0644` for the + `*.conf` files — world-writable units make systemd shout in the journal. + Units delivered via `COPY` are not picked up by presets, so `systemctl enable` + them explicitly. **Achtung:** `COPY --chmod=0644 …/.d/override.conf` + erzeugt das Parent-Verzeichnis selbst mit Modus `0644` (nicht ausfuehrbar), + systemd kann dann die Drop-ins nicht lesen. Nach solchen COPYs explizit + `RUN chmod 0755 /usr/lib/systemd/system/.d` setzen (gilt analog fuer + andere neu angelegte `.d`-Verzeichnisse wie fontconfig/conf.d). +7. **Keep one concern per `build/NN-*.sh`.** Each is a separate bind mount, so + editing one script busts only that layer. Merging scripts busts the big + download layers. +8. **`configs/skel` only affects newly created users.** Existing systems need + `seed-labwc-skel` (shipped in the image) to migrate; skel changes alone never + reach them. +9. **The build asserts fail fast** (greetd/PAM wiring, `pam_fprintd`, the + `noctalia-greeter-session` wrapper path, plymouth initramfs). These guard + against shipping a broken login screen — fix the cause, don't delete the assert. +10. **Cosign uses the legacy `.sig` format** (`--registry-referrers-mode=legacy`) + because `configs/containers/policy.json` demands `sigstoreSigned`. Switching + to OCI referrers breaks pulls of the image. +11. **The `--build-arg SHA_HEAD_SHORT` passed by the Justfile is not consumed** + (the Containerfile declares no `ARG`) — it does not appear in image metadata. + +## CI / publishing + +- `.gitea/workflows/build-v2.yml` is **manual only** (`workflow_dispatch`), despite + the README mentioning PR validation — no PR trigger is configured. Add + `pull_request:` to `on:` to enable it (the `pull_request` guards already exist). +- Chain: Buildx → OCI archive tar → `skopeo copy --dest-compress-format zstd:chunked` + → recursive `cosign sign`. Skopeo is used deliberately to guarantee zstd:chunked. +- Tags: `main` → `stable`, `stable.YYYYMMDD`, `YYYYMMDD`; any other branch → + `test-` only (no dated variants). +- Secrets: `READONLY_AUTH_BASE64`, `REGISTRY`, `SIGNING_SECRET`, `RENOVATE_TOKEN`. +- Registry cache tag `buildcache-amd64-main` is shared across branches. +- The registry (`humocs-man.duckdns.org/humocs-man`) is private — pulls need auth. +- Renovate (`renovate.json`) runs nightly at 03:00 UTC via + `.gitea/workflows/renovate_v2.yml`. That workflow intentionally uses + `docker run renovate/renovate` instead of GitHub-hosted actions, because + github.com actions require a GitHub account. Keep it that way. + +## Conventions + +- Comments and commit messages are in **German**; commits use Conventional Commits + prefixes (`feat:`, `fix:`, `chore:`, `refactor:`). Match that style. +- Shell scripts: `set -eoux pipefail` (build scripts) / `set -euo pipefail` (image + runtime scripts), 4-space indentation, shellcheck-clean for new code. +- The codebase documents *why* extensively, especially for workarounds + (Terra CDN hiccups, PAM auth stacks, bootc `/var` semantics). Preserve that + reasoning in comments when changing these areas. diff --git a/Containerfile b/Containerfile index bdc8268..6fba333 100644 --- a/Containerfile +++ b/Containerfile @@ -131,6 +131,7 @@ COPY --chmod=755 scripts/seed-labwc-skel.sh /usr/bin/seed-labwc-skel COPY --chmod=755 scripts/labwc-appmenu /usr/bin/labwc-appmenu COPY --chmod=755 scripts/bing-wallpaper.sh /usr/bin/bing-wallpaper.sh COPY --chmod=755 scripts/bing-wallpaper-toggle.sh /usr/bin/bing-wallpaper-toggle.sh +COPY --chmod=755 scripts/flatpak-preinstall-check.sh /usr/bin/flatpak-preinstall-check.sh # Desktop-Datei fuer den Toggle (Noctalia-Launcher findet ihn als App) COPY --chmod=0644 configs/applications/bing-wallpaper-toggle.desktop /usr/share/applications/bing-wallpaper-toggle.desktop @@ -154,8 +155,13 @@ RUN chmod -R go-w /etc/skel COPY --chmod=0644 configs/wayland-sessions/labwc.desktop /usr/share/wayland-sessions/labwc.desktop # Fontconfig-Defaults (Noto statt DejaVu) -COPY --chmod=0644 configs/fontconfig/60-fluffy-noto.conf /usr/share/fontconfig/conf.d/60-fluffy-noto.conf -RUN chmod 0755 /usr/share/fontconfig/conf.d +# Ziel ist /etc/fonts/conf.d: nur dieser Pfad wird von /etc/fonts/fonts.conf +# eingelesen. /usr/share/fontconfig/conf.avail ist ein Vorlagen-Verzeichnis +# (Pakete verlinken daraus selbst nach conf.d) - ein Drop-in dort ist wirkungslos. +COPY --chmod=0644 configs/fontconfig/60-fluffy-noto.conf /etc/fonts/conf.d/60-fluffy-noto.conf +# COPY --chmod=0644 legt fehlende Parent-Dirs mit Modus 0644 an; fontconfig +# kann ein nicht durchsuchbares Verzeichnis nicht lesen. +RUN chmod 0755 /etc/fonts/conf.d # greetd-Konfiguration (Noctalia-Greeter + tuigreet-Fallback dokumentiert) COPY --chmod=0644 configs/greetd/config.toml /etc/greetd/config.toml @@ -163,7 +169,9 @@ COPY --chmod=0644 configs/greetd/config.toml /etc/greetd/config.toml # Noctalia-Greeter Standardwerte (de-Tastatur etc., werden per tmpfiles # beim Erst-Boot nach /var/lib/noctalia-greeter/greeter.toml kopiert) COPY --chmod=0644 configs/noctalia-greeter/greeter.toml.default /usr/share/noctalia-greeter/greeter.toml.default -COPY --chmod=0644 configs/tmpfiles/noctalia-greeter-seed.conf /usr/lib/tmpfiles.d/noctalia-greeter-seed.conf +# Dateiname mit zz-Prefix: tmpfiles.d verarbeitet Drop-ins lexikografisch, +# unser chown/C muss nach dem Paket-Drop-in (noctalia-greeter.conf) laufen. +COPY --chmod=0644 configs/tmpfiles/zz-noctalia-greeter-seed.conf /usr/lib/tmpfiles.d/zz-noctalia-greeter-seed.conf # Fail-fast + Selbstheilung: Der Session-Wrapper-Pfad wird aus dem real # installierten Paket aufgeloest und in die greetd-Config uebernommen. @@ -212,7 +220,7 @@ RUN systemctl enable \ # SELinux-Labels fuer Greeter/Skel/Sessions/Greeter-Defaults/Skripte # (Fehler tolerieren, Labels werden beim Deployment ggf. erneut gesetzt) -RUN restorecon -Rv /etc/greetd /etc/skel /usr/share/wayland-sessions /usr/share/noctalia-greeter /usr/bin/noctalia-greeter-session /usr/bin/kanshi-autoconfig /usr/bin/seed-labwc-skel /usr/bin/labwc-appmenu /usr/bin/bing-wallpaper.sh /usr/bin/bing-wallpaper-toggle.sh 2>/dev/null || true +RUN restorecon -Rv /etc/greetd /etc/skel /usr/share/wayland-sessions /usr/share/noctalia-greeter /usr/bin/noctalia-greeter-session /usr/bin/kanshi-autoconfig /usr/bin/seed-labwc-skel /usr/bin/labwc-appmenu /usr/bin/bing-wallpaper.sh /usr/bin/bing-wallpaper-toggle.sh /usr/bin/flatpak-preinstall-check.sh 2>/dev/null || true ############################################################################### # PRE-FINAL CLEANUP diff --git a/README.md b/README.md index 95f7024..2c99cea 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ This repository maintains two branches with different base systems and desktop s - **`feat/labwc-noctalia`** – experimental branch. Base: `quay.io/fedora/fedora-bootc:44` (minimal), desktop built from scratch with **labwc** (Wayland compositor) + **Noctalia Shell** (native v5) + **greetd** (Noctalia Greeter). ISO-only build target (`build-iso`/`rebuild-iso`); no QCOW2/RAW. - Produces `test-feat-labwc-noctalia` (and dated) tags on non-main builds. + Produces the `test-feat-labwc-noctalia` tag (no dated variant) on non-main builds. The two branches share the bootc build infrastructure (Justfile, Gitea workflow, signing) but differ in packages, desktop configuration and supported artifact types. ISOs are built locally from images in the private registry using the Justfile. diff --git a/build/20-desktop-labwc.sh b/build/20-desktop-labwc.sh index 9d8cebe..143b692 100755 --- a/build/20-desktop-labwc.sh +++ b/build/20-desktop-labwc.sh @@ -41,6 +41,7 @@ dnf5 install -y \ accountsservice \ google-noto-sans-fonts \ google-noto-sans-mono-fonts \ + google-noto-serif-fonts \ google-noto-color-emoji-fonts \ glibc-langpack-de \ adwaita-icon-theme \ diff --git a/build/README.md b/build/README.md index f4a6f39..00d67b6 100644 --- a/build/README.md +++ b/build/README.md @@ -42,14 +42,20 @@ dnf5 install -y --allowerasing some-package ### Script deaktivieren -Ohne Loeschen deaktivieren: -- Umbenennen: `20-script.sh` → `20-script.sh.disabled` -- Execute-Recht entfernen: `chmod -x build/20-script.sh` +Die Scripts werden per Bind-Mount aus dem Containerfile aufgerufen +(`bash /tmp/NN-*.sh`); Datei-Modus und Dateiname allein deaktivieren nichts. +Zum Deaktivieren: + +- den zugehoerigen `RUN`-Layer im `Containerfile` auskommentieren, **oder** +- im Script nach dem `set`-Header frueh `exit 0` setzen (Layer bleibt, wird + aber zum No-Op). + +Umbenennen bricht den Build: der Bind-Mount zeigt auf den alten Dateinamen. ## Ausfuehrung im Containerfile ```dockerfile -RUN --mount=type=bind,from=ctx,source=/build/10-repos.sh,target=/tmp/10-repos.sh \ +RUN --mount=type=bind,from=build-ctx,source=/build/10-repos.sh,target=/tmp/10-repos.sh \ --mount=type=cache,dst=/var/cache \ --mount=type=tmpfs,dst=/tmp \ bash /tmp/10-repos.sh && dnf5 clean all diff --git a/configs/bootc-timer-override.conf b/configs/bootc-timer-override.conf index fe58067..ca2d550 100644 --- a/configs/bootc-timer-override.conf +++ b/configs/bootc-timer-override.conf @@ -4,8 +4,8 @@ OnBootSec= OnUnitInactiveSec= OnCalendar= -# Prüfe jeden Tag um 20:00 Uhr -# Das deckt Di & Fr ab und fängt auch manuelle Builds vom Vortag ein +# Täglich um 20:00 Uhr. Persistent=true holt verpasste Läufe beim nächsten +# Start nach (deckt damit auch Builds vom Vortag ab). OnCalendar=*-*-* 20:00:00 # Falls der Rechner aus war: Sofort beim nächsten Start nachholen! diff --git a/configs/flatpak-preinstall.service b/configs/flatpak-preinstall.service index c2d9e30..63d5f3c 100644 --- a/configs/flatpak-preinstall.service +++ b/configs/flatpak-preinstall.service @@ -6,6 +6,9 @@ ConditionPathExists=!/var/lib/flatpak/.preinstall-done [Service] Type=oneshot +# Ohne Limit haengt ein lahmes/fehlendes Netz den Bootvorgang unbegrenzt +# (network-online.target ist nur eine Wartezeit, keine Garantie). +TimeoutStartSec=15min ExecStartPre=/usr/bin/flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo # Systemweite Extra-Sprachen (hier, nicht im Build-Skript: schreibt nach # /var, das es nur zur Laufzeit gibt). VOR install, damit Locale- @@ -30,6 +33,11 @@ ExecStart=-/usr/bin/flatpak install -y flathub org.gtk.Gtk3theme.adw-gtk3-dark # installierte Apps (kein Override pro App noetig, Neustart genuegt). # Chromium/Brave ignoriert GTK-CSS ohnehin (nur Hell/Dunkel per Portal). ExecStart=/usr/bin/flatpak override --system --filesystem=xdg-config/gtk-3.0:ro --filesystem=xdg-config/gtk-4.0:ro +# Die install-Zeilen oben sind absichtlich mit "-" bestellt, melden systemd +# also nie einen Fehler. Dieser Check macht Pflicht-Refs (Bazaar, adw-gtk3- +# Themes) zur echten Fehlerbedingung: Schlaegt er fehl, wird der Marker +# unten nicht gesetzt und der naechste Boot versucht es erneut. +ExecStart=/usr/bin/flatpak-preinstall-check.sh ExecStartPost=/usr/bin/touch /var/lib/flatpak/.preinstall-done ExecStartPost=/usr/bin/systemctl disable flatpak-preinstall.service RemainAfterExit=yes diff --git a/configs/skel/.config/labwc/environment b/configs/skel/.config/labwc/environment index 8039afe..8e887c5 100644 --- a/configs/skel/.config/labwc/environment +++ b/configs/skel/.config/labwc/environment @@ -5,8 +5,11 @@ LANG=de_DE.UTF-8 XKB_DEFAULT_LAYOUT=de XKB_DEFAULT_VARIANT=nodeadkeys -QT_QPA_PLATFORM=wayland -GDK_BACKEND=wayland +# Wayland zuerst, X11 als Fallback: reines "wayland" laesst X11-only-Apps +# (aeltere Java-/Wine-/Electron-Builds) mit "cannot open display" scheitern. +# Die Listen werden von Qt/GDK in dieser Reihenfolge probiert. +QT_QPA_PLATFORM=wayland;xcb +GDK_BACKEND=wayland,x11 # Native Electron-Apps (Brave nativ, VS Code u.a.) direkt auf Wayland # statt XWayland-Umweg. Flatpaks bringen eigenes Env mit (unberuehrt). ELECTRON_OZONE_PLATFORM_HINT=wayland @@ -16,5 +19,6 @@ XCURSOR_SIZE=24 XCURSOR_THEME=Adwaita XDG_CURRENT_DESKTOP=labwc XDG_SESSION_TYPE=wayland -MOZ_ENABLE_WAYLAND=1 +# MOZ_ENABLE_WAYLAND entfaellt: seit Firefox 121 ist Wayland der Default, +# die Variable ist wirkungslos (nur noch fuer alte ESR-Staende relevant). TERMINAL=gnome-terminal diff --git a/configs/tmpfiles/noctalia-greeter-seed.conf b/configs/tmpfiles/zz-noctalia-greeter-seed.conf similarity index 67% rename from configs/tmpfiles/noctalia-greeter-seed.conf rename to configs/tmpfiles/zz-noctalia-greeter-seed.conf index 1186e42..27efb72 100644 --- a/configs/tmpfiles/noctalia-greeter-seed.conf +++ b/configs/tmpfiles/zz-noctalia-greeter-seed.conf @@ -1,3 +1,9 @@ +# Dateiname bewusst mit "zz-"-Prefix: tmpfiles.d verarbeitet Drop-ins +# lexikografisch. Das Paket-Drop-in (noctalia-greeter.conf) legt dasselbe +# Verzeichnis als root an; ohne Prefix haengt die Reihenfolge davon ab, ob +# "noctalia-greeter.conf" vor "zz-..." sortiert - der chown unten wuerde +# sonst ueberschrieben. +# # Verzeichnis gehoert dem Greeter: Er muss sync.toml schreiben koennen # (sonst: "greetd user needs write access", siehe Journal). # Das Paket legt das Verzeichnis per eigenem tmpfiles.d als root an; diff --git a/scripts/flatpak-preinstall-check.sh b/scripts/flatpak-preinstall-check.sh new file mode 100755 index 0000000..906e420 --- /dev/null +++ b/scripts/flatpak-preinstall-check.sh @@ -0,0 +1,56 @@ +#!/usr/bin/bash +# flatpak-preinstall-check: verifiziert die Erst-Boot-Installation aus +# flatpak-preinstall.service. +# +# Hintergrund: Die install-ExecStart-Zeilen dort sind mit "-" bestellt, damit +# ein einzelnes fehlendes Paket nicht den ganzen Lauf abbricht. Genau dadurch +# sieht systemd aber nie einen Fehler - ohne diesen Check wuerde der Service +# auch eine komplett fehlgeschlagene Installation (z.B. kein Netz beim +# Erst-Boot) als "erledigt" markieren und nie wiederholen. +# +# Pflicht (Exit 1 -> Marker wird NICHT gesetzt, naechster Boot versucht es +# erneut): +# - Bazaar als App-Store +# - die beiden adw-gtk3-Themes (Noctalia-Theme fuer Flatpak-GTK3-Apps) +# Optional (nur Warnung, blockiert den Marker nicht): +# - Brave, DistroShelf +set -euo pipefail + +FLATPAK="${FLATPAK:-/usr/bin/flatpak}" + +if [[ ! -x "${FLATPAK}" ]]; then + echo "FEHLER: ${FLATPAK} fehlt - Flatpak-Installation nicht pruefbar" >&2 + exit 1 +fi + +# Installierte Refs (Apps, Runtimes, Extensions) als "typ/id/arch/branch". +# Der Vergleich auf "/id/" trifft dadurch exakt (adw-gtk3-dark ist nicht +# Teil von adw-gtk3, sondern ein eigener Ref). +refs="$("${FLATPAK}" list --columns=ref 2>/dev/null || true)" + +is_installed() { # $1 = Ref-ID + grep -q "/$1/" <<<"${refs}" +} + +rc=0 +for ref in \ + io.github.kolunmi.Bazaar \ + org.gtk.Gtk3theme.adw-gtk3 \ + org.gtk.Gtk3theme.adw-gtk3-dark; do + if is_installed "${ref}"; then + echo "OK: ${ref} installiert" + else + echo "FEHLER: ${ref} fehlt (Pflicht) - Erstinstallation wird beim naechsten Boot wiederholt" >&2 + rc=1 + fi +done + +for ref in com.brave.Browser com.ranfdev.DistroShelf; do + if is_installed "${ref}"; then + echo "OK: ${ref} installiert" + else + echo "WARN: ${ref} fehlt (optional) - bei Bedarf per Bazaar nachinstallieren" >&2 + fi +done + +exit "${rc}" diff --git a/scripts/kanshi-autoconfig b/scripts/kanshi-autoconfig index 4fa51da..d01c8a1 100755 --- a/scripts/kanshi-autoconfig +++ b/scripts/kanshi-autoconfig @@ -59,7 +59,7 @@ _VM_CACHE = None def detect_vm(): """True, wenn wir virtualisiert laufen (QEMU/Boxes-Test). Einmalig - gecached (wird im Watch-Poll sonst alle 5 s neu gespawnt).""" + gecached (wird im Watch-Poll sonst alle 10 s neu gespawnt).""" global _VM_CACHE if _VM_CACHE is None: try: diff --git a/scripts/labwc-appmenu b/scripts/labwc-appmenu index c83ba1a..1b07987 100755 --- a/scripts/labwc-appmenu +++ b/scripts/labwc-appmenu @@ -9,6 +9,8 @@ Pipe-Menues nur, solange das Menue offen ist) - neu installierte Apps - Deutsche Namen via Name[de], sonst Name - Kategorien nach Freedesktop-Mapping, Rest unter "Sonstige" - NoDisplay/Hidden sowie fehlende TryExec-Binaries werden uebersprungen +- OnlyShowIn/NotShowIn gegen XDG_CURRENT_DESKTOP gefiltert (z.B. keine + KDE-/GNOME-only-Werkzeuge im labwc-Menue) - Terminal-Apps (Terminal=true) starten in gnome-terminal - Keine Abhaengigkeiten ausser Python3-Standardlib """ @@ -92,6 +94,23 @@ def read_desktop(path): return parser["Desktop Entry"] +def shows_in_current_desktop(entry): + """OnlyShowIn/NotShowIn gegen XDG_CURRENT_DESKTOP pruefen. + + Ohne gesetzte Variable wird nicht gefiltert: ausserhalb einer Session + ist die Angabe nicht beurteilbar, und zu viel anzeigen ist besser als + alles verstecken. Desktop-Namen sind laut Spec case-sensitiv. + """ + current = {d for d in os.environ.get("XDG_CURRENT_DESKTOP", "").split(":") if d} + if not current: + return True + only = {d for d in entry.get("OnlyShowIn", "").split(";") if d} + if only and not only & current: + return False + blocked = {d for d in entry.get("NotShowIn", "").split(";") if d} + return not (blocked & current) + + def main(): seen = set() sections = {label: [] for _, label in SECTIONS} @@ -117,6 +136,8 @@ def main(): continue if entry.get("Type", "Application") != "Application": continue + if not shows_in_current_desktop(entry): + continue name = entry.get("Name[de]") or entry.get("Name") exec_line = entry.get("Exec") if not name or not exec_line: diff --git a/scripts/notify-bootc-user.sh b/scripts/notify-bootc-user.sh index 6693cc4..46e088a 100755 --- a/scripts/notify-bootc-user.sh +++ b/scripts/notify-bootc-user.sh @@ -156,11 +156,13 @@ fi # --quiet unterdrueckt Systemd-Eigenausgaben (damit $ACTION sauber bleibt). # --pipe reicht stdout durch. `timeout` begrenzt --wait: Ein abwesender # User blockiert den Root-Service nicht (Antwort zaehlt dann als "closed"). +# SIGTERM zuerst, damit systemd-run/notify-send sauber aufraeumen; erst nach +# weiteren 5 s hartes SIGKILL (--kill-after), falls der User-Manager haengt. # Reboot, sobald IRGENDEIN User zustimmt (betrifft ohnehin alle). REBOOT_REQUESTED=0 for USER_ID in ${USER_IDS}; do $LOGGER -t "$TAG" "Sende Benachrichtigung an User-ID: ${USER_ID}" - ACTION="$(timeout -s KILL "${NOTIFY_TIMEOUT}" systemd-run \ + ACTION="$(timeout -s TERM --kill-after=5s "${NOTIFY_TIMEOUT}" systemd-run \ --quiet \ --user \ --machine="${USER_ID}@.host" \ diff --git a/scripts/seed-labwc-skel.sh b/scripts/seed-labwc-skel.sh index a0a82fc..495cd00 100755 --- a/scripts/seed-labwc-skel.sh +++ b/scripts/seed-labwc-skel.sh @@ -29,11 +29,16 @@ TARGETS=( # --- Helfer --------------------------------------------------------------- # Backup VOR jeder Aenderung (.bak = Stand unmittelbar davor, kein stale). +# Schlaegt das Backup fehl, wird die Migration NICHT durchgefuehrt (return 1): +# Die Zusage "vor jeder Aenderung ein Backup" darf nicht still gebrochen +# werden. Aufrufer mit `|| true` (insert_before) pruefen den Rueckgabewert. backup_file() { # $1 = Datei local f="$1" [[ -e "${f}" ]] || return 0 - cp -f "${f}" "${f}.bak" 2>/dev/null \ - || echo "WARN: Backup von ${f} fehlgeschlagen - Aenderung uebersprungen" + if ! cp -f "${f}" "${f}.bak"; then + echo "FEHLER: Backup von ${f} fehlgeschlagen - Aenderung abgebrochen" >&2 + return 1 + fi } # Block (von stdin) vor erster Anker-Zeile einfuegen. Fehlt der Anker: @@ -47,12 +52,25 @@ insert_before() { # $1 Datei, $2 awk-Regex Anker, $3 Meldung echo "WARN: Anker '${anchor}' fehlt in ${file} - ${msg} uebersprungen (bitte manuell pruefen)" return 0 fi - backup_file "${file}" - tmp="$(mktemp)" || { echo "WARN: tmp fehlgeschlagen (${file})"; return 0; } - MIGBLOCK="${block}" awk -v anchor="${anchor}" ' + backup_file "${file}" || return 1 + tmp="$(mktemp)" || { echo "FEHLER: mktemp fehlgeschlagen (${file})" >&2; return 1; } + if ! MIGBLOCK="${block}" awk -v anchor="${anchor}" ' !done && $0 ~ anchor { print ENVIRON["MIGBLOCK"]; done=1 } { print } - ' "${file}" > "${tmp}" && mv "${tmp}" "${file}" \ - && echo "migriert: ${msg} in ${file} (Backup .bak)" + ' "${file}" > "${tmp}"; then + rm -f "${tmp}" + echo "FEHLER: Migration '${msg}' in ${file} fehlgeschlagen - Datei unveraendert" >&2 + return 1 + fi + # In die bestehende Datei schreiben statt `mv`: mktemp legt 0600 an, ein + # mv wuerde Modus (und ggf. Owner) der Config dauerhaft verschaerfen. + if cat "${tmp}" > "${file}"; then + rm -f "${tmp}" + echo "migriert: ${msg} in ${file} (Backup .bak)" + else + rm -f "${tmp}" + echo "FEHLER: Schreiben von ${file} fehlgeschlagen (Backup .bak vorhanden)" >&2 + return 1 + fi } # --- 1. Fehlende Defaults seeden (nur Neuanlage, nie Ueberschreiben) ------ @@ -266,10 +284,14 @@ fi # Migration: W-d-Keybind (Desktop zeigen) entfernen. Weder ToggleShowDesktop # (Openbox-Name) noch ShowDesktop existiert im ausgelieferten labwc -> # "Invalid action" bei jedem Start. -if [[ -f "${RC_XML}" ]] && grep -Eq '' "${RC_XML}" && command -v python3 >/dev/null 2>&1; then - backup_file "${RC_XML}" +# WICHTIG: Nur ein AKTIVER Keybind zaehlt. Der ausgelieferte Platzhalter +# zitiert den Keybind selbst in einem Kommentar; ein naiver grep wuerde ihn +# erneut "migrieren" und dabei Kommentare verschachteln (rc.xml danach kein +# valides XML). Deshalb erkennt das Python-Skript den Block in einer +# kommentarfreien Kopie und macht das Backup erst bei echter Aenderung. +if [[ -f "${RC_XML}" ]] && command -v python3 >/dev/null 2>&1; then RC_XML_PATH="${RC_XML}" python3 - <<'PYEOF' || echo "WARN: W-d-Migration fehlgeschlagen, ${RC_XML} unveraendert" -import os, re +import os, re, shutil, sys p = os.environ["RC_XML_PATH"] text = open(p).read() placeholder = ''' ", text, flags=re.S)] + +def active(match): + pos = text.find('', match.start(), match.end()) + return pos != -1 and not any(s <= pos < e for s, e in comments) + +match = next((m for m in pat.finditer(text) if active(m)), None) +if match is None: + sys.exit(0) +shutil.copy2(p, p + ".bak") +# Platzhalter nur einmal dokumentieren: Wer ihn (aus /etc/skel) schon hat, +# bekommt den aktiven Block ersatzlos entfernt. +replacement = "" if placeholder in text else placeholder +new = text[:match.start()] + replacement + text[match.end():] +open(p, "w").write(new) +print("migriert: W-d-Keybind (unguelige ShowDesktop-Action) aus rc.xml entfernt (Backup .bak)") PYEOF fi @@ -312,6 +348,37 @@ if [[ -f "${ENV_FILE}" ]] && ! grep -q '^ELECTRON_OZONE_PLATFORM_HINT=' "${ENV_F echo "migriert: ELECTRON_OZONE_PLATFORM_HINT in ${ENV_FILE} ergaenzt (Backup .bak)" fi +# Migration: Wayland zuerst, X11 als Fallback. Reines GDK_BACKEND=wayland / +# QT_QPA_PLATFORM=wayland laesst X11-only-Apps (aeltere Java-/Wine-/ +# Electron-Builds) mit "cannot open display" scheitern. +if [[ -f "${ENV_FILE}" ]] && ! grep -q '^GDK_BACKEND=.*x11' "${ENV_FILE}"; then + backup_file "${ENV_FILE}" + if grep -q '^GDK_BACKEND=' "${ENV_FILE}"; then + sed -i 's/^GDK_BACKEND=.*/GDK_BACKEND=wayland,x11/' "${ENV_FILE}" + else + printf '%s\n' 'GDK_BACKEND=wayland,x11' >> "${ENV_FILE}" + fi + echo "migriert: GDK_BACKEND (Wayland + X11-Fallback) in ${ENV_FILE} (Backup .bak)" +fi +if [[ -f "${ENV_FILE}" ]] && ! grep -q '^QT_QPA_PLATFORM=.*xcb' "${ENV_FILE}"; then + backup_file "${ENV_FILE}" + if grep -q '^QT_QPA_PLATFORM=' "${ENV_FILE}"; then + sed -i 's/^QT_QPA_PLATFORM=.*/QT_QPA_PLATFORM=wayland;xcb/' "${ENV_FILE}" + else + printf '%s\n' 'QT_QPA_PLATFORM=wayland;xcb' >> "${ENV_FILE}" + fi + echo "migriert: QT_QPA_PLATFORM (Wayland + X11-Fallback) in ${ENV_FILE} (Backup .bak)" +fi + +# Migration: MOZ_ENABLE_WAYLAND entfernen. Seit Firefox 121 ist Wayland der +# Default; die Variable ist wirkungslos und suggeriert eine Steuerung, die es +# nicht mehr gibt. +if [[ -f "${ENV_FILE}" ]] && grep -q '^MOZ_ENABLE_WAYLAND=' "${ENV_FILE}"; then + backup_file "${ENV_FILE}" + sed -i '/^MOZ_ENABLE_WAYLAND=/d' "${ENV_FILE}" + echo "migriert: wirkungsloses MOZ_ENABLE_WAYLAND aus ${ENV_FILE} entfernt (Backup .bak)" +fi + # Migration: Noctalia Window-Switcher auf Alt+Tab (statt labwc-Default aus # ). if [[ -f "${RC_XML}" ]] && ! grep -q 'key="A-Tab"' "${RC_XML}"; then