Rewrote interfaces() code for handling of /etc/network/interfaces.
[grml-debootstrap.git] / chroot-script
index 756d6a5..9e1437f 100644 (file)
@@ -4,7 +4,7 @@
 # Authors:       grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
 # Bug-Reports:   see http://grml.org/bugs/
 # License:       This file is licensed under the GPL v2.
-# Latest change: Mon Apr 23 00:30:43 CEST 2007 [mika]
+# Latest change: Mon Apr 23 12:02:03 CEST 2007 [mika]
 ################################################################################
 
 set -e # exit on any error
@@ -66,9 +66,25 @@ grmlrepos() {
 
 EOF
      # make sure we have the keys available for aptitude
-     gpg --keyserver subkeys.pgp.net --recv-keys F61E2E7CECDEA787 && \
+     gpg --keyserver subkeys.pgp.net --recv-keys F61E2E7CECDEA787
      gpg --export F61E2E7CECDEA787 | apt-key add - || /bin/true # not yet sure
      # why it's necessary, sometimes we get an error even though it works [mika]
+
+     # make sure we install packages from grml's pool only if not available
+     # from Debian!
+     if ! grep -q grml /etc/apt/preferences 2>/dev/null ; then
+        cat >> /etc/apt/preferences << EOF
+// debian pool (default):
+Package: *
+Pin: release o=Debian
+Pin-Priority: 996
+
+// main grml-repository:
+Package: *
+Pin: origin deb.grml.org
+Pin-Priority: 991
+EOF
+     fi
   fi
 }
 # }}}
@@ -254,13 +270,20 @@ hosts() {
 
 # set up /etc/network/interfaces {{{
 interfaces() {
-  if ! [ -f /etc/network/interfaces ] ; then
+  touch /etc/network/interfaces
+  # make sure we add the entries only once
+  if ! grep -q eth0 /etc/network/interfaces ; then
      echo "Setting up /etc/network/interfaces"
      cat >> /etc/network/interfaces << EOF
+
+# loopback device:
 iface lo inet loopback
-iface eth0 inet dhcp
 auto lo
-auto eth0
+
+# eth0:
+# iface eth0 inet dhcp
+# auto eth0
+
 EOF
   fi
 }