diff --git a/config/environment/90-ekklesia-classroom.conf b/config/environment/90-ekklesia-classroom.conf new file mode 100644 index 0000000..7dc7911 --- /dev/null +++ b/config/environment/90-ekklesia-classroom.conf @@ -0,0 +1,11 @@ +# Where the classroom's session settings live. +# +# The classroom cannot install its kdeglobals, kwinrc and the rest into +# /etc/xdg: plasma-workspace already owns files by those names there, and +# two packages cannot own one path. Measured — dpkg refused the package. +# +# KConfig reads XDG_CONFIG_DIRS in order, so putting a classroom directory +# in front of /etc/xdg gives the room's settings priority over Debian's +# defaults without touching a file another package owns. systemd's user +# manager reads this file, and the Plasma session inherits it. +XDG_CONFIG_DIRS=/etc/ekklesia-classroom/xdg:/etc/xdg diff --git a/docs/screenshots/v2-from-package.png b/docs/screenshots/v2-from-package.png new file mode 100644 index 0000000..da31619 Binary files /dev/null and b/docs/screenshots/v2-from-package.png differ diff --git a/packaging/debian/postinst b/packaging/debian/postinst index 2a33da6..29d323e 100755 --- a/packaging/debian/postinst +++ b/packaging/debian/postinst @@ -8,30 +8,21 @@ if ! id classroom >/dev/null 2>&1; then classroom fi -cat > /home/classroom/.bash_profile <<'PROFILE' -if [ -z "$WAYLAND_DISPLAY" ] && [ "${XDG_VTNR:-}" = "1" ]; then - exec sway -c /etc/ekklesia-classroom/sway/config -fi -PROFILE +# The session is started by SDDM now. An upgrade from a sway-era room has +# to remove the login shell that used to start it, or the machine has two +# things trying to own tty1. +rm -f /home/classroom/.bash_profile +rm -f /etc/systemd/system/getty@tty1.service.d/autologin.conf +rmdir --ignore-fail-on-non-empty \ + /etc/systemd/system/getty@tty1.service.d 2>/dev/null || true -chown classroom:classroom /home/classroom/.bash_profile -chmod 0644 /home/classroom/.bash_profile - -chmod 0755 /usr/local/bin/classroom-browser -chmod 0755 /usr/local/bin/classroom-chrome-windows -chmod 0755 /usr/local/bin/classroom-window -chmod 0755 /usr/local/bin/classroom-dvd -chmod 0755 /usr/local/bin/classroom-dvd-session -chmod 0755 /usr/local/bin/classroom-dvd-css-setup -chmod 0755 /usr/local/bin/classroom-notify -chmod 0755 /usr/local/bin/classroom-notify-test -chmod 0755 /usr/local/bin/classroom-mqtt -chmod 0755 /usr/local/bin/classroom-notifications -chmod 0755 /usr/local/bin/classroom-scale -chmod 0755 /usr/local/bin/classroom-shutdown -chmod 0755 /usr/local/bin/classroom-chrome-setup -chmod 0755 /usr/local/bin/classroom-provision -chmod 0755 /usr/local/bin/classroom-printer-setup +# Commands the room's own parts install. Listing them by name went wrong +# once already, when a command that had been removed was still chmod'ed +# here and the whole postinst failed; the package is the list. +for command in /usr/local/bin/classroom-*; do + [ -e "$command" ] || continue + chmod 0755 "$command" +done # Reading the optical drive needs group cdrom. Takes effect at the next # login, which the OTA reboot provides. @@ -55,6 +46,13 @@ chmod 0640 /etc/ekklesia-classroom/device.conf systemctl daemon-reload || true +# Autologin into the classroom, and back into it if the session ever ends. +systemctl enable sddm.service >/dev/null 2>&1 || true + +# The room's own user services: the audio policy, and the drop-in that stops +# Plasma giving up on a repeatedly crashing panel. +systemctl --global enable ekklesia-classroom-audio.service >/dev/null 2>&1 || true + # NetworkManager ships nmtui and deliberately leaves interfaces declared in # /etc/network/interfaces under ifupdown's control (managed=false). This gives # administrators saved, auto-reconnecting Wi-Fi without taking over an diff --git a/tests/test-deployment-support.sh b/tests/test-deployment-support.sh index 62ecb97..d5a4949 100755 --- a/tests/test-deployment-support.sh +++ b/tests/test-deployment-support.sh @@ -92,6 +92,20 @@ check("restart is unconditional", "Restart=always" in supervision) check("the burst limit is lifted", "StartLimitIntervalSec=0" in supervision) check("the drop-in is packaged", "plasma-plasmashell.service.d" in build) +print() +print("4b2. the session settings do not fight another package") +# plasma-workspace owns /etc/xdg/kdeglobals and friends. dpkg refused the +# package when the classroom tried to own them too, so the room's copies +# 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) +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()) +check("the environment file is packaged", + "/etc/environment.d/90-ekklesia-classroom.conf" in build) + print() print("4c. the teacher cannot reach a command line") for restriction in ("run_command=false", "shell_access=false", diff --git a/tools/build-release.sh b/tools/build-release.sh index 4c9eae8..b476179 100755 --- a/tools/build-release.sh +++ b/tools/build-release.sh @@ -207,13 +207,19 @@ install -Dm644 \ # a dock, a window helper, a notification wrapper or a compositor config in # the list above. +# Not /etc/xdg: plasma-workspace already owns files by these names there. +# The classroom's directory goes in front of it in XDG_CONFIG_DIRS instead. for setting in kdeglobals kwinrc kwinrulesrc kscreenlockerrc ksmserverrc \ krunnerrc plasmanotifyrc; do install -Dm644 \ "$ROOT/config/plasma/xdg/${setting}" \ - "$STAGE/etc/xdg/${setting}" + "$STAGE/etc/ekklesia-classroom/xdg/${setting}" done +install -Dm644 \ + "$ROOT/config/environment/90-ekklesia-classroom.conf" \ + "$STAGE/etc/environment.d/90-ekklesia-classroom.conf" + for scheme in EkklesiaDark EkklesiaLight; do install -Dm644 \ "$ROOT/config/plasma/colors/${scheme}.colors" \ diff --git a/tools/lab/install-desktop b/tools/lab/install-desktop index a5c542c..8a08af3 100755 --- a/tools/lab/install-desktop +++ b/tools/lab/install-desktop @@ -9,13 +9,18 @@ set -euo pipefail SRC="${1:-/srv/classroom}" -install -Dm644 "$SRC/config/plasma/xdg/kdeglobals" /etc/xdg/kdeglobals -install -Dm644 "$SRC/config/plasma/xdg/kwinrc" /etc/xdg/kwinrc -install -Dm644 "$SRC/config/plasma/xdg/kwinrulesrc" /etc/xdg/kwinrulesrc -install -Dm644 "$SRC/config/plasma/xdg/kscreenlockerrc" /etc/xdg/kscreenlockerrc -install -Dm644 "$SRC/config/plasma/xdg/ksmserverrc" /etc/xdg/ksmserverrc -install -Dm644 "$SRC/config/plasma/xdg/krunnerrc" /etc/xdg/krunnerrc -install -Dm644 "$SRC/config/plasma/xdg/plasmanotifyrc" /etc/xdg/plasmanotifyrc +# A directory of the classroom's own, ahead of /etc/xdg in +# XDG_CONFIG_DIRS. plasma-workspace owns files by these names in /etc/xdg +# and two packages cannot own one path. +for setting in kdeglobals kwinrc kwinrulesrc kscreenlockerrc ksmserverrc \ + krunnerrc plasmanotifyrc; do + install -Dm644 "$SRC/config/plasma/xdg/$setting" \ + "/etc/ekklesia-classroom/xdg/$setting" + rm -f "/etc/xdg/$setting.ekklesia-old" +done + +install -Dm644 "$SRC/config/environment/90-ekklesia-classroom.conf" \ + /etc/environment.d/90-ekklesia-classroom.conf install -Dm644 "$SRC/config/plasma/colors/EkklesiaDark.colors" \ /usr/share/color-schemes/EkklesiaDark.colors diff --git a/tools/lab/lab b/tools/lab/lab index ef8b2b5..d941039 100755 --- a/tools/lab/lab +++ b/tools/lab/lab @@ -103,6 +103,7 @@ plasma-up) -e WAYLAND_DISPLAY="$OUTER" -e XDG_SESSION_TYPE=wayland \ -e XDG_CURRENT_DESKTOP=KDE -e LIBGL_ALWAYS_SOFTWARE=1 \ -e QT_LOGGING_RULES="kwin_scripting.debug=true" \ + -e XDG_CONFIG_DIRS=/etc/ekklesia-classroom/xdg:/etc/xdg \ -d "$NAME" sh -c 'exec startplasma-wayland > /tmp/plasma.log 2>&1' for _ in $(seq 1 60); do docker exec "$NAME" pgrep -x plasmashell >/dev/null 2>&1 && break