The attached patch, based on Alberto's patch, allows to specify a
custom debootstrap, thus not limiting support to qemu-debootstrap
only, but extending to other debootstrap variants (e.g. cdebootstrap).

Cheers,
Luca
diff --git a/bin/sbuild-createchroot b/bin/sbuild-createchroot
index 1026a77..8657830 100755
--- a/bin/sbuild-createchroot
+++ b/bin/sbuild-createchroot
@@ -57,6 +57,9 @@ sub setup {
 	'KEEP_DEBOOTSTRAP_DIR'			=> {
 	    DEFAULT => 0
 	},
+	'DEBOOTSTRAP'				=> {
+	    DEFAULT => 'debootstrap'
+	},
 	'KEYRING'				=> {
 	    DEFAULT => undef
 	},
@@ -110,6 +113,9 @@ sub set_options {
 	"keep-debootstrap-dir" => sub {
 	    $self->set_conf('KEEP_DEBOOTSTRAP_DIR', 1)
 	},
+	"debootstrap=s" => sub {
+	    $self->set_conf('DEBOOTSTRAP', $_[1])
+	},
 	"exclude=s" => sub {
 	    $self->set_conf('EXCLUDE', $_[1]);
 	},
@@ -198,13 +204,20 @@ push @args, $conf->get('RESOLVE_DEPS') ?
 push @args, "$suite", "$target", "$mirror";
 push @args, "$script" if $script;
 
+# Set the path to debootstrap
+my $debootstrap = $conf->get('DEBOOTSTRAP');
+
+# Get the name of the debootstrap binary
+my $debootstrap_bin = $debootstrap;
+$debootstrap_bin =~ s/^.*\///s;
+
 if ($conf->get('VERBOSE')) {
-    print "I: Running debootstrap " . join(' ',@args) . "\n";
+    print "I: Running $debootstrap_bin " . join(' ',@args) . "\n";
 }
 
 # Run debootstrap with specified options.
 if (!$conf->get('SETUP_ONLY')) {
-    !system("/usr/sbin/debootstrap", @args) or die "E: Error running debootstrap";
+    !system($debootstrap, @args) or die "E: Error running $debootstrap_bin";
 }
 
 # Set up minimal /etc/hosts.
diff --git a/man/sbuild-createchroot.8.in b/man/sbuild-createchroot.8.in
index 45de4e8..e0d120d 100644
--- a/man/sbuild-createchroot.8.in
+++ b/man/sbuild-createchroot.8.in
@@ -26,6 +26,7 @@ sbuild\-createchroot \- create sbuild chroot
 .RB [ \-\-foreign ]
 .RB [ \-\-resolve-deps " \[or] " \-\-no-resolve-deps ]
 .RB [ \-\-keep-debootstrap-dir ]
+.RB [ \-\-debootstrap=\fIdebootstrap\fP ]
 .RB [ "\-\-include=\fIpackage1[,package2,[packagen]]\fP" ]
 .RB [ "\-\-exclude=\fIpackage1[,package2,[packagen]]\fP" ]
 .RB [ "\-\-components=\fIcomponent1[,component2,[componentn]]\fP" ]
@@ -109,6 +110,9 @@ Do not automatically resolve missing dependencies.
 Don't delete the \fI/debootstrap\fP directory in \fITARGET-DIRECTORY\fP after
 completing the installation.
 .TP
+.BR \-\-debootstrap=\fIdebootstrap\fP
+Define a custom debootstrap variant. Defaults to 'debootstrap'.
+.TP
 .BR "\-\-include=\fIpackage1[,package2,[packagen]]\fP"
 Comma separated list of packages which will be added to the list of packages to
 download and extract.

Reply via email to