#!/bin/bash -ex . /usr/share/coreos/release # Try to determine which channel contains this CoreOS version. for group in stable beta alpha do url="http://$group.release.core-os.net/$COREOS_RELEASE_BOARD/$COREOS_RELEASE_VERSION/coreos_developer_container.bin.bz2" curl --fail --head --location --silent "$url" >/dev/null && break done # Download, decompress, and verify the developer container image. gpg2 --recv-keys 04127D0BFABEC8871FFB2CCE50E0885593D2DCB4 curl --fail --location "$url" | tee >(bzip2 --decompress > coreos_developer_container.bin) | gpg2 --verify <(curl --location --silent "$url.sig") - # Run the build scripts in the container with the host modules directory. systemd-nspawn \ --bind=/lib/modules \ --image=coreos_developer_container.bin \ /bin/bash -ex <<- 'EOF' . /usr/share/coreos/release # Check out the current CoreOS version's ebuilds. emerge-gitclone git -C /var/lib/portage/coreos-overlay \ checkout "build-${COREOS_RELEASE_VERSION%%.*}" || : # Stay on master if this version hasn't branched yet. # Prepare the Linux kernel source for building external modules. emerge -gKv coreos-sources gzip -cd /proc/config.gz > /usr/src/linux/.config make -C /usr/src/linux modules_prepare # Run any build scripts. shopt -s nullglob for project in /lib/modules/auto-update-kmods.d/*.sh do (. "$project") done # Update the kernel module dependency files. depmod EOF # Delete the developer container to save space. rm --force coreos_developer_container.bin