Package: debootstrap
Version: 0.3.3
Severity: normal
Tags: patch

Find attached a patch that implements support for single-stage
cross-installation using qemu user mode emulation in the chroot stage.
It depends on a modified qemu package (see
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=306637) in order to
work.

See http://wiki.debian.org/EmDebian/CrossDebootstrap for basic
instructions on how to use this feature.

Changelog:

  * Add support for one-stage cross-strapping using qemu user mode emulation.
diff -Nru debootstrap-0.3.3/debian/changelog debootstrap-0.3.3.1/debian/changelog
--- debootstrap-0.3.3/debian/changelog	2005-11-05 14:32:03.000000000 -0400
+++ debootstrap-0.3.3.1/debian/changelog	2006-03-07 17:22:56.000000000 -0400
@@ -1,3 +1,10 @@
+debootstrap (0.3.3.1) unstable; urgency=low
+
+  * Non-maintainer upload
+  * Add support for one-stage cross-strapping using qemu user mode emulation.
+
+ -- Anderson Lizardo <[EMAIL PROTECTED]>  Tue,  7 Mar 2006 17:22:22 -0400
+
 debootstrap (0.3.3) unstable; urgency=low
 
   * Include kFreeBSD and fakechroot support from 0.3.2.1 and 0.3.2.2 NMUs,
diff -Nru debootstrap-0.3.3/debian/control debootstrap-0.3.3.1/debian/control
--- debootstrap-0.3.3/debian/control	2005-10-23 03:26:22.000000000 -0400
+++ debootstrap-0.3.3.1/debian/control	2006-02-28 01:00:27.000000000 -0400
@@ -9,6 +9,7 @@
 Priority: extra
 Architecture: all
 Depends: wget, binutils
+Suggests: qemu, qemu-user-static
 Description: Bootstrap a basic Debian system
  debootstrap is used to create a Debian base system from scratch,
  without requiring the availability of dpkg or apt. It does this by
diff -Nru debootstrap-0.3.3/debootstrap debootstrap-0.3.3.1/debootstrap
--- debootstrap-0.3.3/debootstrap	2005-11-05 14:11:30.000000000 -0400
+++ debootstrap-0.3.3.1/debootstrap	2006-02-28 00:02:33.000000000 -0400
@@ -270,11 +270,16 @@
 
 ###########################################################################
 
+HOST_ARCH=""
+if [ -x /usr/bin/dpkg ] && /usr/bin/dpkg --print-installation-architecture >/dev/null 2>&1
+then
+  HOST_ARCH=`/usr/bin/dpkg --print-installation-architecture`
+fi
+
 if [ "$ARCH" != "" ]; then
   true
-elif [ -x /usr/bin/dpkg ] && /usr/bin/dpkg --print-installation-architecture >/dev/null 2>&1
-then
-  ARCH=`/usr/bin/dpkg --print-installation-architecture`
+elif [ "$HOST_ARCH" ]; then
+  ARCH=$HOST_ARCH
 elif [ -e $DEBOOTSTRAP_DIR/arch ]; then
   ARCH=`cat $DEBOOTSTRAP_DIR/arch`
 else
@@ -423,6 +428,15 @@
   # finished
   first_stage_install
 
+  if [ "$HOST_ARCH" -a "$HOST_ARCH" != "$ARCH" ]; then
+    # we are cross-strapping, so copy the relevant qemu user emulator to
+    # $TARGET
+    if [ -x "/usr/bin/qemu-$ARCH-static" ]; then
+      cp /usr/bin/qemu-$ARCH-static $TARGET/usr/bin/qemu-$ARCH
+      chmod 755 $TARGET/usr/bin/qemu-$ARCH
+    fi
+  fi
+
   if ! am_doing_phase second_stage; then
     cp "$0"                        $TARGET/debootstrap/debootstrap
     cp $DEBOOTSTRAP_DIR/functions  $TARGET/debootstrap/functions
@@ -478,6 +492,10 @@
   fi
 fi
 
+if [ "$HOST_ARCH" -a "$HOST_ARCH" != "$ARCH" ]; then
+  rm -f $TARGET/usr/bin/qemu-$ARCH
+fi
+
 if am_doing_phase kill_target; then
   if [ "$KEEP_DEBOOTSTRAP_DIR" != true ]; then
     info KILLTARGET "Deleting target directory"

Reply via email to