qubes.WaitForSession: refactor by waiting for qrexec-fork-server socket
This commit is contained in:
parent
8c8666451e
commit
a44e73900e
@ -1,16 +1,8 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
# old API - get the user from caller
|
USERNAME="$(qubesdb-read /default-user || echo 'user')"
|
||||||
#read -r IGNORE_USERNAME
|
|
||||||
|
|
||||||
# use default user provided in QubesDB, or hardcoded 'user' - this must be the
|
while ! [ -e "/var/run/qubes/qrexec-server.$USERNAME.sock" ]
|
||||||
# same as the X session owner
|
do
|
||||||
USERNAME=$(qubesdb-read /default-user || echo 'user')
|
sleep 0.1
|
||||||
cmd='echo $$ >> /tmp/qubes-session-waiter; [ ! -f /tmp/qubes-session-env ] && exec sleep inf'
|
done
|
||||||
if [ "$(id -un)" = "$USERNAME" ]; then
|
|
||||||
sh -c "$cmd" 2>/dev/null
|
|
||||||
else
|
|
||||||
su -s /bin/sh -c "$cmd" - "$USERNAME" 2> /dev/null
|
|
||||||
fi
|
|
||||||
# the above line is _expected_ to be terminated by a signal, don't treat this as a failure
|
|
||||||
exit 0
|
|
||||||
|
Loading…
Reference in New Issue
Block a user