Improved postinstall gen with templates