fix: make an existing classroom converge into the Plasma appliance
A real room upgraded to 0.1.45 and came up as stock Debian Plasma with the old Waybar across the top, mako still catching notifications, and a lock screen on an account that has no password. The cause was one line, and it was in the lab: the harness handed the session under test XDG_CONFIG_DIRS by hand, so every result it had ever produced was a result about a machine somebody had already configured. On a machine SDDM starts the session through PAM, PAM does not read /etc/environment.d, and Debian's own plasma-workspace env.sh then set the variable from scratch — so the classroom's settings directory was not in the cascade at all. No layout, no lock policy, no Kiosk restrictions. The settings now arrive the way Plasma delivers them, through a file in /etc/xdg/plasma-workspace/env. Around that: the look and feel is immutable on its own key so a stale profile cannot answer for it; the palette is composed into the package, because naming a colour scheme does not produce one and the dark bar had been coming from a technician's hand; the desktop reset converges another desktop's appearance state and keeps the room's own; and classroom-migrate stops, deactivates and masks the old shell, including the D-Bus activation that brought mako back while the panel was down — found only by killing the panel on a migrated machine. device.conf loses COMPOSITOR and comes off the hyprland channel, which would otherwise have handed the room the experiment back. The lab stops flattering the package: it restarts the machine, lets SDDM actually autologin, and asks a fresh install and a machine upgraded from the Hyprland package the same sixty questions. Both answer identically, twice, and the panel still comes back from eight SIGKILLs. Co-Authored-By: Claude Opus 5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5
parent
6050144e5d
commit
926668dc9b
@@ -99,7 +99,15 @@ print("4b2. the session settings do not fight another package")
|
||||
# live in a directory of their own, in front of /etc/xdg.
|
||||
check("settings install to the classroom's own directory",
|
||||
"$STAGE/etc/ekklesia-classroom/xdg/" in build)
|
||||
check("nothing is installed into /etc/xdg", "$STAGE/etc/xdg/" not in build)
|
||||
# One file of ours does live under /etc/xdg, and it is not a settings
|
||||
# file: it is the session environment drop-in that puts the directory
|
||||
# above into the cascade at all. A drop-in directory is built to be
|
||||
# added to; a name plasma-workspace already owns is not.
|
||||
xdg_paths = re.findall(r'\$STAGE(/etc/xdg/[^"]+)', build)
|
||||
check("the only file under /etc/xdg is the session env drop-in",
|
||||
xdg_paths == ["/etc/xdg/plasma-workspace/env/zz-ekklesia-classroom.sh"])
|
||||
check("no settings file takes a name plasma-workspace owns",
|
||||
not any(path.rsplit("/", 1)[0] == "/etc/xdg" for path in xdg_paths))
|
||||
check("and that directory is searched first",
|
||||
"XDG_CONFIG_DIRS=/etc/ekklesia-classroom/xdg:/etc/xdg" in
|
||||
(root / "config/environment/90-ekklesia-classroom.conf").read_text())
|
||||
@@ -132,8 +140,15 @@ check("PowerDevil: no action on the power button",
|
||||
power.count("powerButtonAction=0") == 3)
|
||||
check("PowerDevil: no action on a lid either",
|
||||
power.count("lidAction=0") == 3)
|
||||
# Six: the three button groups, and the three profiles around them.
|
||||
# PowerDevil loads an idle action when it finds a group for it, so a
|
||||
# writable profile is one a leftover user file can add a suspend to.
|
||||
check("and the session cannot put an action back",
|
||||
power.count("[$i]") == 3)
|
||||
power.count("[$i]") == 6)
|
||||
check("no idle action in any profile",
|
||||
not any(f"[{profile}][{action}]" in power
|
||||
for profile in ("AC", "Battery", "LowBattery")
|
||||
for action in ("SuspendSession", "DimDisplay", "DPMSControl")))
|
||||
check("the logind drop-in is packaged",
|
||||
"/etc/systemd/logind.conf.d/ekklesia-classroom.conf" in build)
|
||||
check("the PowerDevil profile is packaged",
|
||||
|
||||
Executable
+208
@@ -0,0 +1,208 @@
|
||||
#!/bin/bash
|
||||
set -uo pipefail
|
||||
|
||||
# The upgrade path, as far as source can be checked without a machine.
|
||||
#
|
||||
# A real room upgraded to the Plasma classroom and came up as stock Debian
|
||||
# Plasma with the old Waybar still across the top and a lock screen waiting
|
||||
# for a password the account does not have. Every check here is one of the
|
||||
# reasons that happened. The lab scenario in tools/lab/dirty-upgrade is the
|
||||
# other half: this one guards the package, that one guards the machine.
|
||||
|
||||
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
|
||||
python3 - "$ROOT" <<'PY'
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
root = Path(sys.argv[1])
|
||||
|
||||
env_script = (root / "config/plasma/env/zz-ekklesia-classroom.sh").read_text()
|
||||
build = (root / "tools/build-release.sh").read_text()
|
||||
postinst = (root / "packaging/debian/postinst").read_text()
|
||||
migrate = (root / "scripts/classroom-migrate").read_text()
|
||||
reset = (root / "scripts/classroom-desktop-reset").read_text()
|
||||
kdeglobals = (root / "config/plasma/xdg/kdeglobals").read_text()
|
||||
power = (root / "config/plasma/xdg/powermanagementprofilesrc").read_text()
|
||||
locker = (root / "config/plasma/xdg/kscreenlockerrc").read_text()
|
||||
logind = (root / "config/systemd/logind-ekklesia-classroom.conf").read_text()
|
||||
sddm = (root / "config/sddm/ekklesia-classroom.conf").read_text()
|
||||
lab = (root / "tools/lab/lab").read_text()
|
||||
|
||||
passed = failed = 0
|
||||
|
||||
|
||||
def check(label, condition):
|
||||
global passed, failed
|
||||
if condition:
|
||||
print(f" ok {label}")
|
||||
passed += 1
|
||||
else:
|
||||
print(f" FAIL {label}")
|
||||
failed += 1
|
||||
|
||||
|
||||
print("the session environment")
|
||||
|
||||
# The root cause. /etc/environment.d is read by systemd's user manager;
|
||||
# SDDM starts the session through PAM, which is not systemd, so the
|
||||
# classroom's settings directory never reached Plasma. startplasma sources
|
||||
# /etc/xdg/plasma-workspace/env, which is why the file lives there.
|
||||
check(
|
||||
"the classroom directory is set where startplasma looks",
|
||||
"/etc/xdg/plasma-workspace/env/zz-ekklesia-classroom.sh" in build,
|
||||
)
|
||||
check(
|
||||
"and it is in the package, not only in the lab",
|
||||
'config/plasma/env/zz-ekklesia-classroom.sh' in build,
|
||||
)
|
||||
check(
|
||||
"it prepends rather than replaces",
|
||||
"XDG_CONFIG_DIRS=\"/etc/ekklesia-classroom/xdg:${XDG_CONFIG_DIRS:-/etc/xdg}\""
|
||||
in env_script,
|
||||
)
|
||||
check(
|
||||
"and does nothing when the directory is already there",
|
||||
"*:/etc/ekklesia-classroom/xdg:*" in env_script,
|
||||
)
|
||||
check(
|
||||
"the name sorts after Debian's own env.sh",
|
||||
Path("config/plasma/env/zz-ekklesia-classroom.sh").name > "env.sh",
|
||||
)
|
||||
check(
|
||||
"environment.d is still shipped for services outside a session",
|
||||
"/etc/environment.d/90-ekklesia-classroom.conf" in build,
|
||||
)
|
||||
check(
|
||||
"the lab no longer sets the variable for the session under test",
|
||||
"-e XDG_CONFIG_DIRS=" not in lab,
|
||||
)
|
||||
|
||||
print("\nthe desktop cannot be answered for by a stale profile")
|
||||
|
||||
check(
|
||||
"the look and feel package is immutable on its own key",
|
||||
"LookAndFeelPackage[$i]=org.ekklesia.classroom.desktop" in kdeglobals,
|
||||
)
|
||||
check(
|
||||
"the palette is composed into the shipped kdeglobals",
|
||||
"tools/build-kdeglobals" in build,
|
||||
)
|
||||
check(
|
||||
"another desktop's look and feel defaults are removed at login",
|
||||
"removed another desktop's look and feel defaults" in reset,
|
||||
)
|
||||
check(
|
||||
"and the classroom's own are kept, so a chosen theme survives",
|
||||
"defaults_are_ours=yes" in reset,
|
||||
)
|
||||
check(
|
||||
"a foreign palette is removed and an Ekklesia one kept",
|
||||
"Ekklesia*)" in reset and 'rm -f "$CONFIG_HOME/kdeglobals"' in reset,
|
||||
)
|
||||
check(
|
||||
"the panel is still rebuilt from the packaged layout every login",
|
||||
"plasma-org.kde.plasma.desktop-appletsrc" in reset,
|
||||
)
|
||||
check(
|
||||
"and the reset says so out loud if the cascade is wrong",
|
||||
"XDG_CONFIG_DIRS did not contain" in reset,
|
||||
)
|
||||
|
||||
print("\nthe old shell converges away")
|
||||
|
||||
check("the migration runs on every install", "classroom-migrate" in postinst)
|
||||
check("it is in the package", "scripts/classroom-migrate" in build)
|
||||
|
||||
for unit in ("waybar.service", "mako.service"):
|
||||
check(f"{unit} is deactivated", unit in migrate)
|
||||
|
||||
check(
|
||||
"activation is removed from all three places it can live",
|
||||
"/etc/systemd/user" in migrate
|
||||
and "/etc/xdg/systemd/user" in migrate
|
||||
and ".config/systemd/user" in migrate,
|
||||
)
|
||||
check("and then masked, so a stray unit file cannot start it", "--global mask" in migrate)
|
||||
check(
|
||||
"autostart entries are matched on what they run",
|
||||
"^Exec=" in migrate and "autostart" in migrate,
|
||||
)
|
||||
check(
|
||||
"the login shell that started sway is removed",
|
||||
".bash_profile" in migrate,
|
||||
)
|
||||
check(
|
||||
"and the tty1 autologin drop-in with it",
|
||||
"[email protected]/autologin.conf" in migrate,
|
||||
)
|
||||
check(
|
||||
"the old notification daemon cannot be D-Bus activated",
|
||||
"/usr/local/share/dbus-1/services/fr.emersion.mako.service" in build,
|
||||
)
|
||||
check(
|
||||
"the shadow makes activation fail rather than hang",
|
||||
"Exec=/bin/false"
|
||||
in (root / "config/dbus/fr.emersion.mako.service").read_text(),
|
||||
)
|
||||
check(
|
||||
"and a running session bus is told to re-read its services",
|
||||
"ReloadConfig" in migrate,
|
||||
)
|
||||
check(
|
||||
"nothing removes a Debian package",
|
||||
"apt-get remove" not in migrate and "apt remove" not in migrate,
|
||||
)
|
||||
check(
|
||||
"device.conf loses the compositor it can no longer choose",
|
||||
'OBSOLETE_KEYS = ("COMPOSITOR", "HYPR_APPEARANCE")' in migrate,
|
||||
)
|
||||
check(
|
||||
"and comes off a channel that would undo the upgrade",
|
||||
'OBSOLETE_CHANNELS = {"hyprland"}' in migrate,
|
||||
)
|
||||
check(
|
||||
"the rest of device.conf is rewritten line by line, not regenerated",
|
||||
"handle.writelines(out)" in migrate,
|
||||
)
|
||||
|
||||
print("\nnothing puts a password prompt in front of a teacher")
|
||||
|
||||
check("no automatic lock", "Autolock=false" in locker)
|
||||
check("no lock on resume", "LockOnResume=false" in locker)
|
||||
check("the lock settings are immutable", "[Daemon][$i]" in locker)
|
||||
check(
|
||||
"no idle suspend, dim or blank in any profile",
|
||||
not any(
|
||||
f"[{profile}][{action}]" in power
|
||||
for profile in ("AC", "Battery", "LowBattery")
|
||||
for action in ("SuspendSession", "DimDisplay", "DPMSControl")
|
||||
),
|
||||
)
|
||||
check(
|
||||
"the profiles themselves are immutable, so none can be added back",
|
||||
all(f"[{profile}][$i]" in power for profile in ("AC", "Battery", "LowBattery")),
|
||||
)
|
||||
check(
|
||||
"a leftover user power profile is cleared at login",
|
||||
"powermanagementprofilesrc" in reset,
|
||||
)
|
||||
check("logind takes no idle action", "IdleAction=ignore" in logind)
|
||||
check("the power button is still ignored", "HandlePowerKey=ignore" in logind)
|
||||
check(
|
||||
"and a long press is still the firmware's business",
|
||||
"HandlePowerKeyLongPress=ignore" in logind,
|
||||
)
|
||||
check(
|
||||
"the package holds no account credentials",
|
||||
"passwd" not in postinst and "chpasswd" not in postinst,
|
||||
)
|
||||
check(
|
||||
"a classroom account created after another user still appears",
|
||||
"MaximumUid=1999" in sddm,
|
||||
)
|
||||
|
||||
print()
|
||||
print(f"{passed} passed, {failed} failed")
|
||||
sys.exit(1 if failed else 0)
|
||||
PY
|
||||
Reference in New Issue
Block a user