mozilla-b2g/B2G — pull request #11 by davidflanagan (2012-05-17 05:40:56+00:00)
Title: proposed fix for issue #8

Here's my attempt to fix issue #8, where an incomplete download caused a corrupt build.
All this does is download the tarball with a temporary name, and then rename it only if curl completes cleanly.

I don't know enough shell programming to be sure that it is bulletproof, but it seems to fix the issue I was having.