From dd34099e06428496375f5d402265f94861c729f5 Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Thu, 1 Jan 2015 00:54:23 +0000 Subject: [PATCH] machinery to build ethtool and conntrack --- tools/Dockerfile | 3 +++ tools/build.sh | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 tools/Dockerfile create mode 100644 tools/build.sh diff --git a/tools/Dockerfile b/tools/Dockerfile new file mode 100644 index 00000000..f244fee7 --- /dev/null +++ b/tools/Dockerfile @@ -0,0 +1,3 @@ +FROM scratch +MAINTAINER Weaveworks Inc +ADD ./bin /bin diff --git a/tools/build.sh b/tools/build.sh new file mode 100644 index 00000000..e4f66961 --- /dev/null +++ b/tools/build.sh @@ -0,0 +1,40 @@ +#!/bin/sh +set -e + +apt-get -y update +apt-get -y install curl make pkg-config gcc bison flex + +BASEDIR=$(dirname $0) +mkdir -p "$BASEDIR"/bin + +# ethtool + +ETHTOOL=ethtool-3.16 + +rm -rf $ETHTOOL + +curl -s -S https://www.kernel.org/pub/software/network/ethtool/$ETHTOOL.tar.gz | tar xvz +(cd $ETHTOOL; ./configure LDFLAGS=-static; make) +cp $ETHTOOL/ethtool "$BASEDIR"/bin/ + +# conntrack + +PACKAGES="libmnl-1.0.3 libnfnetlink-1.0.1 libnetfilter_cttimeout-1.0.0 libnetfilter_cthelper-1.0.0 libnetfilter_queue-1.0.2 libnetfilter_conntrack-1.0.4" +CONNTRACK=conntrack-tools-1.4.2 + +rm -rf $PACKAGES $CONNTRACK + +fetch() { + curl -s -S http://www.netfilter.org/projects/${1%-*}/files/$1.tar.bz2 | tar xj +} + +for PACKAGE in $PACKAGES; do + fetch $PACKAGE + (cd $PACKAGE; ./configure && make LDFLAGS=-static install) +done + +fetch $CONNTRACK +(cd $CONNTRACK; ./configure && make LDFLAGS=-static && rm -f src/conntrack && make LDFLAGS=-all-static) +cp $CONNTRACK/src/conntrack "$BASEDIR"/bin/ + +touch "$BASEDIR"/bin