#!/bin/bash load_session() { if [ "$UID" = "59999" ]; then # Guest user must be ignored exit 0 fi # currently we are not supporting other desktop environments if [ "$XDG_CURRENT_DESKTOP" = "KDE" ]; then if [ "$UID" -gt 1041 ]; then RC=0 RET=$(n4d-client -h server -m is_frozen_user -c Golem -a $USER 2>/dev/null || echo False) # Fallback in case function is not supported. It should be, but still... RET=$( echo $RET | grep FUNCTION 1>/dev/null && echo False || echo $RET ) # If not False (ie True), user is frozen echo $RET | grep False 1>/dev/null || RC=1 eval $(n4d-vars getvalues SRV_LITE_MODE SRV_MOVING_MODE) OVERRIDE_FILE="/etc/classroom-servermode-override" if [ -e "$OVERRIDE_FILE" ]; then eval $(cat $OVERRIDE_FILE) fi RUN=0 if [ "$SRV_LITE_MODE" = "True" ]; then if [ "$SRV_MOVING_MODE" = "False" ]; then RUN=1 fi fi if [ $RUN -eq 0 ]; then #perform session load llx-moving-cmd load || true #create session lock touch $XDG_RUNTIME_DIR/llx-moving-$XDG_SESSION_ID if [ $RC -eq 1 ]; then rm -rf ~/.config/plasma* rm -rf ~/.config/kwin* #ToDo: add more setup files fi fi fi fi } save_session() { if [ -e $XDG_RUNTIME_DIR/llx-moving-$XDG_SESSION_ID ]; then #perform session save llx-moving-cmd save || true #remove lock rm -f $XDG_RUNTIME_DIR/llx-moving-$XDG_SESSION_ID fi } case $1 in load) load_session ;; save) save_session ;; *) echo "Unknown option" ;; esac