qubes.WaitForSession 336 B

12345678910
  1. #!/bin/sh
  2. read USERNAME
  3. cmd='echo $$ >> /tmp/qubes-session-waiter; [ ! -f /tmp/qubes-session-env ] && exec sleep inf'
  4. if [ "$(id -un)" = "$USERNAME" ]; then
  5. sh -c "$cmd" 2>/dev/null
  6. else
  7. su -c "$cmd" - "$USERNAME" 2> /dev/null
  8. fi
  9. # the above line is _expected_ to be terminated by a signal, don't treat this as a failure
  10. exit 0