Merge pull request #438 from flatcar-linux/kai/allow-id-500

Support running under UID 500
This commit is contained in:
Kai Lüke 2022-09-01 10:58:56 +02:00 committed by GitHub
commit a791cb8657
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View File

@ -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
@ -146,4 +147,4 @@ fi
# Workaround: The SDK expects to be able to write to /etc/hosts
$docker exec "$name" sh -c 'cp /etc/hosts /etc/hosts2; umount /etc/hosts ; mv /etc/hosts2 /etc/hosts'
$docker exec $tty -i "$name" /home/sdk/sdk_entry.sh "$@"
$docker exec $tty -i "$name" /mnt/host/source/src/scripts/sdk_lib/sdk_entry.sh "$@"

View File

@ -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