X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=win32%2Fconfig_sh.PL;h=0c3713cb2ee2d93819acf5e4b7c93ddc130a701d;hb=16bdeea22f8cedc459c05644ea5e42bd8370b42c;hp=020485d66a62eb5ff36d770a80b26eb1ba3b6730;hpb=c90c0ff485be15aaf3ee20121299cb014ee6b1ff;p=p5sagit%2Fp5-mst-13.2.git diff --git a/win32/config_sh.PL b/win32/config_sh.PL index 020485d..0c3713c 100644 --- a/win32/config_sh.PL +++ b/win32/config_sh.PL @@ -10,10 +10,22 @@ if ($] =~ /\.(\d\d\d)?(\d\d)?$/) { # should always be true $opt{SUBVERSION} = $2 || '00'; } +$opt{'cf_by'} = $ENV{USERNAME} unless $opt{'cf_by'}; +$opt{'cf_email'} = $opt{'cf_by'} . '@' . (gethostbyname('localhost'))[0] + unless $opt{'cf_email'}; + while (<>) { s/~([\w_]+)~/$opt{$1}/g; - $_ = "$1='$opt{$1}'\n" if (/^([\w_]+)=/ && exists($opt{$1})); + if (/^([\w_]+)=(.*)$/) { + # this depends on cf_time being empty in the template (or we'll get a loop) + if ($1 eq 'cf_time') { + $_ = "$1='" . localtime(time) . "'\n" if $2 =~ /^\s*'\s*'/; + } + elsif (exists $opt{$1}) { + $_ = "$1='$opt{$1}'\n"; + } + } print; }