source: branches/locker-dev/locker/deploy/bin/trac @ 2836

Last change on this file since 2836 was 2076, checked in by andersk, 13 years ago
Delete svn:mergeinfo from all active branches except at . and locker Now that our branches are all synchronized, I’m pretty sure it’s safe to delete these confusing extra svn:mergeinfo properties. In the future, please don’t do any merges that aren’t at one of the canonical roots.
  • Property svn:executable set to *
File size: 2.1 KB
Line 
1#!/usr/bin/perl
2use strict;
3use FindBin qw($Bin);
4use lib $Bin;
5use onserver;
6use Cwd;
7use File::Path;
8use URI::Escape;
9use DBI;
10use Config::IniFiles;
11
12setup();
13
14print "\nEnter the name of your project (the title of this Trac instance).\n";
15print "Project name: ";
16my $name=<STDIN>;
17chomp($name);
18
19my $dbh = DBI->connect("DBI:mysql:database=$sqldb;host=$sqlhost", $sqluser, $sqlpass, {RaiseError => 1});
20$dbh->do('alter database collate utf8_general_ci');
21
22my $dbstring = "mysql://" . uri_escape($sqluser) . ":" . uri_escape($sqlpass) . "\@$sqlhost/$sqldb";
23
24print "\nEnter the type of version-control repository this project uses.\n";
25print "You'll have to set up the repo yourself; feel free to ask scripts@ for help.\n";
26print "If you don't want version-control integration, take the default.\n";
27print "Repository type (default svn; also bzr, git, hg): ";
28my $repotype=<STDIN>;
29chomp($repotype);
30$repotype = $repotype ? $repotype : 'svn';
31
32print "\nEnter the path to the version-control repository.\n";
33print "If you don't want version-control integration, leave blank.\n";
34print "Path to repository: ";
35my $repopath=<STDIN>;
36chomp($repopath);
37
38print STDERR "running trac-admin:\n";
39system(qw(/usr/bin/trac-admin tracdata initenv),
40       $name, $dbstring, $repotype, $repopath);
41# XXX this exposes the SQL password on the command line
42
43#aka perl -pe 's/\@ADDREND\@/$addrend/g' <.htaccess.in >.htaccess
44open IN, '<.htaccess.in'; open OUT, '>.htaccess';
45while (<IN>) {
46    s/\@ADDREND\@/~$USER\/$addrend/g;
47    print OUT $_;
48}
49close IN; close OUT;
50
51my $cfg = Config::IniFiles->new(-file => 'tracdata/conf/trac.ini');
52$cfg->setval('trac', 'default_charset', 'utf-8');
53$cfg->AddSection('components');
54$cfg->newval('components', 'webadmin.*', 'enabled');
55$cfg->newval('components', 'tracext.git.*', 'enabled') if $repotype eq "git";
56$cfg->newval('components', 'tracext.hg.*', 'enabled') if $repotype eq "hg";
57$cfg->RewriteConfig();
58
59system(qw(/usr/bin/trac-admin tracdata permission add), $human, 'TRAC_ADMIN');
60
61chmod 0777, '.htaccess';
62unlink '.htaccess.in';
63
64open OUT, '>tracdata/.htaccess';
65print OUT "Deny from all\n";
66close OUT;
67chmod 0777, 'tracdata/.htaccess';
68
69exit 0;
Note: See TracBrowser for help on using the repository browser.