distmaker cleanup

1. Reduce massive code duplication so that we mortals can understand
2. Allow running individual *.sh build scripts without switching branches