[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#445157: debootstrap - hardcoded value of TARGET in second-stage prevents creation of a foreign chroot



On Wed, 03 Oct 2007 14:41:10 -0300
Otavio Salvador <otavio@debian.org> wrote:

> Neil Williams <codehelp@debian.org> writes:
> 
> > Is there a cleaner way of achieving the same result, maybe debootstrap
> > could support / as a default and allow an override on the command line?
> 
> Hello Neil,
> 
> Yes, I think that a command line option might be the best way to
> handle that.
> 
> Can you prepare a patch for it?

I wasn't sure what name to use for the command line option and I'm not
sure about how the patch results in:
--chroot-dir /home/test/ --second-stage
being an error when
--second-stage --chroot-dir /home/test/
is not.

YMMV.

All that matters for my purposes is that $TARGET can be overridden
when calling second stage whilst retaining the default for others.

-- 


Neil Williams
=============
http://www.data-freedom.org/
http://www.nosoftwarepatents.com/
http://www.linux.codehelp.co.uk/

--- debootstrap-0.3.3.2/debootstrap	2005-11-05 18:11:30.000000000 +0000
+++ debootstrap-new/debootstrap	2007-10-03 21:32:41.000000000 +0100
@@ -85,6 +85,9 @@
       --unpack-tarball T     acquire .debs from a tarball instead of http
       --make-tarball T       download .debs and create a tarball (tgz format)
 
+      --chroot-dir DIR       Run second stage in a subdirectory instead of root
+                               (can be used to create a foreign chroot)
+                               (requires --second-stage)
       --boot-floppies        used for internal purposes by boot-floppies
       --debian-installer     used for internal purposes by debian-installer
 EOF
@@ -135,6 +138,18 @@
         SECOND_STAGE_ONLY=true
 	shift
 	;;
+	  --chroot-dir)
+	    if [ "$SECOND_STAGE_ONLY" = "true" ] ; then
+          if [ -n "$2" ] ; then
+            CHROOTDIR="$2"
+            shift 2
+          else
+            error 1 NEEDARG "option requires an argument: %s" "$1"
+          fi
+        else
+            error 1 NEEDARG "%s only applies in the second stage" "$1"
+        fi
+      ;;
       --print-debs)
         WHAT_TO_DO="finddebs printdebs kill_target"
         shift
@@ -235,7 +250,11 @@
     VARIANT=$(cat $DEBOOTSTRAP_DIR/variant)
     SUPPORTED_VARIANTS="$VARIANT"
   fi
-  TARGET=/
+  if [ "$CHROOTDIR" = "" ]; then
+    TARGET=/
+  else
+    TARGET=$CHROOTDIR
+  fi
   MIRRORS=null:
   SCRIPT=$DEBOOTSTRAP_DIR/suite-script
 else

Attachment: pgpdNHVqMjJNX.pgp
Description: PGP signature


Reply to: