Fixes and improvements to generate templates

This patch set improves and fixes issues with the generate-template.sh script. Some are old now uneeded things (like related to svn) and some are easy improvements as don't hide errors by mistake. Nothing major, the main way to do things is the same, just the things around it are changed.

Comments welcome :)