5 use File::Copy qw( copy );
6 use File::Path qw( make_path );
7 use File::Find qw( find );
8 use File::Basename qw( dirname );
13 my $source = File::Spec->rel2abs('.');
14 my $destination = $ARGV[0];
15 my $marc_type = $ARGV[1] || 'marc21';
16 my $indexing_mode = $ARGV[2] || 'dom';
18 $ENV{__ZEBRA_MARC_FORMAT__} = $marc_type;
19 $ENV{__ZEBRA_BIB_CFG__} = 'zebra-biblios-dom.cfg';
20 $ENV{__BIB_RETRIEVAL_CFG__} = 'retrieval-info-bib-dom.xml';
21 $ENV{__ZEBRA_AUTH_CFG__} = 'zebra-authorities-dom.cfg';
22 $ENV{__AUTH_RETRIEVAL_CFG__} = 'retrieval-info-auth-dom.xml';
24 make_path("$destination/var/lock/zebradb");
25 make_path("$destination/var/lock/zebradb/biblios");
26 make_path("$destination/var/lock/zebradb/authorities");
27 make_path("$destination/var/lock/zebradb/rebuild");
28 make_path("$destination/var/lib/zebradb");
29 make_path("$destination/var/lib/zebradb/biblios");
30 make_path("$destination/var/lib/zebradb/biblios/key");
31 make_path("$destination/var/lib/zebradb/biblios/register");
32 make_path("$destination/var/lib/zebradb/biblios/shadow");
33 make_path("$destination/var/lib/zebradb/biblios/tmp");
34 make_path("$destination/var/lib/zebradb/authorities");
35 make_path("$destination/var/lib/zebradb/authorities/key");
36 make_path("$destination/var/lib/zebradb/authorities/register");
37 make_path("$destination/var/lib/zebradb/authorities/shadow");
38 make_path("$destination/var/lib/zebradb/authorities/tmp");
39 make_path("$destination/var/log/koha");
40 make_path("$destination/var/run/zebradb");
42 $ENV{'INSTALL_BASE'} = $destination;
43 $ENV{'__INSTALL_BASE__'} = $destination;
45 $ENV{'__DB_TYPE__'} = C4::Context->config('db_scheme') // 'mysql';
46 $ENV{'__DB_NAME__'} = C4::Context->config('database') // 'koha';
47 $ENV{'__DB_HOST__'} = C4::Context->config('hostname') // 'localhost';
48 $ENV{'__DB_PORT__'} = C4::Context->config('port') // '3306';
49 $ENV{'__DB_USER__'} = C4::Context->config('user') // 'kohaadmin';
50 $ENV{'__DB_PASS__'} = C4::Context->config('pass') // 'katikoan';
52 $ENV{'__LOG_DIR__'} = "$destination/var/log/koha";
55 "$source/etc/koha-conf.xml",
56 "$source/etc/log4perl.conf",
59 find(sub { push @files, $File::Find::name if ( -f $File::Find::name ); }, "$source/etc/zebradb");
61 foreach my $file (@files) {
63 $target =~ s#$source#$destination#;
64 $target =~ s#etc/zebradb#etc/koha/zebradb#;
65 $target =~ s#etc/log4perl\.conf#etc/koha/log4perl.conf#;
67 make_path(dirname($target));
68 copy("$file", "$target");
69 system("perl $source/rewrite-config.PL $target");
70 if ($file =~ m/xml/) {
71 replace("$target", "$destination/intranet/templates", "$source/koha-tmpl/intranet-tmpl");
77 my ($file, $pattern, $replacement) = @_;
78 system("sed -i -e 's#$pattern#$replacement#' $file");