Set debian boxes network hwaddr

Required by failback mechanism used to fetch container ip based on dnsmasq leases
This commit is contained in:
Fabio Rehm 2013-05-07 01:53:52 -03:00
parent 70f7aeb66a
commit 80d77828d8

View file

@ -152,6 +152,15 @@ copy_configuration()
rootfs=$2
name=$3
# if there is exactly one veth network entry, make sure it has an
# associated hwaddr.
nics=`grep -e '^lxc\.network\.type[ \t]*=[ \t]*veth' $path/config | wc -l`
if [ $nics -eq 1 ]; then
grep -q "^lxc.network.hwaddr" $path/config || cat <<EOF >> $path/config
lxc.network.hwaddr = 00:16:3e:$(openssl rand -hex 3| sed 's/\(..\)/\1:/g; s/.$//')
EOF
fi
grep -q "^lxc.rootfs" $path/config 2>/dev/null || echo "lxc.rootfs = $rootfs" >> $path/config
cat <<EOF >> $path/config
lxc.tty = 4