mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-07 04:56:58 +02:00
Support running under UID 500
When started by the Flatcar core user, the SDK failed to use UID 500 because inside the SDK there already is the core user from nss-altfiles with the same ID. This way, the SDK user was continuing with UID 1000 and had permission errors. Allow to reuse an existing ID for the SDK user. However, this only works when usermod doesn't find a process that uses this ID, and we had a race between the SDK entry points called by "docker start" and by "docker exec". The race is unwanted anyway because we don't want to execute the commands while setup_board is still running. Solve it by setting the entrypoint for "docker start" directly to "bash -l" in "docker create" (this is also what the entry point does as last step: sudo su -l).
This commit is contained in:
parent
d0ef3dace7
commit
834e0c11d7
@ -129,7 +129,8 @@ if [ -z "$stat" ] ; then
|
||||
-e SDK_GROUP_ID="$(id -g)" \
|
||||
--name="$name" \
|
||||
--hostname="$hostname" \
|
||||
"${container_image_name}"
|
||||
--entrypoint /bin/bash \
|
||||
"${container_image_name}" -l
|
||||
fi
|
||||
|
||||
if [ "$stat" != "Up" ] ; then
|
||||
|
@ -1,10 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ -n "${SDK_USER_ID:-}" ] ; then
|
||||
usermod -u $SDK_USER_ID sdk
|
||||
# If the "core" user from /usr/share/baselayout/passwd has the same ID, allow to take it instead
|
||||
usermod --non-unique -u $SDK_USER_ID sdk
|
||||
fi
|
||||
if [ -n "${SDK_GROUP_ID:-}" ] ; then
|
||||
groupmod -g $SDK_GROUP_ID sdk
|
||||
groupmod --non-unique -g $SDK_GROUP_ID sdk
|
||||
fi
|
||||
|
||||
chown -R sdk:sdk /home/sdk
|
||||
|
Loading…
Reference in New Issue
Block a user