Change the customization directory
[ext/instance-debootstrap.git] / examples / hooks / interfaces
1 #!/bin/bash
2
3 # Copyright (C) 2009 Google Inc.
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 # General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 # 02110-1301, USA.
19
20 # This is an example script that configures you /etc/network/interfaces after
21 # installation.  By default its sets up the system to use dhcp. To use it just
22 # put it in your CUSTOMIZE_DIR and make it executable.
23
24 if [ -z "$TARGET" -o ! -d "$TARGET" ]; then
25   echo "Missing target directory"
26   exit 1
27 fi
28
29 if [ ! -d "$TARGET/etc/network" ]; then
30   echo "Missing target network directory"
31   exit 1
32 fi
33
34 if [ -z "$NIC_COUNT" ]; then
35   echo "Missing NIC COUNT"
36   exit 1
37 fi
38
39 if [ "$NIC_COUNT" -gt 0 ]; then
40
41   cat > $TARGET/etc/network/interfaces <<EOF
42 # This file describes the network interfaces available on your system
43 # and how to activate them. For more information, see interfaces(5).
44
45 auto lo
46 iface lo inet loopback
47
48 auto eth0
49 iface eth0 inet dhcp
50
51 EOF
52
53 fi