mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-07-15 12:24:09 +00:00
lxc-debian: Add hwaddr handling logic
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com> Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
This commit is contained in:
parent
09b15218a4
commit
aea1cd3cb7
@ -207,6 +207,13 @@ copy_configuration()
|
|||||||
hostname=$3
|
hostname=$3
|
||||||
arch=$4
|
arch=$4
|
||||||
|
|
||||||
|
# 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 || sed -i -e "/^lxc\.network\.type[ \t]*=[ \t]*veth/a lxc.network.hwaddr = 00:16:3e:$(openssl rand -hex 3| sed 's/\(..\)/\1:/g; s/.$//')" $path/config
|
||||||
|
fi
|
||||||
|
|
||||||
grep -q "^lxc.rootfs" $path/config 2>/dev/null || echo "lxc.rootfs = $rootfs" >> $path/config
|
grep -q "^lxc.rootfs" $path/config 2>/dev/null || echo "lxc.rootfs = $rootfs" >> $path/config
|
||||||
cat <<EOF >> $path/config
|
cat <<EOF >> $path/config
|
||||||
lxc.tty = 4
|
lxc.tty = 4
|
||||||
|
Loading…
Reference in New Issue
Block a user