Skip to content

Instantly share code, notes, and snippets.

@mcemce
Last active March 12, 2018 00:27
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 mcemce/3febfa351d955b0bfb828e7aae8d00a5 to your computer and use it in GitHub Desktop.
Save mcemce/3febfa351d955b0bfb828e7aae8d00a5 to your computer and use it in GitHub Desktop.
Builds and loads kernel modules for Docker on Solus
#!/bin/bash
if [ $(whoami) != 'root' ]; then
echo "Must be root to run $0"
exit 1;
fi
echo "Assuming we're in root dir of Solus kernel source..."
git pull
KERNEL=`uname -r`
MOD_PATH="/lib/modules/$KERNEL/kernel"
# Reconfigure kernel and build modules
grep -q "^CONFIG_NETFILTER_XT_MATCH_IPVS=m$" ./files/config || echo "CONFIG_NETFILTER_XT_MATCH_IPVS=m" >> ./files/config
grep -q "^CONFIG_VXLAN=m$" ./files/config || echo "CONFIG_VXLAN=m" >> ./files/config
make
# Extract eopkg for needed modules
rm linux-current-headers-*.eopkg
unzip linux-current-*.eopkg -d tmp
rm *.eopkg
cd tmp
tar xf install.xz
rm install.xz
# Install modules
cp .$MOD_PATH/drivers/net/vxlan.ko $MOD_PATH/drivers/net/
cp .$MOD_PATH/net/netfilter/xt_ipvs.ko $MOD_PATH/net/netfilter/
depmod -a
# Load required modules
modprobe ip_vs
modprobe ip_vs_rr
modprobe iptable_nat
modprobe vxlan
modprobe xt_ipvs
# And persist on reboot
cat << 'EOF' > /etc/modules-load.d/docker-swarm.conf
ip_vs
ip_vs_rr
iptable_nat
vxlan
xt_ipvs
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment