#!/bin/sh name=$1 [ -n "$name" ] || { echo "must give name"; exit 1; } set -ex lxc init ubuntu-daily:zesty $name lxc network attach lxdbr0 $name eth1 # pastebinit `which lxc-chroot` # http://paste.ubuntu.com/24198752/ # lxc-chroot has access to /var/lib/cloud/seed/nocloud-net/ # despite https://github.com/lxc/lxd/issues/3088 because it does # a 'start', which will get those things rendered. # the start just doesn't actually run an init. mode=${2:-bond} p=/var/lib/cloud/seed/nocloud-net/network-config set +x lxc-chroot "$name" sh -c ' #!/bin/sh fname="$1" mode="$2" scn="/sys/class/net/" read addr0 < $scn/eth0/address read addr1 < $scn/eth1/address if [ "$mode" = "bond" ]; then cat > "$fname" < "$fname" <