qubes.WaitForSession 549 B

12345678910111213141516
  1. #!/bin/sh
  2. # old API - get the user from caller
  3. #read -r IGNORE_USERNAME
  4. # use default user provided in QubesDB, or hardcoded 'user' - this must be the
  5. # same as the X session owner
  6. USERNAME=$(qubesdb-read /default-user || echo 'user')
  7. cmd='echo $$ >> /tmp/qubes-session-waiter; [ ! -f /tmp/qubes-session-env ] && exec sleep inf'
  8. if [ "$(id -un)" = "$USERNAME" ]; then
  9. sh -c "$cmd" 2>/dev/null
  10. else
  11. su -c "$cmd" - "$USERNAME" 2> /dev/null
  12. fi
  13. # the above line is _expected_ to be terminated by a signal, don't treat this as a failure
  14. exit 0