#!/bin/bash

# lxc: linux Container library

# Authors:
# Serge Hallyn <serge.hallyn@ubuntu.com>
#
# This is a test script for the lxc-user-nic program

# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.

# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.

# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

set -e

s=`mktemp -d /tmp/lxctest-XXXXXX`
f="$s/in.conf"

cleanup() {
	lxc-destroy -n lxctestc || true
	rm -rf $s
}

trap cleanup EXIT

cat > $f << EOF
lxc.net.0.type = veth
lxc.net.0.hwaddr = 00:16:3e:xx:xx:xx
EOF
lxc-create -t busybox -f $f -n lxctestc
grep -q "xx:xx" /var/lib/lxc/lxctestc/config && { echo "hwaddr not expanded"; exit 1; }
echo "Success"
