From d65f376ed967e7d509f2ec375759b9c65ae2b590 Mon Sep 17 00:00:00 2001 From: Sven Dowideit Date: Tue, 1 Nov 2016 15:56:17 +1000 Subject: [PATCH] move the kernel headers and extras images to os repo Signed-off-by: Sven Dowideit --- images/10-extras/Dockerfile | 5 +++++ images/10-extras/extra.sh | 19 +++++++++++++++++++ images/10-headers/Dockerfile | 3 +++ images/10-headers/headers.sh | 24 ++++++++++++++++++++++++ 4 files changed, 51 insertions(+) create mode 100644 images/10-extras/Dockerfile create mode 100755 images/10-extras/extra.sh create mode 100644 images/10-headers/Dockerfile create mode 100755 images/10-headers/headers.sh diff --git a/images/10-extras/Dockerfile b/images/10-extras/Dockerfile new file mode 100644 index 00000000..ceeb57cd --- /dev/null +++ b/images/10-extras/Dockerfile @@ -0,0 +1,5 @@ +FROM alpine:3.4 +# FROM arm64=skip arm=skip +RUN apk --purge --no-cache add kmod bash openssl +COPY extra.sh /usr/bin +CMD ["extra.sh"] diff --git a/images/10-extras/extra.sh b/images/10-extras/extra.sh new file mode 100755 index 00000000..eb0b8aff --- /dev/null +++ b/images/10-extras/extra.sh @@ -0,0 +1,19 @@ +#!/bin/bash +set -e + +DIR=$(readlink /lib/modules/$(uname -r)/build) +STAMP=/lib/modules/$(uname -r)/.extra-done +VER=$(basename $DIR) +URL=${KERNEL_EXTRAS_URL:-https://github.com/rancher/os-kernel/releases/download/${VER}/extra.tar.gz} + +if [ -e $STAMP ]; then + echo Kernel extras already installed. Delete $STAMP to reinstall + exit 0 +fi + +echo Downloading $URL +wget -O - $URL | gzip -dc | tar xf - -C / +depmod -a +touch $STAMP + +echo Kernel extras installed diff --git a/images/10-headers/Dockerfile b/images/10-headers/Dockerfile new file mode 100644 index 00000000..be9712a7 --- /dev/null +++ b/images/10-headers/Dockerfile @@ -0,0 +1,3 @@ +FROM rancher/os-base +COPY headers.sh / +CMD ["/headers.sh"] diff --git a/images/10-headers/headers.sh b/images/10-headers/headers.sh new file mode 100755 index 00000000..6f6f84cd --- /dev/null +++ b/images/10-headers/headers.sh @@ -0,0 +1,24 @@ +#!/bin/bash +set -e + +DIR=$(readlink /lib/modules/$(uname -r)/build) +STAMP=${DIR}/.done +VER=$(basename $DIR) + +if [ "$VER" = "Ubuntu-4.4.0-23.41-rancher2" ]; then + VER=Ubuntu-4.4.0-23.41-rancher2-2 +fi + +KERNEL_HEADERS_URL=${KERNEL_HEADERS_URL:-https://github.com/rancher/os-kernel/releases/download/${VER}/build.tar.gz} + +if [ -e $STAMP ]; then + echo Headers already installed in $DIR + exit 0 +fi + +echo Downloading $KERNEL_HEADERS_URL +mkdir -p $DIR +wget -O - $KERNEL_HEADERS_URL | gzip -dc | tar xf - -C $DIR +touch $STAMP + +echo Headers installed at $DIR