2017-05-31 13:36:12 +02:00
|
|
|
#!/bin/sh
|
2018-02-14 02:19:15 +01:00
|
|
|
|
|
|
|
# old API - get the user from caller
|
|
|
|
#read -r IGNORE_USERNAME
|
|
|
|
|
|
|
|
# use default user provided in QubesDB, or hardcoded 'user' - this must be the
|
|
|
|
# same as the X session owner
|
|
|
|
USERNAME=$(qubesdb-read /default-user || echo 'user')
|
2017-07-05 13:14:48 +02:00
|
|
|
cmd='echo $$ >> /tmp/qubes-session-waiter; [ ! -f /tmp/qubes-session-env ] && exec sleep inf'
|
|
|
|
if [ "$(id -un)" = "$USERNAME" ]; then
|
|
|
|
sh -c "$cmd" 2>/dev/null
|
|
|
|
else
|
2019-07-05 20:38:04 +02:00
|
|
|
su -s /bin/sh -c "$cmd" - "$USERNAME" 2> /dev/null
|
2017-07-05 13:14:48 +02:00
|
|
|
fi
|
2017-05-31 13:36:12 +02:00
|
|
|
# the above line is _expected_ to be terminated by a signal, don't treat this as a failure
|
|
|
|
exit 0
|