Don't use 'su' in qubes.WaitForSession if not needed

This commit is contained in:
Marek Marczykowski-Górecki 2017-07-05 13:14:48 +02:00
parent 626d20b5c2
commit 80d41cd10a
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -1,5 +1,10 @@
#!/bin/sh
read USERNAME
su -c 'echo $$ >> /tmp/qubes-session-waiter; [ ! -f /tmp/qubes-session-env ] && exec sleep inf' - "$USERNAME" 2> /dev/null
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
su -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