From 7de06ae84405fb473964d23ff9d8c441f6f008e1 Mon Sep 17 00:00:00 2001 From: Enno Boland Date: Sat, 11 Apr 2015 11:04:39 +0200 Subject: [PATCH] common/chroot-style/proot.sh: return proper exitcode from child process --- common/chroot-style/proot.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/common/chroot-style/proot.sh b/common/chroot-style/proot.sh index ba4eae75771..f13a373c045 100755 --- a/common/chroot-style/proot.sh +++ b/common/chroot-style/proot.sh @@ -17,6 +17,14 @@ if [ -z "$MASTERDIR" -o -z "$DISTDIR" ]; then exit 1 fi -exec proot -r $MASTERDIR -w / -b $DISTDIR:/void-packages \ +# proot does not properly return the resultcode. Workaround this +RESULT=$(mktemp result.XXXXXXXXXX) + +proot -r $MASTERDIR -w / -b "$RESULT:/.result" -b $DISTDIR:/void-packages \ ${HOSTDIR:+-b $HOSTDIR:/host} -b /proc:/proc -b /dev:/dev \ - -b /sys:/sys $EXTRA_ARGS $@ + -b /sys:/sys $EXTRA_ARGS /bin/sh -c '$@; echo $? > /.result' $0 $@ + +rv=$(cat "$RESULT") +rm "$RESULT" + +exit $rv