Add runcontestant script

This commit is contained in:
Jan Schär 2025-03-08 16:54:15 +01:00
parent 9204d11a7f
commit 6c8705b8cd
3 changed files with 9 additions and 2 deletions

View File

@ -14,7 +14,7 @@ parallel-ssh -x "-F local.ssh_config" -h hostlist systemctl reload nftables.serv
# Uncomment these lines if machines have 4K displays. This scales display to 2x.
# parallel-scp -x "-F local.ssh_config" -h hostlist ./set-display-scale.py /usr/local/bin/set-display-scale.py
# parallel-ssh -x "-F local.ssh_config" -h hostlist 'DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/$(id -u contestant)/bus" runuser -u contestant -- python3 /usr/local/bin/set-display-scale.py'
# parallel-ssh -x "-F local.ssh_config" -h hostlist runcontestant python3 /usr/local/bin/set-display-scale.py
# Configure contest lock screen.
parallel-scp -x "-F local.ssh_config" -h hostlist ./contest-lock.json /etc/contest-lock.json

View File

@ -10,7 +10,7 @@ set -eu
kexec --kexec-file-syscall --load /vmlinuz --initrd=/initrd.img --append="$(cat /proc/cmdline)"
if XDG_RUNTIME_DIR="/run/user/$(id -u contestant)" runuser -u contestant -- zenity --question --title="Reboot?" --text="Press Enter after inserting the boot USB stick."
if runcontestant zenity --question --title="Reboot?" --text="Press Enter after inserting the boot USB stick."
then
reboot
fi

View File

@ -0,0 +1,7 @@
#!/bin/bash
# This script allows running a command as the contestant user, with environment
# variables for that user. This allows e.g. running graphical commands.
set -o allexport
XDG_RUNTIME_DIR="/run/user/$(id -u contestant)"
eval "$(runuser -u contestant -- systemctl --user show-environment)"
exec /usr/sbin/runuser -u contestant -- "$@"