- baseurl => IkiWiki::dirname($config{cgiurl})."/");
- close TEMPLATE;
- open(TEMPLATE, ">$estdir/$cgi.conf") ||
- error("write $estdir/$cgi.conf: $!");
+ baseurl => IkiWiki::dirname($config{cgiurl})."/") ||
+ error("write $newfile: $!", $cleanup);
+ close TEMPLATE || error("save $newfile: $!", $cleanup);
+ rename($newfile, "$estdir/$cgi.tmpl") ||
+ error("rename $newfile: $!", $cleanup);
+
+ $newfile="$estdir/$cgi.conf";
+ open(TEMPLATE, ">$newfile") || error("open $newfile: $!", $cleanup);