~dannf/+junk/make-highbank-ami

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/sh

set -e

srvdir="/srv/qemu-highbank"
orig_hostmac_f="$srvdir/origmac"
fake_hostmac_f="$srvdir/fakemac"

if [ ! -f $orig_hostmac_f ] || [ ! -f $fake_hostmac_f ]; then
    ip link show eth0 | grep link/ether | \
	sed -r 's/.* (..:..:..:..:..:..) .*/\1/' > $orig_hostmac_f
    python -c 'import virtinst.util ; print virtinst.util.randomMAC()' > \
	$fake_hostmac_f
fi

ip link set eth0 address "$(cat $fake_hostmac_f)"

exit 0