aboutsummaryrefslogtreecommitdiffstats
path: root/resources/tools/disk-image-builder/nested/patches/03-network
diff options
context:
space:
mode:
authorCarsten Koester <ckoester@cisco.com>2016-05-25 05:58:29 -0400
committerDave Wallace <dwallacelf@gmail.com>2016-06-02 00:18:28 +0000
commit9d378548cc86028c55baf17260d32d0055603b78 (patch)
tree1cc67da7195459abcaca5f12f0f4b74bc399b60e /resources/tools/disk-image-builder/nested/patches/03-network
parent036f36181c177e4c77f22cdbdcb87fb2f94df3bf (diff)
CSIT-111: Add Packer based framework to auto-generate disk images
Change-Id: Ia18ea34a6288aec0f12f176f4cc264d0f215d1fd Signed-off-by: Carsten Koester <ckoester@cisco.com>
Diffstat (limited to 'resources/tools/disk-image-builder/nested/patches/03-network')
-rwxr-xr-xresources/tools/disk-image-builder/nested/patches/03-network37
1 files changed, 37 insertions, 0 deletions
diff --git a/resources/tools/disk-image-builder/nested/patches/03-network b/resources/tools/disk-image-builder/nested/patches/03-network
new file mode 100755
index 0000000000..ca5c4f952d
--- /dev/null
+++ b/resources/tools/disk-image-builder/nested/patches/03-network
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+patch boot/grub/menu.lst <<"_EOF"
+17c17
+< kernel /boot/bzImage rw root=/dev/sda1 console=ttyS0,115200n8
+---
+> kernel /boot/bzImage rw root=/dev/sda1 ipv6.disable=1 console=ttyS0,115200n8
+_EOF
+
+patch etc/network/interfaces <<"_EOF"
+4a5,7
+>
+> auto mgmt0
+> iface mgmt0 inet dhcp
+_EOF
+
+patch etc/init.d/S40network <<"_EOF"
+11a12,29
+>
+> # Rename interfaces. The e1000 interface is managment.
+> NUM_VIRTIO=0
+> NUM_MGMT=0
+> for dev in /sys/class/net/eth*
+> do
+> devname=`basename $dev`
+> driver=`readlink ${dev}/device/driver`
+> if test "${driver#*virtio}" != "$driver"
+> then
+> ip link set dev $devname name virtio${NUM_VIRTIO}
+> NUM_VIRTIO=$(($NUM_VIRTIO+1))
+> else
+> ip link set dev $devname name mgmt${NUM_MGMT}
+> NUM_MGMT=$((NUM_MGMT+1))
+> fi
+> done
+>
+_EOF