add more status output, delete -x flag

This commit is contained in:
josch 2011-06-29 11:03:43 +02:00
parent 7ee349b038
commit 86b130e41f

View file

@ -23,7 +23,7 @@
# FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
set -ex
set -e
usage() {
echo "Usage: $0: [-s suite] [-a arch] [-d directory] [-m mirror] [-p packages] platform\n" >&2
@ -33,7 +33,7 @@ export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true LC_ALL=C
export PATH=$PATH:/usr/sbin:/sbin
if [ "$FAKEROOTKEY" = "" ]; then
echo "re-executing script inside fakeroot" >&2
echo "I: re-executing script inside fakeroot" >&2
fakeroot "$0" "$@";
exit
fi
@ -82,18 +82,19 @@ fi
# binutils must always be installed for objdump for fake ldd
PACKAGES="$PACKAGES binutils"
echo "--------------------------" >&2
echo "suite: $SUITE" >&2
echo "arch: $ARCH" >&2
echo "rootdir: $ROOTDIR" >&2
echo "mirror: $MIRROR" >&2
echo "pkgs: $PACKAGES" >&2
echo "--------------------------" >&2
echo "I: --------------------------" >&2
echo "I: suite: $SUITE" >&2
echo "I: arch: $ARCH" >&2
echo "I: rootdir: $ROOTDIR" >&2
echo "I: mirror: $MIRROR" >&2
echo "I: pkgs: $PACKAGES" >&2
echo "I: --------------------------" >&2
[ -e "$ROOTDIR.tar" ] && { echo "tarball still exists" >&2; exit 1; }
[ -e "$ROOTDIR" ] && { echo "root directory still exists" >&2; exit 1; }
# create multistrap.conf
echo "I: create multistrap.conf" >&2
MULTISTRAPCONF=`tempfile -d . -p multistrap`
echo -n > "$MULTISTRAPCONF"
while read line; do
@ -101,32 +102,39 @@ while read line; do
done < $PLATFORM/multistrap.conf
# download and extract packages
echo "I: run multistrap" >&2
multistrap -f "$MULTISTRAPCONF"
rm -f "$MULTISTRAPCONF"
# backup ldconfig and ldd
echo "I: backup ldconfig and ldd" >&2
mv $ROOTDIR/sbin/ldconfig $ROOTDIR/sbin/ldconfig.REAL
mv $ROOTDIR/usr/bin/ldd $ROOTDIR/usr/bin/ldd.REAL
# copy initial directory tree - dereference symlinks
echo "I: copy initial directory root tree $PLATFORM/root/ to $ROOTDIR/" >&2
if [ -r "$PLATFORM/root" ]; then
cp --recursive --dereference $PLATFORM/root/* $ROOTDIR/
fi
# copy qemu usermode binary
QEMUARCH=
if [ $ARCH != "`dpkg --print-architecture`" ]; then
case $ARCH in
alpha|arm|armeb|i386|m68k|mips|mipsel|ppc64|sh4|sh4eb|sparc|sparc64)
cp `which qemu-$ARCH-static` $ROOTDIR/usr/bin;;
amd64) cp `which qemu-x86_64-static` $ROOTDIR/usr/bin;;
armel) cp `which qemu-arm-static` $ROOTDIR/usr/bin;;
lpia) cp `which qemu-i386-static` $ROOTDIR/usr/bin;;
powerpc) cp `which qemu-ppc-static` $ROOTDIR/usr/bin;;
alpha|i386|m68k|mips|mipsel|ppc64|sh4|sh4eb|sparc|sparc64)
QEMUARCH=$ARCH;;
arm*) QEMUARCH=arm;; # for arm, armel, armeb, armhf
amd64) QEMUARCH=x86_64;;
lpia) QEMUARCH=i386;;
powerpc) QEMUARCH=ppc;;
*) echo "unknown architecture: $ARCH" >&2; exit 1;;
esac
fi
echo "I: copy qemu-$QEMUARCH-static into $ROOTDIR" >&2
cp `which qemu-$QEMUARCH-static` $ROOTDIR/usr/bin
# preseed debconf
echo "I: preseed debconf" >&2
if [ -r "$PLATFORM/debconfseed.txt" ]; then
cp "$PLATFORM/debconfseed.txt" $ROOTDIR/tmp/
fakechroot chroot $ROOTDIR debconf-set-selections /tmp/debconfseed.txt
@ -136,20 +144,24 @@ fi
# run preinst scripts
for script in $ROOTDIR/var/lib/dpkg/info/*.preinst; do
[ "$script" = "$ROOTDIR/var/lib/dpkg/info/bash.preinst" ] && continue
echo "I: run preinst script ${script##$ROOTDIR}" >&2
fakechroot chroot $ROOTDIR ${script##$ROOTDIR} install
done
# run dpkg --configure -a twice because of errors during the first run
echo "I: configure packages" >&2
fakechroot chroot $ROOTDIR /usr/bin/dpkg --configure -a || fakechroot chroot $ROOTDIR /usr/bin/dpkg --configure -a
# source hooks
if [ -r "$PLATFORM/hooks" ]; then
for f in $PLATFORM/hooks/*; do
echo "I: run hook $f" >&2
. $f
done
fi
#cleanup
echo "I: cleanup" >&2
rm $ROOTDIR/sbin/ldconfig $ROOTDIR/usr/bin/ldd
mv $ROOTDIR/sbin/ldconfig.REAL $ROOTDIR/sbin/ldconfig
mv $ROOTDIR/usr/bin/ldd.REAL $ROOTDIR/usr/bin/ldd
@ -157,5 +169,6 @@ 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
echo "I: create tarball $ROOTDIR.tar" >&2
fakechroot chroot $ROOTDIR tar -cf $ROOTDIR.tar -C / .
mv $ROOTDIR/$ROOTDIR.tar .