PTU5KAS/container-entrypoint
Jan Kiszka da62e0bfbd kas-container: Add support for menu plugin
For this script, this is almost straightforward - except that we need to
extract the static KAS_BUILD_SYSTEM config setting from the selected
Kconfig file so that the correct container image and mode is chosen.

Two new dependencies need to be added to the container image. While
python3-newt can come from Debian, kconfiglib only exists as Python
package. To make sure we are not pulling any other packages via pip,
install kconfiglib upfront. It has no own dependencies, thus can use
--no-deps as well.

Finally, the container-entrypoint needs to be updated to make it aware
of the new plugin.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2021-10-09 15:00:05 +02:00

53 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
if mount | grep -q "on / type aufs"; then
cat <<EOF >&2
WARNING: Generation of wic images will fail!
Your docker host setup uses broken aufs as storage driver. Adjust the docker
configuration to use a different driver (overlay, overlay2, devicemapper). You
may also need to update the host distribution (e.g. Debian Jessie -> Stretch).
EOF
fi
USER_ID=${USER_ID:-30000}
GROUP_ID=${GROUP_ID:-30000}
if [ $USER_ID == 0 ]; then
# We shall run everything as root
mkdir -p /builder
GOSU=""
elif [ $USER_ID == $UID ]; then
GOSU=""
else
if ! grep -q "^builder:" /etc/group; then
groupadd -o --gid $GROUP_ID builder
fi
if ! id builder >/dev/null 2>&1; then
# Create a non-root user that will perform the actual build
useradd -o --uid $USER_ID --gid $GROUP_ID --create-home \
--home-dir /builder builder
fi
GOSU="gosu builder"
fi
if [ "$PWD" = / ]; then
cd /builder
fi
if [ -n "$1" ]; then
case "$1" in
build|checkout|for-all-repos|menu|shell|-*)
exec $GOSU kas "$@"
;;
*)
exec $GOSU "$@"
;;
esac
else
exec $GOSU bash
fi