Skip to content

Instantly share code, notes, and snippets.

@joshwget
Last active November 14, 2016 03:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshwget/0c014a773b68e73e977afd193c1bfcc7 to your computer and use it in GitHub Desktop.
Save joshwget/0c014a773b68e73e977afd193c1bfcc7 to your computer and use it in GitHub Desktop.

v0.7.1. Kernel Headers

There are two ways to include the service file. It can be hosted somewhere and then referenced via a cloud-config file.

#cloud-config
rancher:
  services_include:
    https://raw.githubusercontent.com/rancher/os-services/embedded-headers/k/kernel-headers.yml: true

The service can also be directly embedded in a cloud-config file.

#cloud-config
rancher:
  services:
    kernel-headers:
      image: rancher/os-headers:v0.7.1-embedded
      labels:
        io.rancher.os.detach: "false"
        io.rancher.os.after: network
      volumes:
      - /usr/src:/usr/src
      - /lib/modules:/lib/modules
      - /usr/bin/ros:/usr/bin/ros

The image for this service is available in rancher/os-headers:v0.7.1-embedded. It can also be built manually with the following two files.

FROM rancher/os-base:v0.7.1
ENV KERNEL_HEADERS_URL https://github.com/rancher/os-kernel/releases/download/Ubuntu-4.4.0-47.68-rancher1/build.tar.gz
RUN wget -O /build.tar.gz $KERNEL_HEADERS_URL
COPY headers.sh  /
CMD ["/headers.sh"]
#!/bin/bash
set -e

DIR=$(readlink /lib/modules/$(uname -r)/build)
STAMP=${DIR}/.done
VER=$(basename $DIR)

if [ -e $STAMP ]; then
    echo Headers already installed in $DIR
    exit 0
fi

mkdir -p $DIR
cat /build.tar.gz | gzip -dc | tar xf - -C $DIR
touch $STAMP

echo Headers installed at $DIR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment