-DIST=$dist ARCH=$arch $PBUILDER --update --override-config
-DIST=$dist ARCH=$arch $PBUILDER --build $dsc
+if test -z "$DSC"; then
+ echo "id-pbuild-root.sh: missing --dsc"
+ exit 1
+fi
+if test ! -x /usr/bin/lxc-attach; then
+ echo "No lxc-attach. Probably not running on mochi!!"
+ exit 1
+fi
+export DIST ARCH # export for pbuilder to see
+echo "$DIST-$ARCH begin"
+if $update; then
+ if ! lxc-attach -n pbuilder -- pbuilder --update --override-config >update-${DIST}-${ARCH}.log 2>&1; then
+ if ! lxc-attach -n pbuilder -- pbuilder --create >create-${DIST}-${ARCH}.log 2>&1; then
+ echo "$DIST-$ARCH failed. Inspect deb-src/create-${DIST}-${ARCH}.log"
+ exit 2
+ fi
+ if ! lxc-attach -n pbuilder -- pbuilder --update --override-config >update-${DIST}-${ARCH}.log 2>&1; then
+ echo "$DIST-$ARCH failed. Inspect deb-src/update-${DIST}-${ARCH}.log"
+ exit 2
+ fi
+ fi
+fi
+if ! lxc-attach -n pbuilder -- pbuilder --build $DSC >build-${DIST}-${ARCH}.log 2>&1; then
+ echo "$DIST-$ARCH failed. Inspect deb-src/build-${DIST}-${ARCH}.log"
+ exit 3
+fi
+echo "$DIST-$ARCH done"
+exit 0