This is just what I needed! I made some changes (raspberrypi.org is now using SHA-256 checksums, and I use losetup to avoid all that calculation). This script is on GitHub at: https://github.com/sesamemucho/pi-sdcard-setup

Thanks again.