]> git.donarmstrong.com Git - dsa-puppet.git/blob - modules/ganeti2/templates/instance-debootstrap/hooks/00-dsa-configure-networking.erb
6878e13182d1bfb01249cf4d54fd04af11152d5c
[dsa-puppet.git] / modules / ganeti2 / templates / instance-debootstrap / hooks / 00-dsa-configure-networking.erb
1 #!/bin/bash
2
3 set -e
4
5 if [ -z "$TARGET" -o ! -d "$TARGET" ]; then
6   echo "Missing target directory"
7   exit 1
8 fi
9
10 if [ ! -d "$TARGET/etc/network" ]; then
11   echo "Missing target network directory"
12   exit 1
13 fi
14
15 if [ -z "$NIC_COUNT" ]; then
16   echo "Missing NIC COUNT"
17   exit 1
18 fi
19
20 rm -f $TARGET/etc/udev/rules.d/70-persistent-net.rules
21
22 if [ "$NIC_COUNT" -gt 0 ]; then
23
24   cat > $TARGET/etc/network/interfaces <<EOF
25 # /etc/network/interfaces
26
27 auto lo
28 iface lo inet loopback
29
30 auto eth0
31 iface eth0 inet static
32   address ${NIC_0_IP}
33   netmask 255.255.255.0
34   gateway 206.12.19.254
35
36 EOF
37
38 fi
39
40 cat > $TARGET/etc/resolv.conf <<EOF
41 # /etc/resolv.conf
42 search debprivate-ubc.debian.org debian.org
43 nameserver 206.12.19.20
44 nameserver 206.12.19.21
45 EOF
46
47 exit 0