From 1fd2824832f5ec21977679631699689fff3f96ae Mon Sep 17 00:00:00 2001 From: Jessica Frazelle Date: Fri, 5 Jun 2015 18:18:27 -0700 Subject: [PATCH] update kernel install script Signed-off-by: Jessica Frazelle --- kernel-builder/Dockerfile | 15 +-------------- kernel-builder/install_kernel | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 14 deletions(-) create mode 100755 kernel-builder/install_kernel diff --git a/kernel-builder/Dockerfile b/kernel-builder/Dockerfile index 8a5b3df..f40f91e 100644 --- a/kernel-builder/Dockerfile +++ b/kernel-builder/Dockerfile @@ -14,19 +14,6 @@ WORKDIR $HOME ENV JOBS 4 -# add install_kernel helper func -RUN { \ - echo '\ninstall_kernel(){'; \ - echo '\tlocal VERSION=$1'; \ - echo '\n\tif [[ -z $VERSION ]]; then'; \ - echo '\t\techo "Please specify a kernel version."'; \ - echo '\t\treturn 1'; \ - echo '\tfi\n'; \ - echo '\tlocal MAJOR_VERSION=${VERSION:0:1}'; \ - echo '\n\t[ -d /usr/src/linux-${VERSION} ] || curl -sSL https://www.kernel.org/pub/linux/kernel/v${MAJOR_VERSION}.x/linux-${VERSION}.tar.xz | tar -v -C /usr/src -xJ'; \ - echo '\n\tcd /usr/src/linux-${VERSION}'; \ - echo '\n\tnice -19 make -j$JOBS KDEB_PKGVERSION=$PKGVERSION INSTALL_MOD_STRIP=1 deb-pkg'; \ - echo '}'; \ - } >> ~/.bashrc +COPY install_kernel /usr/local/bin/install_kernel CMD [ "bash" ] diff --git a/kernel-builder/install_kernel b/kernel-builder/install_kernel new file mode 100755 index 0000000..891e9f5 --- /dev/null +++ b/kernel-builder/install_kernel @@ -0,0 +1,25 @@ +#!/bin/bash +set -e + +install_kernel(){ + local VERSION=$1 + + if [[ -z $VERSION ]]; then + echo "Please specify a kernel version." + exit 1 + fi + + local MAJOR_VERSION=${VERSION:0:1} + + if [[ "$VERSION" == *-rc* ]]; then + [ -d /usr/src/linux-${VERSION} ] || curl -sSL https://kernel.org/pub/linux/kernel/v${MAJOR_VERSION}.x/testing/linux-${VERSION}.tar.xz | tar -v -C /usr/src -xJ + else + [ -d /usr/src/linux-${VERSION} ] || curl -sSL https://www.kernel.org/pub/linux/kernel/v${MAJOR_VERSION}.x/linux-${VERSION}.tar.xz | tar -v -C /usr/src -xJ + fi + + cd /usr/src/linux-${VERSION} + + nice -19 make -j$JOBS KDEB_PKGVERSION=$PKGVERSION INSTALL_MOD_STRIP=1 deb-pkg +} + +install_kernel $@