Support setting variables inside chroot system via /etc/debootstrap/variables
authorMichael Prokop <mika@grml.org>
Thu, 12 Apr 2007 09:55:43 +0000 (11:55 +0200)
committerMichael Prokop <mika@grml.org>
Thu, 12 Apr 2007 09:55:43 +0000 (11:55 +0200)
chroot-script
config
grml-debootstrap

index b82526f..81fc132 100644 (file)
@@ -4,12 +4,13 @@
 # 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: Die Apr 10 11:48:13 CEST 2007 [mika]
+# Latest change: Don Apr 12 11:55:23 CEST 2007 [mika]
 ################################################################################
 
 set -e # exit on any error
 
-. /etc/debootstrap/config || exit 1
+. /etc/debootstrap/config    || exit 1
+. /etc/debootstrap/variables || exit 1
 
 [ -r /proc/1 ] || mount -t proc   none /proc
 
@@ -95,6 +96,15 @@ mkinitrd() {
 
 # install kernel packages {{{
 kernel() {
+  # do not override $KERNEL if set via config file
+  if [ -z "$KERNEL" ] ; then
+     if [ "$ARCH" = 'i386' ] ; then
+        KERNEL='2.6-686'
+     elif [ "$ARCH" = 'amd64' ] ; then
+        KERNEL='2.6-amd64'
+     fi
+  fi
+
   if [ -n "$KERNEL" ] ; then
      apt-get update
      if [ "$RELEASE" = 'sarge' ] ; then
diff --git a/config b/config
index e74a9bf..6bbc604 100644 (file)
--- a/config
+++ b/config
@@ -59,7 +59,7 @@ CHROOTMIRROR='ftp://ftp.debian.de/debian'
 # GRMLPACKAGES='grml-etc-core'
 
 # release (which Debian version should be installed)
-# supported values: sarge etch sid
+# supported values: sarge etch lenny sid
 RELEASE='etch'
 
 # architecture
@@ -74,7 +74,7 @@ HOSTNAME='grml'
 # kernel version which should be installed
 # do not forget to adjust according to architecture, for example
 # use 2.6-686 for i386 and 2.6-amd64 for amd64
-KERNEL='2.6-686'
+KERNEL='2.6-686'
 
 # name of debootstrap executable
 # supported values: debootstrap cdebootstrap
index 2939cf2..72098fb 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: Don Apr 12 11:44:54 CEST 2007 [mika]
+# Latest change: Don Apr 12 11:55:21 CEST 2007 [mika]
 ################################################################################
 # http://www.debian.org/releases/stable/i386/index.html.en
 
@@ -94,6 +94,11 @@ else
    ARCHINFO=" (${ARCH})"
 fi
 
+# provide variables to chroot system
+echo "
+ARCH=$ARCH
+" > /etc/debootstrap/variables
+
 # make sure at least $TARGET is set [the partition for the new system]
 if [ -z "$TARGET" ] ; then
    eerror "Please adjust /etc/debootstrap/config before running ${0}" ; eend 1
@@ -204,8 +209,9 @@ preparechroot() {
   mkdir $MNTPOINT/etc/debootstrap/
 
   # make sure we have our files for later use via chroot-script
-  cp /etc/debootstrap/config $MNTPOINT/etc/debootstrap/
-  cp /etc/debootstrap/packages $MNTPOINT/etc/debootstrap/packages
+  cp /etc/debootstrap/config    $MNTPOINT/etc/debootstrap/
+  cp /etc/debootstrap/packages  $MNTPOINT/etc/debootstrap/packages
+  cp /etc/debootstrap/variables $MNTPOINT/etc/debootstrap/variables
 
   # make sure we can access network [relevant for cdebootstrap]
   [ -f "$MNTPOINT/etc/resolv.conf" ] || cp /etc/resolv.conf $MNTPOINT/etc/resolv.conf