diff options
Diffstat (limited to 'remote/modules/safe-mode/data/opt/openslx/scripts')
| -rwxr-xr-x | remote/modules/safe-mode/data/opt/openslx/scripts/systemd-safe_mode | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/remote/modules/safe-mode/data/opt/openslx/scripts/systemd-safe_mode b/remote/modules/safe-mode/data/opt/openslx/scripts/systemd-safe_mode new file mode 100755 index 00000000..6e66b35d --- /dev/null +++ b/remote/modules/safe-mode/data/opt/openslx/scripts/systemd-safe_mode @@ -0,0 +1,59 @@ +#!/bin/ash + +disable_tty_switch() { + cat <<EOF > /etc/X11/xorg.conf.d/50-no-tty.conf +Section "ServerFlags" + Option "DontVTSwitch" "true" +EndSection +EOF +} + +disable_openbox_menu() { + [ ! -e "/etc/xdg/openbox/rc.xml.safe" ] && \ + echo "No rc.xml.safe template found." && return 1 + cp "/etc/xdg/openbox/rc.xml" "/root/rc.xml.unsafe" + cp "/etc/xdg/openbox/rc.xml.safe" "/etc/xdg/openbox/rc.xml" +} + +disable_magic_keys() { + echo 0 > /proc/sys/kernel/sysrq +} + +disable_cron_idleaction() { + rm /opt/openslx/scripts/idleaction-cron_script \ + /opt/openslx/scripts/idleaction-scheduled_poweroff \ + /opt/openslx/scripts/idleaction-scheduled_reboot +} + +disable_systemd_auto_vt() { + sed -i 's/.*NAutoVTs=.*/NAutoVTs=0/g' "/etc/systemd/logind.conf" + systemctl restart systemd-logind +} + +set_default_session() { + [ ! -e "/usr/share/xsessions/firefox.desktop" ] && \ + echo "No firefox session found." && return 1 + # we have it, copy it over default session + cp "/usr/share/xsessions/firefox.desktop" "/opt/openslx/xsessions/default.desktop" +} + +no_autologin_delay() { + [ ! -e "/etc/kde4/kdm/kdmrc" ] && \ + echo "Could not find '/etc/kde4/kdm/kdmrc'." && return 1 + sed -i 's/^AutoLoginDelay=.*/AutoLoginDelay=0/g' "/etc/kde4/kdm/kdmrc" +} + + +. /opt/openslx/config + +[ -z "$SLX_BROWSER_START_URL" ] && \ + echo "Not running in E-Klausur mode!" && \ + exit 1 + +disable_tty_switch +disable_openbox_menu +disable_magic_keys +disable_cron_idleaction +disable_systemd_auto_vt +no_autologin_delay +set_default_session |
