mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-23 06:31:18 +02:00
The default branch of both repos, coreos-overlay and portage-stable, should be `main`. If we checkout `master` branch, which contains invalid source code that was deprecated many years ago, the build could sometimes fail, e.g. when trying to build perl 5.26.2 with gcc 10. Simply delete the code checking out branches, as the part is already being handled in emerge-gitclone.
47 lines
1.6 KiB
Bash
Executable File
47 lines
1.6 KiB
Bash
Executable File
#!/bin/bash
|
|
set -ex
|
|
|
|
sudo rm -f flatcar_developer_container.bin*
|
|
trap 'sudo rm -f flatcar_developer_container.bin*' EXIT
|
|
|
|
[ -s verify.asc ] && verify_key=--verify-key=verify.asc || verify_key=
|
|
|
|
bin/gangue get \
|
|
--json-key="${GOOGLE_APPLICATION_CREDENTIALS}" \
|
|
--verify=true $verify_key \
|
|
"${DOWNLOAD_ROOT}/boards/${BOARD}/${VERSION}/flatcar_production_image_kernel_config.txt"
|
|
|
|
bin/gangue get \
|
|
--json-key="${GOOGLE_APPLICATION_CREDENTIALS}" \
|
|
--verify=true $verify_key \
|
|
"${DOWNLOAD_ROOT}/boards/${BOARD}/${VERSION}/flatcar_developer_container.bin.bz2"
|
|
bunzip2 flatcar_developer_container.bin.bz2
|
|
|
|
if [[ "$(systemd-nspawn --version | grep 'systemd 241')" = "" ]]
|
|
then
|
|
PIPEARG="--pipe"
|
|
else
|
|
# TODO: Remove this case once Flatcar >=2592 is used on all nodes
|
|
PIPEARG=""
|
|
fi
|
|
|
|
sudo systemd-nspawn $PIPEARG \
|
|
--setenv=PORTAGE_BINHOST="${PORTAGE_BINHOST}" \
|
|
--bind-ro=/lib/modules \
|
|
--bind-ro="$PWD/flatcar_production_image_kernel_config.txt:/boot/config" \
|
|
--bind-ro="${GOOGLE_APPLICATION_CREDENTIALS}:/opt/credentials.json" \
|
|
--bind-ro="$PWD/verify.asc:/opt/verify.asc" \
|
|
--image=flatcar_developer_container.bin \
|
|
--machine=flatcar-developer-container-$(uuidgen) \
|
|
--tmpfs=/usr/src \
|
|
--tmpfs=/var/tmp \
|
|
/bin/bash -eux << 'EOF'
|
|
export PORTAGE_BINHOST="${PORTAGE_BINHOST}"
|
|
export {FETCH,RESUME}COMMAND_GS="/usr/bin/gangue get --json-key=/opt/credentials.json --verify=true /opt/verify.asc \"\${URI}\" \"\${DISTDIR}/\${FILE}\""
|
|
emerge-gitclone
|
|
. /usr/share/coreos/release
|
|
emerge -gv coreos-sources
|
|
ln -fns /boot/config /usr/src/linux/.config
|
|
exec make -C /usr/src/linux -j"$(nproc)" modules_prepare V=1
|
|
EOF
|