diff options
Diffstat (limited to 'core/modules')
10 files changed, 130 insertions, 402 deletions
diff --git a/core/modules/idleaction/data/etc/X11/Xsession.d/50-set_lightdm_dpms b/core/modules/idleaction/data/etc/X11/Xsession.d/50-set_lightdm_dpms new file mode 100644 index 00000000..c036e22a --- /dev/null +++ b/core/modules/idleaction/data/etc/X11/Xsession.d/50-set_lightdm_dpms @@ -0,0 +1,20 @@ +#!/bin/ash sourced + +# Set DPMS values in Xsetup. These will apply for the login screen. + +if [ -z "$SLX_PXE_SERVER_IP" ] && [ -z "$SLX_SCREEN_STANDBY_TIMEOUT" ]; then + . /opt/openslx/config # Not sourced yet +fi + +( + sleep 1 + xset s off + if [ -n "$SLX_SCREEN_STANDBY_TIMEOUT" ]; then + xset dpms "$SLX_SCREEN_STANDBY_TIMEOUT" "$SLX_SCREEN_STANDBY_TIMEOUT" "$SLX_SCREEN_STANDBY_TIMEOUT" &> /dev/null + else + xset -dpms + fi +) & + +: + diff --git a/core/modules/idleaction/data/etc/cron.d/openslx-idleaction b/core/modules/idleaction/data/etc/cron.d/openslx-idleaction deleted file mode 100644 index a7f342a0..00000000 --- a/core/modules/idleaction/data/etc/cron.d/openslx-idleaction +++ /dev/null @@ -1,7 +0,0 @@ -# Trigger scripts that checks idle status of machine and triggers actions - -SHELL=/bin/ash -PATH=/usr/sbin:/usr/bin:/sbin:/bin:/opt/openslx/sbin:/opt/openslx/bin - -* * * * * root /opt/openslx/scripts/idleaction-cron_script - diff --git a/core/modules/idleaction/data/etc/systemd/system/idle-daemon.service b/core/modules/idleaction/data/etc/systemd/system/idle-daemon.service new file mode 100644 index 00000000..aa9661e4 --- /dev/null +++ b/core/modules/idleaction/data/etc/systemd/system/idle-daemon.service @@ -0,0 +1,7 @@ +[Unit] +Description=OpenSLX idle-daemon + +[Server] +ExecStart=/opt/openslx/scripts/idle-daemon-launcher +Restart=on-failure +RestartSec=1 diff --git a/core/modules/idleaction/data/etc/systemd/system/multi-user.target.wants/idle-daemon.service b/core/modules/idleaction/data/etc/systemd/system/multi-user.target.wants/idle-daemon.service new file mode 120000 index 00000000..1d1dce02 --- /dev/null +++ b/core/modules/idleaction/data/etc/systemd/system/multi-user.target.wants/idle-daemon.service @@ -0,0 +1 @@ +../idle-daemon.service
\ No newline at end of file diff --git a/core/modules/idleaction/data/opt/openslx/scripts/idle-daemon-launcher b/core/modules/idleaction/data/opt/openslx/scripts/idle-daemon-launcher new file mode 100755 index 00000000..c2fcce78 --- /dev/null +++ b/core/modules/idleaction/data/opt/openslx/scripts/idle-daemon-launcher @@ -0,0 +1,35 @@ +#!/bin/ash + +. /opt/openslx/config + +CMD= + +[ -n "$SLX_SHUTDOWN_TIMEOUT" ] && CMD="$CMD --poweroff-timeout $SLX_SHUTDOWN_TIMEOUT" + +if [ -z "${SLX_EXAM}" ]; then + # Exam mode inactive + [ -n "$SLX_LOGOUT_TIMEOUT" ] && CMD="$CMD --logout-timeout $SLX_LOGOUT_TIMEOUT" + [ -n "$SLX_SYSTEM_STANDBY_TIMEOUT" ] && CMD="$CMD --suspend-timeout $SLX_SYSTEM_STANDBY_TIMEOUT" + + [ -n "$SLX_SCREEN_SAVER_TIMEOUT" ] && CMD="$CMD --screensaver-timeout $SLX_SCREEN_SAVER_TIMEOUT" + [ -n "$SLX_SCREEN_STANDBY_TIMEOUT" ] && CMD="$CMD --dpms-timeout $SLX_SCREEN_STANDBY_TIMEOUT" + [ -n "$SLX_SCREEN_SAVER_GRACE_TIME" ] && CMD="$CMD --grace-period $SLX_SCREEN_SAVER_GRACE_TIME" + + for t in $SLX_REBOOT_SCHEDULE; do + CMD="$CMD --reboot $t" + done + for t in $SLX_SHUTDOWN_SCHEDULE; do + CMD="$CMD --poweroff $t" + done +else + # Exam mode active + CMD="$CMD --min-idle 7200" # Ignore schedule if idle time is lower than 2h + if [ -n "$SLX_SHUTDOWN_SCHEDULE" ]; then + CMD="$CMD --poweroff 22:00 4:00" + elif [ -n "$SLX_REBOOT_SCHEDULE" ]; then + CMD="$CMD --reboot 22:00 4:00" + fi +fi + + +exec /opt/openslx/sbin/idle-daemon $CMD diff --git a/core/modules/idleaction/data/opt/openslx/scripts/idleaction-cron_script b/core/modules/idleaction/data/opt/openslx/scripts/idleaction-cron_script deleted file mode 100755 index 4867883e..00000000 --- a/core/modules/idleaction/data/opt/openslx/scripts/idleaction-cron_script +++ /dev/null @@ -1,252 +0,0 @@ -#!/bin/ash - -. /opt/openslx/config || exit 1 - -CRONFILE="/etc/cron.d/idleaction-shutdown_schedule" - -# If existent, no session is open. Will contain timestamp of last activity. -# If not existent, at least one user is logged in -IDLEHINT="/run/openslx/idlehint" -NOW=$(date +%s) - -get_sessions() { - local LEGEND State Class - LEGEND= - loginctl --help 2>&1 | grep -q -- '--no-legend' && LEGEND="--no-legend" - for SESSION in $(loginctl $LEGEND | awk '{print $1}'); do - unset Display Remote State - eval $(loginctl -p State -p Class show-session "$SESSION") - if [ "$State" = "active" -o "$State" = "online" ] && [ "$Class" = "user" ]; then - echo "$SESSION" - fi - done -} - -gen_runfile() { - # Calc next reboot/shutdown/standby - local i dateline ts - dateline= - for i in $SLX_REBOOT_SCHEDULE $SLX_SHUTDOWN_SCHEDULE; do - ts=$(date -d "today $i" +%s) - [ "$ts" -gt 0 ] || continue # NaN - ts=$(( ts + 300 )) # Account for the 5 minute delay if someone is logged in - if [ "$ts" -lt "$NOW" ]; then - ts=$(date -d "tomorrow $i" +%s) - ts=$(( ts + 300 )) # Account for the 5 minute delay if someone is logged in - fi - [ "$ts" -gt "$NOW" ] || continue - if [ -z "$dateline" ] || [ "$ts" -lt "$dateline" ]; then - dateline="$ts" - fi - done - cat <<EDOC -[General] -lockDeadline=0 -shutdownDeadline=$dateline -EDOC -} - -# -# 1) Check for idle timeout -# -if [ -n "${SLX_LOGOUT_TIMEOUT}" ] && [ "${SLX_LOGOUT_TIMEOUT}" -gt 0 ]; then - # Logout timeout is set, see which users we should kick - IS_IDLE=yes - # get all sessions - SESSIONS=$(get_sessions) - if [ -n "$SESSIONS" ]; then - TMP="/run/openslx/idlecheck.tmp" - # Iterate over sessions - for ses in $SESSIONS; do - # Get information - loginctl show-session "$ses" > "$TMP" - NAME=$(grep '^Name=' "$TMP" | cut -c 6-) - [ -z "$NAME" ] && continue # No name - should not happen - export DISPLAY=$(grep '^Display=' "$TMP" | cut -c 9-) - # X11 - if [ -n "$DISPLAY" ]; then - # Seems to be x11 - IDLE= - LOCK= - export XAUTHORITY=$(ps a | grep " $DISPLAY " | grep -o -- '-auth.*$' | grep -m1 -v grep | awk '{print $2}') - [ -n "$XAUTHORITY" ] && [ -f "$XAUTHORITY" ] && IDLE=$(xprintidle) - # Now that we have DISPLAY and XAUTHORITY set, xprintidle should work - if [ -z "$IDLE" ]; then - # Try user's xauth - USERID=$(id -u "$NAME") - [ -z "$USERID" ] && USERID="$NAME" - USRHOME=$(/usr/bin/getent passwd "$USERID" | awk -F ':' '{print $6}') - export XAUTHORITY="$USRHOME/.Xauthority" - fi - if [ -n "$XAUTHORITY" ] && [ -f "$XAUTHORITY" ]; then - LOCK=$(xprintlocktime) - [ -z "$IDLE" ] && IDLE=$(xprintidle) - [ -n "$IDLE" ] && IDLE=$(( NOW - ( IDLE / 1000 ) )) - fi - # Now consider locking - if the screen is locked, we don't want to consider the current idle time, but - # the idle time of when the screen was locked - look it up and if not found, write current value - RUNFILE="/run/openslx/idleaction-$DISPLAY" - [ -f "$RUNFILE" ] || gen_runfile > "$RUNFILE" - OLDLOCKTIME=$(awk -F= '{if ($1 == "lockTime") { print $2; exit } }' "$RUNFILE") - [ -z "$OLDLOCKTIME" ] && OLDLOCKTIME=0 - if [ -z "$LOCK" ] || [ "$(( OLDLOCKTIME - LOCK ))" -gt 120 ] || [ "$(( LOCK - OLDLOCKTIME ))" -gt 120 ]; then - # Not locked anymore, or lock time has changed (= unlock and relock), nuke old value - sed -i '/^lockIdleTime=/d;/^lockTime=/d' "$RUNFILE" - if [ -n "$LOCK" ] && [ "$OLDLOCKTIME" -gt 0 ]; then - TIMEOUT=$(( LOCK + SLX_LOGOUT_TIMEOUT )) - sed -i "s/^lockDeadline=.*\$/lockDeadline=$TIMEOUT/" "$RUNFILE" - fi - fi - if [ -n "$LOCK" ]; then - # Screen is locked, ignore further idle time updates - RET=$(awk -F= '{if ($1 == "lockIdleTime") { print $2; exit } }' "$RUNFILE") - if [ -z "$RET" ]; then - if [ -z "$IDLE" ]; then - IDLE="$LOCK" - fi - { - echo "lockIdleTime=$IDLE" - echo "lockTime=$LOCK" - } >> "$RUNFILE" - else - # Use previous value - IDLE="$RET" - fi - fi - if [ -z "$IDLE" ] && [ -n "$LOCK" ]; then - IDLE="$LOCK" - fi - if [ -n "$IDLE" ] && [ "$IDLE" -gt 0 ]; then - if [ -z "$LOCK" ] || grep -Fxq 'lockDeadline=0' "$RUNFILE"; then - # Only update if screen is unlocked, or no deadline was recorded yet - TIMEOUT=$(( IDLE + SLX_LOGOUT_TIMEOUT )) - sed -i "s/^lockDeadline=.*\$/lockDeadline=$TIMEOUT/" "$RUNFILE" - else - # Use stored value - RET=$(awk -F= '{if ($1 == "lockDeadline") { print $2; exit } }' "$RUNFILE") - if [ -n "$RET" ]; then - TIMEOUT="$RET" - else - TIMEOUT=$(( IDLE + SLX_LOGOUT_TIMEOUT )) - echo "lockDeadline=$TIMEOUT" >> "$RUNFILE" - fi - fi - - if [ "$TIMEOUT" -lt "$NOW" ]; then - rm -f -- "$RUNFILE" - date +%s > /run/openslx/session-killed - loginctl terminate-session "$ses" - else - # Give user a chance to see that it's going to logout in 5 mins - [ "$(( TIMEOUT - NOW ))" -lt 310 ] && xset dpms force on - IS_IDLE=no - fi - else - # xprint* did not work? - IS_IDLE=no - fi - RUNFILE= - continue # Done with this session, skip normal tty/ssh checks - fi - # end X11 - # other sessions - IDLE=$(grep '^IdleSinceHint=' "$TMP" | cut -c 15-) - if [ "${#IDLE}" -lt 7 ]; then # wah wah waaaah - IS_IDLE=no - continue - fi - # divide by 1000000 by chopping of last 6 chars - number might be too large for $(( )) - IDLE=$(echo "$IDLE" | cut -c "-$(( ${#IDLE} - 6 ))") - [ "$IDLE" -gt "$NOW" ] && IDLE="$NOW" - IDLE=$(( $NOW - $IDLE )) - if [ "$IDLE" -lt "$SLX_LOGOUT_TIMEOUT" ]; then - IS_IDLE=no - else - date +%s > /run/openslx/session-killed - loginctl terminate-session "$ses" - fi - # end other sessions - done - rm -f -- "$TMP" - fi - if [ "$IS_IDLE" = "yes" ]; then - [ ! -e "$IDLEHINT" ] && echo "$NOW" > "$IDLEHINT" - else - rm -f -- "$IDLEHINT" - fi -else - # No logout timeout is set, take shortcut for shutdown/suspend timeout (if set) - if [ -n "$SLX_SHUTDOWN_TIMEOUT" ] || [ -n "$SLX_SYSTEM_STANDBY_TIMEOUT" ]; then - SESSIONS=$(get_sessions) - if [ -z "$SESSIONS" ]; then - [ ! -e "$IDLEHINT" ] && echo "$NOW" > "$IDLEHINT" - else - rm -f -- "$IDLEHINT" - gen_runfile > "/run/openslx/idleaction-:0" # hard-code for primary X session - fi - fi -fi - -# -# 2) Check for no-session shutdown/suspend timeout -# -if [ -e "$IDLEHINT" ]; then - IDLE=$(cat "$IDLEHINT") - [ "$IDLE" -gt "$NOW" ] && IDLE="$NOW" - IDLE=$(( $NOW - $IDLE )) - if [ -n "${SLX_SHUTDOWN_TIMEOUT}" ] && [ "${SLX_SHUTDOWN_TIMEOUT}" -gt 0 ] && [ "$IDLE" -gt "$SLX_SHUTDOWN_TIMEOUT" ]; then - poweroff & - exit 0 - elif [ -n "${SLX_SYSTEM_STANDBY_TIMEOUT}" ] && [ "${SLX_SYSTEM_STANDBY_TIMEOUT}" -gt 0 ] && [ "$IDLE" -gt "$SLX_SYSTEM_STANDBY_TIMEOUT" ]; then - rm -f -- "$IDLEHINT" - if ! systemctl suspend; then - slxlog --sync "idleaction-no-suspend" "Client does not support standby/suspend, doing nothing" - fi - exit 0 - fi -fi - -# -# 3) Check for hard scheduled shutdown/reboot -# -# A cron file is created dynamically here so there's everything -# in one module and you don't need to repack config.tgz - -invalid_time () -{ - slxlog "idleaction-schedule" "Invalid shutdown time: '$time'. Expected HH:MM format." - return 0 -} - -write_crontab () -{ - local ACTION time HOUR MINUTE - [ $# -lt 1 ] && return - ACTION=$1 - shift - for time in $*; do - HOUR=${time%%:*} - MINUTE=${time##*:} - [ -z "$HOUR" -o -z "$MINUTE" ] && invalid_time && continue - [ "$HOUR" -lt 0 -o "$HOUR" -gt 23 ] && invalid_time && continue - [ "$MINUTE" -lt 0 -o "$MINUTE" -gt 59 ] && invalid_time && continue - echo "$MINUTE $HOUR * * * root /opt/openslx/scripts/idleaction-scheduled_action $ACTION --time $time" >> "$CRONFILE" - done -} - -if [ -n "$SLX_SHUTDOWN_SCHEDULE" -o -n "$SLX_REBOOT_SCHEDULE" ] && [ ! -e "$CRONFILE" ]; then - { - echo "# OpenSLX: Trigger poweroff/reboot at certain time of day" - echo "SHELL=/bin/ash" - echo "PATH=/usr/sbin:/usr/bin:/sbin:/bin:/opt/openslx/sbin:/opt/openslx/bin" - echo "" - } > "$CRONFILE" - write_crontab "poweroff" "$SLX_SHUTDOWN_SCHEDULE" - write_crontab "reboot" "$SLX_REBOOT_SCHEDULE" - # Might want to re-set rtcwake timestamp periodically - if [ -n "$SLX_WAKEUP_SCHEDULE" ]; then - echo "0 * * * * root /opt/openslx/scripts/systemd-idleaction_init" >> "$CRONFILE" - fi - touch "/etc/cron.d" # Aufs bug where it won't update dir mtime when creating the file within -fi - diff --git a/core/modules/idleaction/data/opt/openslx/scripts/idleaction-scheduled_action b/core/modules/idleaction/data/opt/openslx/scripts/idleaction-scheduled_action index 35b31748..38be4f79 100755 --- a/core/modules/idleaction/data/opt/openslx/scripts/idleaction-scheduled_action +++ b/core/modules/idleaction/data/opt/openslx/scripts/idleaction-scheduled_action @@ -7,39 +7,66 @@ if ! touch "/run"; then exit 1 fi -DETACH= if [ "$1" = "--detach" ]; then - DETACH=yes - shift + shift # Legacy, ignored fi if [ $# -lt 1 ]; then - echo "$0 [--detach] <reboot|poweroff|kexec-reboot> [delay_minutes]" >&2 + echo "$0 <reboot|poweroff|kexec-reboot> [--delay minutes] [--time <now as hh:mm>] [--uuid thismachine]" >&2 exit 2 fi +MODE=$1 + DELAY= TS= -MODE=$1 +WANTUUID= shift while [ $# -gt 0 ]; do - if [ "$1" == "--time" ]; then - TS=$2 + if [ "$1" = "--time" ]; then + TS="$2" + shift + elif [ "$1" = "--delay" ]; then + DELAY="$2" shift - elif [ "$1" == "--delay" ]; then - DELAY=$2 + elif [ "$1" = "--uuid" ]; then + WANTUUID="$2" shift else break fi shift done -[ -n "$1" ] && [ -z "$DELAY" ] && DELAY=$1 +# Legacy cmdline format +if [ -n "$1" ] && [ -z "$DELAY" ]; then + DELAY="$1" + shift +fi +if [ -n "$1" ] && [ -z "$WANTUUID" ]; then + WANTUUID="$1" + shift +fi + +if [ -n "$WANTUUID" ] && [ -s "/etc/system-uuid" ]; then + WANTUUID="$( echo "$WANTUUID" | tr 'a-f' 'A-F' )" + ISUUID="$( cat /etc/system-uuid )" + if [ "$ISUUID" != "$WANTUUID" ]; then + echo "ERROR: Sanity check failed: System-UUID mismatch." >&2 + echo "Is: '$ISUUID', want: '$WANTUUID'" >&2 + exit 1 + fi +fi + +if [ "$MODE" != "reboot" ] && [ "$MODE" != "poweroff" ] && [ "$MODE" != "kexec-reboot" ]; then + slxlog --echo "idleaction-failed-call" "Invalid call to idleaction-scheduled_action. Mode '$MODE' unknown." >&2 + exit 3 +fi if [ -n "$TS" ]; then - # Sanity check for trigger by cron - # Sleep first so the clock has time to get adjusted + # Sanity check: If passing time, this has to be from when the request was thought to be triggered. + # Mostly useful if you remotely trigger this and want to make sure your request arrives in time. + # Sleep first so the clock has time to get adjusted in case of bootup or wakeup sleep 10 NOW=$(date +%s) SHOULD=$(date -d "today $TS" +%s) @@ -51,117 +78,8 @@ if [ -n "$TS" ]; then fi fi -if [ "$MODE" != "reboot" ] && [ "$MODE" != "poweroff" ] && [ "$MODE" != "kexec-reboot" ]; then - slxlog --echo "idleaction-failed-call" "Invalid call to idleaction-scheduled_action. Mode '$MODE' unknown." >&2 - exit 3 -fi - -NUM=$(who | wc -l) -if [ -z "$DELAY" ] && [ "$NUM" = "0" ]; then - # Easy way out - machine is idle and no delay - ( - # Detach, close all in/out fds - needed for some ssh clients to rpevent them from hanging - exec < /dev/null &> /dev/null - sleep 1 - $MODE - ) & - disown - exit 0 -fi - -NOW=$(date +%s) -timeout=$(( 300 + NOW )) # 5 minute delay for logged in user -if [ -n "$DELAY" ] && [ "$DELAY" -gt 0 ]; then - timeout=$(( timeout + ( DELAY * 60 ) )) -fi - -for f in /run/openslx/idleaction-*; do - [ -f "$f" ] || continue - grep -q '^shutdownDeadline=' "$f" || continue - RET=$(awk -F= '{if ($1 == "shutdownDeadline") { print $2; exit } }' "$f") - if [ -z "$RET" ] || [ "$RET" -eq 0 ] || ! [ "$RET" -lt "$timeout" ] || [ 333 -lt "$(( NOW - RET ))" ]; then - sed -i "s/^shutdownDeadline=.*$/shutdownDeadline=$timeout/" "$f" - fi -done - -runaction () { - # Someone logged in or delay requested - [ -n "$DETACH" ] && sleep 1 - if [ -n "$DELAY" ] && [ "$DELAY" -gt 0 ]; then - echo "Doing $MODE in $DELAY minutes!" - sleep $(( DELAY * 60 )) - fi - for MINUTES in 5 X X X X X X X 3 X X X 2 X X X 1 X X X; do - if [ -f "/run/openslx/demo-no-logout-delay" ]; then - NUM=$(who | grep -v '^demo ' | wc -l) - else - NUM=$(who | wc -l) - fi - [ "$NUM" = "0" ] && break - if [ "$MINUTES" != "X" ]; then - USERS=0 - if [ "${MODE#*-}" = "reboot" ]; then - MESSAGE="Das System wird in $MINUTES Minute(n) neugestartet, bitte beenden Sie Ihre Sitzung. - The system will reboot in $MINUTES minute(s). Please save your work and end the session." - else - MESSAGE="Dieser Rechner wird in $MINUTES Minute(n) abgeschaltet, bitte beenden Sie Ihre Sitzung. - The system will power off in $MINUTES minute(s). Please save your work and end the session." - fi - for d in $(who | awk '{print $2 " " $NF}' | sort -u); do - if [ "${d:0:1}" = ":" ]; then - # X11 - export DISPLAY=$d - export XAUTHORITY=$(ps a | grep " $DISPLAY " | grep -o -- '-auth.*$' | grep -m1 -v grep | awk '{print $2}') - # Make sure user sees warning - xset dpms force on - # TODO: Don't look... We need to pick a proper util for this - /opt/openslx/cups/printergui --error "$MESSAGE" & - unset DISPLAY XAUTHORITY - USERS=$(( $USERS + 1 )) - elif [ "${d:0:3}" = "tty" ]; then - # Regular tty - cat > "/dev/$d" <<-EOF - * - *************************** - $MESSAGE - *************************** - * - EOF - USERS=$(( $USERS + 1 )) - elif [ "${d:0:3}" = "pts" ]; then - # pts - xterm or ssh session - cat > "/dev/pts/${d:3}" <<-EOF - * - *************************** - $MESSAGE - *************************** - * - EOF - USERS=$(( $USERS + 1 )) - fi - done - FILE=$(mktemp) - who > "$FILE" - slxlog "idleaction-busy" "Postponed $MODE ($MINUTES minutes max.) - $USERS user(s) still active" - sleep 1 - rm -- "$FILE" - fi - sleep 15 - done - - $MODE -} - -if [ -n "$DETACH" ]; then - ( - # Detach, see above - exec < /dev/null &> /dev/null - runaction - ) & - disown - exit 0 -fi - -runaction -exit 0 +# Fire away +[ -z "$DELAY" ] && DELAY=0 +DELAY="$(( DELAY * 60 ))" +idle-daemon --send "${MODE%-reboot} $DELAY" diff --git a/core/modules/idleaction/module.build b/core/modules/idleaction/module.build index fcae45e0..6aac9d93 100644 --- a/core/modules/idleaction/module.build +++ b/core/modules/idleaction/module.build @@ -1,6 +1,6 @@ #!/bin/bash fetch_source() { - : + autoclone } build() { @@ -11,6 +11,15 @@ build() { || perror "Compilation of xprintidle failed!" gcc -std=c99 -o "$MODULE_BUILD_DIR/opt/openslx/bin/xprintlocktime" "$MODULE_DIR/xprintlocktime.c" -lX11 \ || perror "Compilation of xprintlocktime failed!" + # idle-daemon + local SRCDIR="${MODULE_WORK_DIR}/src/idle-daemon" + + mkdir -p "$MODULE_BUILD_DIR/opt/openslx/sbin" + cd "${MODULE_BUILD_DIR}/opt/openslx/sbin" || perror "Could not cd!" + pinfo "Running cmake" + cmake "$SRCDIR" || perror "'cmake $SRCDIR' failed." + pinfo "Running make" + make || perror "'make' failed." } post_copy() { diff --git a/core/modules/idleaction/module.conf b/core/modules/idleaction/module.conf index bec80ef3..24d0a301 100644 --- a/core/modules/idleaction/module.conf +++ b/core/modules/idleaction/module.conf @@ -1,6 +1,11 @@ #!/bin/bash REQUIRED_BINARIES=" + idle-daemon xprintidle xprintlocktime " +REQUIRED_GIT=" + https://git.openslx.org/openslx-ng/idle-daemon.git +" + diff --git a/core/modules/xscreensaver/data/etc/X11/Xsession.d/95-xscreensaver b/core/modules/xscreensaver/data/etc/X11/Xsession.d/95-xscreensaver index 2b4fbef5..1220dad3 100755 --- a/core/modules/xscreensaver/data/etc/X11/Xsession.d/95-xscreensaver +++ b/core/modules/xscreensaver/data/etc/X11/Xsession.d/95-xscreensaver @@ -1,8 +1,8 @@ #!/bin/ash -DPMS=False -AUTOLOCK=True if which xscreensaver; then + DPMS=False + AUTOLOCK=True secsToTime() { local NUM SECS MINS HRS NUM="$1" @@ -14,9 +14,8 @@ if which xscreensaver; then [ -z "$UID" ] && UID=$(id -u) [ -z "$HOME" ] && HOME="$(getent passwd "$UID" | head -n 1 | awk -F ':' '{print $6}')" . /opt/openslx/config - SBY=${SLX_SCREEN_STANDBY_TIMEOUT} + SBY="${SLX_SCREEN_STANDBY_TIMEOUT}" if [ -n "${SLX_EXAM}" ]; then - SLX_LOGOUT_TIMEOUT=0 SLX_SCREEN_SAVER_TIMEOUT=0 SLX_SCREEN_SAVER_GRACE_TIME= AUTOLOCK=False @@ -28,23 +27,16 @@ if which xscreensaver; then elif ! [ "$SBY" -ge 0 ]; then # isNumeric? SBY=0 fi - # Make sure standby timeout is less than logout timeout, otherwise, disable standby + # Create config value for standby timeout if [ "$SBY" -gt 0 ]; then - if [ "$SLX_LOGOUT_TIMEOUT" -gt 0 ]; then - if [ "$SBY" -lt 300 ]; then - SBY=300 - fi - if [ "$SLX_LOGOUT_TIMEOUT" -lt "$SBY" ]; then - SBY=0 - fi - fi + DPMS=True + STANDBY="$( secsToTime "$(( SBY + 60 ))" )" + else + STANDBY="99:00:00" fi - # Create config value for standby timeout - [ "$SBY" -gt 0 ] && DPMS=True - STANDBY="$( secsToTime "$SBY" )" # Explicit screen saver timeout set if [ "$SLX_SCREEN_SAVER_TIMEOUT" -gt 0 ]; then - TIMEOUT="$( secsToTime "$SLX_SCREEN_SAVER_TIMEOUT" )" + TIMEOUT="$( secsToTime "$(( SLX_SCREEN_SAVER_TIMEOUT + 30 ))" )" else TIMEOUT="99:00:00" fi |