mirror of
https://github.com/flatcar/scripts.git
synced 2026-04-15 02:22:15 +02:00
sdk_entry.sh: Fix writing to /dev/stdout and /dev/stderr
Entering the SDK via `su` breaks stdout/stderr permissions because the underlying /dev/pts/N device is still owned by root. `sudo` doesn't have this problem. Neither does `runuser`, which might be preferable, but the SDK doesn't have that. This was previously `sudo su`, so changing this to `sudo sudo` might seem logical, but I think the original `sudo` was only there to prevent `su` from asking for a password. That shouldn't happen with a single `sudo` call. Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
This commit is contained in:
parent
44206ec025
commit
44bd310fb7
@ -126,16 +126,16 @@ grep -q 'export SYSEXT_SIGNING_KEY_DIR' /home/sdk/.bashrc || {
|
||||
}
|
||||
|
||||
# This is ugly.
|
||||
# We need to sudo su - sdk -c so the SDK user gets a fresh login.
|
||||
# We need to sudo -u sdk -i so the SDK user gets a fresh login.
|
||||
# 'sdk' is member of multiple groups, and plain docker USER only
|
||||
# allows specifying membership of a single group.
|
||||
# When a command is passed to the container, we run, respectively:
|
||||
# sudo su - sdk -c "<command>".
|
||||
# sudo -u sdk "<command>".
|
||||
# Then, we need to preserve whitespaces in arguments of commands
|
||||
# passed to the container, e.g.
|
||||
# ./update_chroot --toolchain_boards="amd64-usr arm64-usr".
|
||||
# This is done via a separate ".cmd" file since we have used up
|
||||
# our quotes for su -c "<cmd>" already.
|
||||
# our quotes for sudo "<cmd>" already.
|
||||
if [ $# -gt 0 ] ; then
|
||||
cmd="/home/sdk/.cmd"
|
||||
echo -n "exec bash -l -i -c '" >"$cmd"
|
||||
@ -144,10 +144,10 @@ if [ $# -gt 0 ] ; then
|
||||
done
|
||||
echo "'" >>"$cmd"
|
||||
chmod 755 "$cmd"
|
||||
sudo su sdk -c "$cmd"
|
||||
sudo -u sdk "$cmd"
|
||||
rc=$?
|
||||
rm -f "$cmd"
|
||||
exit $rc
|
||||
else
|
||||
exec sudo su -l sdk
|
||||
exec sudo -u sdk -i
|
||||
fi
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user