this looks like it's based off an older version of generate_scripts - you should have a look at the recent changes in that file