mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-06 04:26:59 +02:00
This change introduces a containerised SDK as a replacement for cork SDK operations. It also simplifies versioning by removing the need for manifest repos as well as usage of the "repo" tool by use of git submodules for coreos-overlay and portage-stable. The following feature scripts are added: - run_sdk_container: Run a command in an SDK container, using the current scripts repo + ebuild submodules. current scripts repo + ebuild submodules. - bootstrap_sdk_container / build_sdk_container_image: Bootstrap a new SDK and create an SDK container from the resulting SDK tarball. The following additions have been made to SDK scripts: - setup_board: add --pkgdir parameter to use a custom binary packge directory. Signed-off-by: Thilo Fromm <thilo@kinvolk.io>
38 lines
1.0 KiB
Bash
Executable File
38 lines
1.0 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
if [ -n "${SDK_USER_ID:-}" ] ; then
|
|
usermod -u $SDK_USER_ID sdk
|
|
fi
|
|
if [ -n "${SDK_GROUP_ID:-}" ] ; then
|
|
groupmod -g $SDK_GROUP_ID sdk
|
|
fi
|
|
|
|
chown -R sdk:sdk /home/sdk
|
|
|
|
# This is ugly.
|
|
# We need to sudo su - sdk -c 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>".
|
|
# 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.
|
|
if [ $# -gt 0 ] ; then
|
|
cmd="/home/sdk/.cmd"
|
|
echo -n "exec bash -i -c '" >"$cmd"
|
|
for arg in "$@"; do
|
|
echo -n "\"$arg\" " >>"$cmd"
|
|
done
|
|
echo "'" >>"$cmd"
|
|
chmod 755 "$cmd"
|
|
sudo su sdk -c "$cmd"
|
|
rc=$?
|
|
rm -f "$cmd"
|
|
exit $rc
|
|
else
|
|
exec sudo su sdk
|
|
fi
|