From 5b28cfafb245fb1e012a6bda91968d4b33297889 Mon Sep 17 00:00:00 2001 From: Rolf Neugebauer Date: Fri, 28 Apr 2017 15:28:38 +0100 Subject: [PATCH] kernels: Add support for creating ubuntu kernel packages This only covers the 4.x Ubuntu kernels and for now does not include the headers to build modules against. Signed-off-by: Rolf Neugebauer --- scripts/kernels/ubuntu.sh | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 scripts/kernels/ubuntu.sh diff --git a/scripts/kernels/ubuntu.sh b/scripts/kernels/ubuntu.sh new file mode 100755 index 000000000..2609af237 --- /dev/null +++ b/scripts/kernels/ubuntu.sh @@ -0,0 +1,34 @@ +#! /bin/sh + +REPO="linuxkit/kernel-ubuntu" +BASE_URL=http://mirrors.kernel.org/ubuntu/pool/main/l/linux/ + +ARCH=amd64 +LINKS=$(curl -s ${BASE_URL}/ | sed -n 's/.*href="\([^"]*\).*/\1/p') +# Just get names for 4.x kernels +KERNELS=$(echo $LINKS | \ + grep -o "linux-image-4\.[0-9]\+\.[0-9]\+-[0-9]\+-generic_[^ ]\+${ARCH}\.deb") + +for KERN_DEB in $KERNELS; do + VERSION=$(echo $KERN_DEB | \ + grep -o "[0-9]\+\.[0-9]\+\.[0-9]\+-[0-9]\+" | head -1) + + echo "$VERSION -> $KERN_DEB" + DOCKER_CONTENT_TRUST=1 docker pull ${REPO}:${VERSION} && continue + + EXTRA_DEB=$(echo $LINKS | \ + grep -o "linux-image-extra-${VERSION}-generic_[^ ]\+${ARCH}\.deb") + + # Don't pull in the headers. This is mostly for testing + # HDR_DEB=$(echo $LINKS | \ + # grep -o "linux-headers-${VERSION}_[^ ]\+_all\.deb") + # HDR_ARCH_DEB=$(echo $LINKS | \ + # grep -o "linux-headers-${VERSION}-generic_[^ ]\+_${ARCH}\.deb") + + URLS="${BASE_URL}/${KERN_DEB} ${BASE_URL}/${EXTRA_DEB} ${BASE_URL}/${HDR_DEB} ${BASE_URL}/${HDR_ARCH_DEB}" + + # Doesn't exist build and push + docker build -t ${REPO}:${VERSION} -f Dockerfile.deb --no-cache \ + --build-arg DEB_URLS="${URLS}" . && + DOCKER_CONTENT_TRUST=1 docker push ${REPO}:${VERSION}) +done