script simplification, including OS X compatibility

- reduce reliance on `sudo`
- Makefile improvements (modularity, reduction of repeated downloads)
- switch to postgis extensions instead of templates
- `sed` simplification/speedup