update kernel install script

Signed-off-by: Jessica Frazelle <princess@docker.com>
This commit is contained in:
Jessica Frazelle 2015-06-05 18:18:27 -07:00
parent 4dab198ac5
commit 1fd2824832
2 changed files with 26 additions and 14 deletions

View File

@ -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" ]

25
kernel-builder/install_kernel Executable file
View File

@ -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 $@