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

Bug#830869: [PATCH] debootstrap: excise all devices.tar.gz code



Since bug #571136 was fixed the --second-stage doesn't even use the
devices tarball so we can remove all its related cruft. The README has
been updated to show when real root access is required and give an
example of a foreign debootstrap which works with fakeroot.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 .gitignore  |  1 -
 Makefile    | 25 -------------------------
 README      | 18 ++++++++++++++----
 debootstrap |  3 ---
 functions   |  8 +-------
 5 files changed, 15 insertions(+), 40 deletions(-)

diff --git a/.gitignore b/.gitignore
index 8b3512f..8b13789 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1 @@
-devices.tar.gz
 
diff --git a/Makefile b/Makefile
index 1020cbc..55f229d 100644
--- a/Makefile
+++ b/Makefile
@@ -2,17 +2,9 @@
 VERSION := $(shell sed 's/.*(\(.*\)).*/\1/; q' debian/changelog)
 DATE := $(shell sed -n '/^ -- /{s/.*> \(.*\)/\1/p;q;}' debian/changelog)
 
-MAKEDEV ?= /sbin/MAKEDEV
-
-ifeq ($(shell uname),Linux)
-all: devices.tar.gz
-else
 all:
-endif
 
 clean:
-	rm -f devices.tar.gz
-	rm -rf dev
 
 DSDIR=$(DESTDIR)/usr/share/debootstrap
 install:
@@ -25,20 +17,3 @@ install:
 	sed 's/@VERSION@/$(VERSION)/g' debootstrap >$(DESTDIR)/usr/sbin/debootstrap
 	chown root:root $(DESTDIR)/usr/sbin/debootstrap
 	chmod 0755 $(DESTDIR)/usr/sbin/debootstrap
-
-ifeq ($(shell uname),Linux)
-	install -o root -g root -m 0644 devices.tar.gz $(DSDIR)/
-endif
-
-devices.tar.gz:
-	rm -rf dev
-	mkdir -p dev
-	chown 0:0 dev
-	chmod 755 dev
-	(cd dev && $(MAKEDEV) std ptmx fd consoleonly)
-	tar --mtime="$(DATE)" -cf - dev | gzip -9n >devices.tar.gz
-	@if [ "$$(tar tvf devices.tar.gz | wc -l)" -lt 2 ]; then \
-		echo " ** devices.tar.gz is empty!" >&2; \
-		exit 1; \
-	fi
-	rm -rf dev
diff --git a/README b/README
index 5c08e15..af30a75 100644
--- a/README
+++ b/README
@@ -18,11 +18,21 @@ First, get the source.
 * Or by visiting <http://packages.debian.org/source/sid/debootstrap>
   and downloading the tar.gz file
 
-Then as root, in the debootstrap source directory:
+Then in the debootstrap source directory:
 
-make devices.tar.gz
-export DEBOOTSTRAP_DIR=`pwd`
-debootstrap sid sid
+    export DEBOOTSTRAP_DIR=`pwd`
+    sudo ./debootstrap stable my-stable-dir
+
+If you are running a multi-stage boot strap (for example for a QEMU
+rootfs) you don't even need root:
+
+    export DEBOOTSTRAP_DIR=`pwd`
+    fakeroot ./debootstrap --foreign --arch=armhf testing my-testing-dir http://httpredir.debian.org/debian
+
+Of course you will need to execute the second stage as root to finish the bootstrap:
+
+   (on foreign hardware)
+   /debootstrap/debootstrap --second-stage
 
 
 Future
diff --git a/debootstrap b/debootstrap
index 2a959bb..4cea268 100755
--- a/debootstrap
+++ b/debootstrap
@@ -18,8 +18,6 @@ if [ -z "$DEBOOTSTRAP_DIR" ]; then
 	fi
 fi
 
-DEVICES_TARGZ=$DEBOOTSTRAP_DIR/devices.tar.gz
-
 . $DEBOOTSTRAP_DIR/functions
 exec 4>&1
 
@@ -635,7 +633,6 @@ if am_doing_phase first_stage; then
 	if ! am_doing_phase second_stage; then
 		cp "$0"				 "$TARGET/debootstrap/debootstrap"
 		cp $DEBOOTSTRAP_DIR/functions	 "$TARGET/debootstrap/functions"
-		cp $DEBOOTSTRAP_DIR/devices.tar.gz	 "$TARGET/debootstrap/devices.tar.gz"
 		cp $SCRIPT			 "$TARGET/debootstrap/suite-script"
 		echo "$ARCH"			>"$TARGET/debootstrap/arch"
 		echo "$SUITE"			>"$TARGET/debootstrap/suite"
diff --git a/functions b/functions
index 031721f..67701ee 100644
--- a/functions
+++ b/functions
@@ -1065,13 +1065,7 @@ setup_devices () {
 	    hurd*)
 		;;
 	    *)
-		if true; then
-			setup_devices_simple
-		elif [ -e "$DEVICES_TARGZ" ]; then
-			zcat "$DEVICES_TARGZ" | (cd "$TARGET"; tar -xf -)
-		else
-			error 1 NODEVTGZ "no %s. cannot create devices" "$DEVICES_TARGZ"
-		fi
+		setup_devices_simple
 		;;
 	esac
 }
-- 
2.9.3


Reply to: