Add example instance-debootstrap.d file
authorGuido Trotter <ultrotter@google.com>
Fri, 13 Feb 2009 11:18:47 +0000 (11:18 +0000)
committerGuido Trotter <ultrotter@google.com>
Fri, 13 Feb 2009 11:18:47 +0000 (11:18 +0000)
This configures the eth0 interface for dhcp.

Reviewed-by: iustinp

example/instance-debootstrap.d/interfaces [new file with mode: 0644]

diff --git a/example/instance-debootstrap.d/interfaces b/example/instance-debootstrap.d/interfaces
new file mode 100644 (file)
index 0000000..455c396
--- /dev/null
@@ -0,0 +1,53 @@
+#!/bin/bash
+
+# Copyright (C) 2009 Google Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+# This is an example script that configures you /etc/network/interfaces after
+# installation.  By default its sets up the system to use dhcp. To use it just
+# put it in your CUSTOMIZE_DIR and make it executable.
+
+if [ -z "$TARGET" -o ! -d "$TARGET" ]; then
+  echo "Missing target directory"
+  exit 1
+fi
+
+if [ ! -d "$TARGET/etc/network" ]; then
+  echo "Missing target network directory"
+  exit 1
+fi
+
+if [ -z "$NIC_COUNT" ]; then
+  echo "Missing NIC COUNT"
+  exit 1
+fi
+
+if [ "$NIC_COUNT" -gt 0 ]; then
+
+  cat > $TARGET/etc/network/interfaces <<EOF
+# This file describes the network interfaces available on your system
+# and how to activate them. For more information, see interfaces(5).
+
+auto lo
+iface lo inet loopback
+
+auto eth0
+iface eth0 inet dhcp
+
+EOF
+
+fi