docker-init: static busybox, support for /etc/network/interfaces

This commit is contained in:
Bernhard Ehlers 2016-03-22 15:28:56 +00:00
parent 174e7cccea
commit d472f47829
2 changed files with 15 additions and 1 deletions

Binary file not shown.

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/gns3/bin/busybox sh
#
# Copyright (C) 2016 GNS3 Technologies Inc.
#
@ -19,6 +19,14 @@
# This script is injected into the container and launch before
# the start command of the container
#
OLD_PATH="$PATH"
PATH=/gns3/bin:/tmp/gns3/bin
# bootstrap busybox commands
if [ ! -d /tmp/gns3/bin ]; then
busybox mkdir -p /tmp/gns3/bin
/gns3/bin/busybox --install -s /tmp/gns3/bin
fi
# Wait 2 seconds to settle the network interfaces
sleep 2
@ -42,5 +50,11 @@ sed -n 's/^ *\(eth[0-9]*\):.*/\1/p' < /proc/net/dev | while read dev; do
ip link set dev $dev up
done
if [ -n "$INTERFACES" ]; then
echo -e "$INTERFACES" > /etc/network/interfaces
ifup -a
fi
# continue normal docker startup
PATH="$OLD_PATH"
exec "$@"