Last active
July 9, 2016 22:52
-
-
Save elico/1c92fcee150ce3a02cb2c122588fda15 to your computer and use it in GitHub Desktop.
betolj/ndpi-netfilter opensuse docker build node
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e | |
declare -x PKG_CONFIG=`which pkg-config` | |
KERNEL_VERSION=`ls /lib/modules/` | |
cd /build | |
ls /build/ | |
mkdir /build/destdir | |
chmod 777 /build/destdir | |
rm -rf ./ndpi-netfilter | |
if [ -e "./master.tar" ]; then | |
tar xvf master.tar | |
# mv ndpi-netfilter-master ndpi-netfilter | |
else | |
git clone https://github.com/betolj/ndpi-netfilter | |
fi | |
cd ndpi-netfilter | |
tar xvf nDPI.tar.gz | |
cd nDPI | |
./autogen.sh | |
# The autogen should run configure automatically | |
#./configure | |
make | |
make install DESTDIR=/build/destdir | |
make install | |
ldconfig | |
cd .. | |
ls | |
sed -i -e 's/-DOPENDPI_NETFILTER_MODULE/$(shell pkg-config --cflags xtables)/g' ipt/Makefile && \ | |
sed -i -e 's@MODULES_DIR := /lib/modules/$(shell uname -r)@MODULES_DIR := /lib/modules/$(shell ls /lib/modules/)@g' src/Makefile && \ | |
sed -i -e 's/depmod -a/depmod -a $(shell ls \/lib\/modules\/)/g' src/Makefile && \ | |
NDPI_PATH=/build/ndpi-netfilter/nDPI make -j9 && \ | |
cat Makefile|grep install ; \ | |
#make install DESTDIR=/build/destdir && \ | |
make modules_install DESTDIR=/build/destdir && \ | |
#make install && \ | |
make modules_install &&\ | |
echo $? | |
mkdir -p /build/destdir/usr/local/lib && \ | |
mkdir -p /build/destdir/usr/lib64/xtables && \ | |
mkdir -p /build/destdir/lib/modules/$KERNEL_VERSION/extra/ && \ | |
cp /build/ndpi-netfilter/src/xt_ndpi.ko /build/destdir/lib/modules/$KERNEL_VERSION/extra/xt_ndpi.ko && \ | |
cp /build/ndpi-netfilter/src/xt_ndpi.ko /build/destdir/lib/modules/$KERNEL_VERSION/extra/xt_ndpi.ko-non-stripped && \ | |
cp /build/ndpi-netfilter/ipt/libxt_ndpi.so /build/destdir/usr/lib64/xtables/ | |
echo $? | |
strip --strip-debug /build/destdir/lib/modules/$KERNEL_VERSION/extra/xt_ndpi.ko | |
set +e | |
#modprobe xt_ndpi && lsmod|grep ndpi | |
#patch -p0 < /build/ipt-makefile.patch && \ | |
#patch -p0 < /build/src-makefile.patch && \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM opensuse:leap | |
RUN zypper --non-interactive ref \ | |
&& zypper --non-interactive install --type pattern devel_basis devel_C_C++ devel_kernel \ | |
&& zypper --non-interactive install libxtables-devel libnetfilter_conntrack-devel xtables-addons libjson-c-devel \ | |
&& zypper --non-interactive install kernel-default kernel-default-devel kmod \ | |
&& zypper --non-interactive install libpcap-devel git \ | |
&& zypper --non-interactive clean | |
RUN mkdir /build | |
VOLUME /build | |
CMD ["/build/build.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
docker build -t osuse:leap . | |
rm ./destdir -rf | |
docker run -i -t -v `pwd`:/build/ osuse:leap | |
cd destdir | |
tar cvfJ xt_ndpi.tar.xz ./* | |
tar tvf xt_ndpi.tar.xz | |
cd - |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment