fix: Review-Funde 2-6 und Kleinigkeiten beheben
- 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
This commit is contained in:
1 parent
3c1e921e8a
commit
04c7694e3f
15 files changed
+358
-32
No files matched your search
+83
-16
@@ -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 '<keybind key="W-d">' "${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 = ''' <!-- W-d (Desktop zeigen) bewusst unbelegt: weder ShowDesktop noch
|
||||
@@ -288,12 +310,26 @@ pat = re.compile(
|
||||
r'|^[ \t]*<keybind key="W-d">\n(?:.*\n)*?^[ \t]*</keybind>\n',
|
||||
re.M,
|
||||
)
|
||||
new, n = pat.subn(placeholder, text, count=1)
|
||||
if n:
|
||||
open(p, "w").write(new)
|
||||
print("migriert: W-d-Keybind (unguelige ShowDesktop-Action) aus rc.xml entfernt (Backup .bak)")
|
||||
else:
|
||||
print("W-d-Keybind in rc.xml nicht im erwarteten Format - manuell pruefen")
|
||||
# Kommentar-Bereiche bestimmen: Der ausgelieferte Platzhalter zitiert den
|
||||
# Keybind in einem Kommentar. Ein Treffer zaehlt nur, wenn die keybind-Zeile
|
||||
# NICHT in einem Kommentar liegt (sonst wuerde der Platzhalter erneut ersetzt
|
||||
# und die Kommentare verschachtelten sich).
|
||||
comments = [(m.start(), m.end()) for m in re.finditer(r"<!--.*?-->", text, flags=re.S)]
|
||||
|
||||
def active(match):
|
||||
pos = text.find('<keybind key="W-d">', 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
|
||||
# <default />).
|
||||
if [[ -f "${RC_XML}" ]] && ! grep -q 'key="A-Tab"' "${RC_XML}"; then
|
||||
|
||||
Reference in new issue
Block a user