26 lines
834 B
Plaintext
26 lines
834 B
Plaintext
|
|
# #!/bin/bash
|
||
|
|
set -euo pipefail
|
||
|
|
LOG_FILE="$HOME/.local/logs/session.log"
|
||
|
|
|
||
|
|
log() { echo "[$(date --iso-8601=seconds)] $*" | tee -a "$LOG_FILE"; }
|
||
|
|
|
||
|
|
env > $XDG_RUNTIME_DIR/steamos-environment
|
||
|
|
log "Starting SteamOS Session"
|
||
|
|
while true; do
|
||
|
|
systemctl --user --wait start steamos.service
|
||
|
|
wait_status=$?
|
||
|
|
log "Graphical session service exited with status $wait_status"
|
||
|
|
if [ $wait_status -ne 0 ]; then
|
||
|
|
log "Graphical session service exited with error; ending loop."
|
||
|
|
break
|
||
|
|
fi
|
||
|
|
if [ -f "$HOME/.steamos-session-switch" ]; then
|
||
|
|
log "Graphical session service exited; switch file present -> restarting..."
|
||
|
|
rm "$HOME/.steamos-session-switch"
|
||
|
|
continue
|
||
|
|
fi
|
||
|
|
log "Graphical session service exited; switch file absent -> ending loop."
|
||
|
|
break
|
||
|
|
done
|
||
|
|
sleep 5
|
||
|
|
log "SteamOS Session Ended"
|