[Emdebian-logs] [polystrap] 01/01: add proot support

Johannes Schauer josch-guest at moszumanska.debian.org
Fri Jan 10 22:45:54 UTC 2014


This is an automated email from the git hooks/post-receive script.

josch-guest pushed a commit to branch proot
in repository polystrap.

commit e7190f0276039e66c2710a9161c8a44d940927fd
Author: josch <j.schauer at email.de>
Date:   Fri Jan 10 18:17:59 2014 +0100

    add proot support
---
 polystrap.sh | 53 ++++++++++++++++++++++++++++-------------------------
 1 file changed, 28 insertions(+), 25 deletions(-)

diff --git a/polystrap.sh b/polystrap.sh
index 2f1f091..9c68724 100755
--- a/polystrap.sh
+++ b/polystrap.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 #
-# polystrap - create a foreign architecture rootfs using multistrap, fakeroot,
-#             fakechroot and qemu usermode emulation
+# polystrap - create a foreign architecture rootfs using multistrap, proot,
+#             and qemu usermode emulation
 #
 # Copyright (C) 2011 by Johannes 'josch' Schauer <j.schauer at email.de>
 #
@@ -27,14 +27,17 @@ usage() {
 	echo "Usage: $0: [-f] [-v] [-n] [-s suite] [-a arch] [-d directory] [-m mirror] [-p packages] platform\n" >&2
 }
 
+CHROOTQEMUCMD="proot -q qemu-arm -v -1 -0 -b /dev -b /sys -b /proc"
+CHROOTCMD="proot -v -1 -0"
+
 export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true LC_ALL=C LANGUAGE=C LANG=C
 export PATH=$PATH:/usr/sbin:/sbin
 
-if [ "$FAKEROOTKEY" = "" ]; then
-	echo "I: re-executing script inside fakeroot"
-	fakeroot "$0" "$@";
-	exit
-fi
+#if [ "$FAKEROOTKEY" = "" ]; then
+#	echo "I: re-executing script inside fakeroot"
+#	fakeroot "$0" "$@";
+#	exit
+#fi
 
 FORCE=""
 MSTRAP_SIM=
@@ -87,7 +90,7 @@ else
 fi
 
 export QEMU_LD_PREFIX="`readlink -m "$ROOTDIR"`"
-export FAKECHROOT_CMD_SUBST=/usr/bin/ldd=/usr/bin/ldd.fakechroot:/sbin/ldconfig=/bin/true
+#export FAKECHROOT_CMD_SUBST=/usr/bin/ldd=/usr/bin/ldd.fakechroot:/sbin/ldconfig=/bin/true
 
 echo "I: --------------------------"
 echo "I: suite:   $SUITE"
@@ -119,20 +122,20 @@ done < $BOARD/multistrap.conf
 
 # download and extract packages
 echo "I: run multistrap" >&2
-multistrap $MSTRAP_SIM -f "$MULTISTRAPCONF"
+proot -0 multistrap $MSTRAP_SIM -f "$MULTISTRAPCONF"
 [ -z "$MSTRAP_SIM" ] || exit 0
 
 rm -f "$MULTISTRAPCONF"
 
-# convert absolute symlinks for fakechroot
-for link in `find $ROOTDIR -type l`; do
-        target=`readlink $link`
-        if [ "${target%%/*}" = "" ]; then # target begins with slash
-		echo "I: convert symlink: ${link#$ROOTDIR} -> $target"
-		rm $link
-                ln -s ${ROOTDIR}$target $link
-        fi
-done
+## convert absolute symlinks for fakechroot
+#for link in `find $ROOTDIR -type l`; do
+#        target=`readlink $link`
+#        if [ "${target%%/*}" = "" ]; then # target begins with slash
+#		echo "I: convert symlink: ${link#$ROOTDIR} -> $target"
+#		rm $link
+#                ln -s ${ROOTDIR}$target $link
+#        fi
+#done
 
 # copy initial directory tree - dereference symlinks
 echo "I: copy initial directory root tree $BOARD/root/ to $ROOTDIR/"
@@ -144,7 +147,7 @@ fi
 echo "I: preseed debconf"
 if [ -r "$BOARD/debconfseed.txt" ]; then
 	cp "$BOARD/debconfseed.txt" $ROOTDIR/tmp/
-	fakechroot chroot $ROOTDIR debconf-set-selections /tmp/debconfseed.txt
+	$CHROOTQEMUCMD $ROOTDIR debconf-set-selections /tmp/debconfseed.txt
 	rm $ROOTDIR/tmp/debconfseed.txt
 fi
 
@@ -154,12 +157,12 @@ for script in $ROOTDIR/var/lib/dpkg/info/*.preinst; do
 	echo "I: run preinst script ${script##$ROOTDIR}"
 	DPKG_MAINTSCRIPT_NAME=preinst \
 	DPKG_MAINTSCRIPT_PACKAGE="`basename $script .preinst`" \
-	fakechroot chroot $ROOTDIR ${script##$ROOTDIR} install
+	$CHROOTQEMUCMD $ROOTDIR ${script##$ROOTDIR} install
 done
 
 # run dpkg --configure -a twice because of errors during the first run
 echo "I: configure packages"
-fakechroot chroot $ROOTDIR /usr/bin/dpkg --configure -a || fakechroot chroot $ROOTDIR /usr/bin/dpkg --configure -a
+$CHROOTQEMUCMD $ROOTDIR /usr/bin/dpkg --configure -a || $CHROOTCMD $ROOTDIR /usr/bin/dpkg --configure -a
 
 # source hooks
 if [ -r "$BOARD/hooks" ]; then
@@ -175,7 +178,7 @@ rm $ROOTDIR/usr/sbin/policy-rc.d
 
 # need to generate tar inside fakechroot so that absolute symlinks are correct
 # tar is clever enough to not try and put the archive inside itself
-TARBALL=$(basename $ROOTDIR).tar
-echo "I: create tarball $TARBALL"
-fakechroot chroot $ROOTDIR tar -cf $TARBALL -C / .
-mv $ROOTDIR/$TARBALL .
+#TARBALL=$(basename $ROOTDIR).tar
+#echo "I: create tarball $TARBALL"
+#$CHROOTCMD $ROOTDIR tar -cf $TARBALL -C / .
+#mv $ROOTDIR/$TARBALL .

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/emdebian/polystrap.git



More information about the Emdebian-logs mailing list