sudo make install
=head2 UPGRADE INSTALLATION
+
+ NOTE: This option is only available if koha-install-log exists.
perl Makefile.PL --prev-install-log /path/to/koha-install-log
- -OR-
- perl Makefile.PL # if no koha-install-log available
make
make test
=item SCRIPT_DIR
-Directory for command-line scripts and daemons.
+Directory for command-line scripts and daemons to
+be set up all for installation modes.
+
+=item SCRIPT_NONDEV_DIR
+
+Directory for command-line scripts that should
+be installed in the same directory as the
+SCRIPT_DIR target except 'dev' installs.
=item MAN_DIR
'./changelanguage.pl' => 'INTRANET_CGI_DIR',
'./check_sysprefs.pl' => 'NONE',
'./circ' => 'INTRANET_CGI_DIR',
+ './offline_circ' => 'INTRANET_CGI_DIR',
'./edithelp.pl' => 'INTRANET_CGI_DIR',
'./etc' => { target => 'KOHA_CONF_DIR', trimdir => -1 },
'./etc/zebradb' => { target => 'ZEBRA_CONF_DIR', trimdir => -1 },
'./help.pl' => 'INTRANET_CGI_DIR',
'./installer-CPAN.pl' => 'NONE',
'./installer' => 'INTRANET_CGI_DIR',
- './koha-tmpl/errors' => {target => 'INTRANET_CGI_DIR', trimdir => 2},
+ './errors' => {target => 'INTRANET_CGI_DIR'},
'./koha-tmpl/intranet-tmpl' => {target => 'INTRANET_TMPL_DIR', trimdir => -1},
'./koha-tmpl/opac-tmpl' => {target => 'OPAC_TMPL_DIR', trimdir => -1},
'./kohaversion.pl' => 'INTRANET_CGI_DIR',
'./Makefile.PL' => 'NONE',
'./MANIFEST.SKIP' => 'NONE',
'./members' => 'INTRANET_CGI_DIR',
- './misc' => { target => 'SCRIPT_DIR', trimdir => -1 },
+ './misc' => { target => 'SCRIPT_NONDEV_DIR', trimdir => -1 },
'./misc/bin' => { target => 'SCRIPT_DIR', trimdir => -1 },
'./misc/release_notes' => { target => 'DOC_DIR', trimdir => 2 },
'./misc/translator' => { target => 'MISC_DIR', trimdir => 2 },
'./reviews' => 'INTRANET_CGI_DIR',
'./rewrite-config.PL' => 'NONE',
'./reviews' => 'INTRANET_CGI_DIR',
- './rss' => 'MISC_DIR',
'./serials' => 'INTRANET_CGI_DIR',
'./skel' => 'NONE',
'./skel/var/log/koha' => { target => 'LOG_DIR', trimdir => -1 },
'./suggestion' => 'INTRANET_CGI_DIR',
'./svc' => 'INTRANET_CGI_DIR',
'./t' => 'NONE',
+ './tags' => 'INTRANET_CGI_DIR',
'./tmp' => 'NONE', # FIXME need to determine whether
# Koha generates any persistent temp files
# that should go in /var/tmp/koha
'MERGE_SERVER_PORT' => '11001',
'PAZPAR2_HOST' => 'localhost',
'PAZPAR2_PORT' => '11002',
+ 'RUN_DATABASE_TESTS' => 'no',
+ 'PATH_TO_ZEBRA' => '',
+ 'USE_MEMCACHED' => 'no',
+ 'MEMCACHED_SERVERS' => '127.0.0.1:11211',
+ 'MEMCACHED_NAMESPACE' => 'KOHA'
);
-# set some default configuratio options based on OS
+# set some default configuration options based on OS
# more conditions need to be added for other OS's
# this should probably also incorporate usage of Win32::GetOSName() and/or Win32::GetOSVersion()
# to allow for more granular decisions based on which Win32 platform
'AUTH_INDEX_MODE' => { 'grs1' => 1, 'dom' => 1 },
'ZEBRA_MARC_FORMAT' => { 'marc21' => 1, 'unimarc' => 1 }, # FIXME should generate from contents of distributation
'ZEBRA_LANGUAGE' => { 'en' => 1, 'fr' => 1 }, # FIXME should generate from contents of distribution
+ 'RUN_DATABASE_TESTS' => { 'yes' => 1, 'no' => 1 },
+ 'USE_MEMCACHED' => { 'yes' => 1, 'no' => 1 },
);
# get settings from command-line
'blib/ZEBRA_CONF_DIR/retrieval-info-auth-grs1.xml',
'blib/ZEBRA_CONF_DIR/retrieval-info-auth-dom.xml',
);
- if ($config{'INSTALL_MODE'} ne 'dev') {
- push @{ $pl_files->{'rewrite-config.PL'} }, (
- 'blib/SCRIPT_DIR/koha-zebra-ctl.sh',
- 'blib/SCRIPT_DIR/koha-pazpar2-ctl.sh',
- 'blib/SCRIPT_DIR/koha-zebraqueue-ctl.sh',
- );
- }
+ push @{ $pl_files->{'rewrite-config.PL'} }, (
+ 'blib/SCRIPT_DIR/koha-zebra-ctl.sh',
+ 'blib/SCRIPT_DIR/koha-pazpar2-ctl.sh',
+ 'blib/SCRIPT_DIR/koha-zebraqueue-ctl.sh',
+ );
if ($config{'INSTALL_PAZPAR2'} eq 'yes') {
push @{ $pl_files->{'rewrite-config.PL'} }, (
'blib/PAZPAR2_CONF_DIR/koha-biblios.xml',
if ($config{'INSTALL_MODE'} ne "dev") {
push @{ $pl_files->{'rewrite-config.PL'} }, (
'blib/PERL_MODULE_DIR/C4/Context.pm',
- 'blib/SCRIPT_DIR/kohalib.pl'
+ 'blib/SCRIPT_NONDEV_DIR/kohalib.pl'
);
}
+my %test_suite_override_dirs = (
+ KOHA_CONF_DIR => ['etc'],
+ ZEBRA_CONF_DIR => ['etc', 'zebradb'],
+ LOG_DIR => ['var', 'log'],
+ SCRIPT_DIR => ['bin'],
+ ZEBRA_LOCK_DIR => ['var', 'lock', 'zebradb'],
+ ZEBRA_DATA_DIR => ['var', 'lib', 'zebradb'],
+ ZEBRA_RUN_DIR => ['var', 'run', 'zebradb'],
+);
+
WriteMakefile(
- NAME => 'koha',
- #VERSION => strftime('2.9.%Y%m%d%H',gmtime),
- VERSION_FROM => 'kohaversion.pl',
- ABSTRACT => 'Award-winning integrated library system (ILS) and Web OPAC',
- AUTHOR => 'Koha Developers <koha-devel@nongnu.org>',
- NO_META => 1,
- PREREQ_PM => {
-# awaiting package maintainer's use of $VERSION
-#'Algorithm::CheckDigits' => 0.48,
-#'Algorithm::CheckDigits::M43_001' => 0.48,
-'Biblio::EndnoteStyle' => 0.05,
-'CGI' => 3.15,
-'CGI::Carp' => 1.29,
-'CGI::Session' => '4.10',
-'Class::Factory::Util' => 1.6,
-'Class::Accessor' => 0.30,
-'DBD::mysql' => 4.004,
-'DBI' => 1.53,
-'Data::ICal' => 0.13,
-'Data::Dumper' => 2.121_08,
-'Date::Calc' => 5.4,
-'Date::ICal' => 1.72,
-'Date::Manip' => 5.44,
-'Digest::MD5' => 2.36,
-'File::Temp' => 0.16,
-'GD::Barcode::UPCE' => 1.1,
-'Getopt::Long' => 2.35,
-'Getopt::Std' => 1.05,
-'HTML::Template::Pro' => 0.65,
-'HTTP::Cookies' => 1.39,
-'HTTP::Request::Common' => 1.26,
-'LWP::Simple' => 1.41,
-'LWP::UserAgent' => 2.033,
-'Lingua::Stem' => 0.82,
-'List::Util' => 1.18,
-'List::MoreUtils' => 0.21,
-'Locale::Language' => 2.07,
-'MARC::Charset' => 0.98,
-'MARC::Crosswalk::DublinCore' => 0.02,
-'MARC::File::XML' => 0.88,
-'MARC::Record' => 2.00,
-'MIME::Base64' => 3.07,
-'MIME::QuotedPrint' => 3.07,
-'Mail::Sendmail' => 0.79,
-'Net::LDAP' => 0.33,
-'Net::LDAP::Filter' => 0.14,
-'Net::Z3950::ZOOM' => 1.16,
-'PDF::API2' => 2.000,
-'PDF::API2::Page' => 2.000,
-'PDF::API2::Util' => 2.000,
-'PDF::Reuse' => 0.33,
-'PDF::Reuse::Barcode' => 0.05,
-'POE' => 0.9999,
-'POSIX' => 1.09,
-'Schedule::At' => 1.06,
-'Term::ANSIColor' => 1.10,
-'Test' => 1.25,
-'Test::Harness' => 2.56,
-'Test::More' => 0.62,
-'Text::CSV' => 0.01,
-'Text::CSV_XS' => 0.32,
-'Text::Iconv' => 1.7,
-'Text::Wrap' => 2005.082401,
-'Time::HiRes' => 1.86,
-'Time::localtime' => 1.02,
-'Unicode::Normalize' => 0.32,
-'XML::Dumper' => 0.81,
-'XML::LibXML' => 1.59,
-'XML::LibXSLT' => 1.59,
-'XML::SAX::ParserFactory' => 1.01,
-'XML::Simple' => 2.14,
-'XML::RSS' => 1.31,
-'YAML::Syck' => 0.71,
- },
-
- # File tree mapping
- PM => $file_map,
-
- # Man pages generated from POD
- INSTALLMAN1DIR => File::Spec->catdir($target_directories->{'MAN_DIR'}, 'man1'),
- INSTALLMAN3DIR => File::Spec->catdir($target_directories->{'MAN_DIR'}, 'man3'),
-
- PL_FILES => $pl_files,
-
+ NAME => 'koha',
+ #VERSION => strftime('2.9.%Y%m%d%H',gmtime),
+ VERSION_FROM => 'kohaversion.pl',
+ ABSTRACT => 'Award-winning integrated library system (ILS) and Web OPAC',
+ AUTHOR => 'Koha Developers <koha-devel@nongnu.org>',
+ NO_META => 1,
+ PREREQ_PM => {
+ 'Algorithm::CheckDigits' => 0.50,
+ 'Biblio::EndnoteStyle' => 0.05,
+ 'CGI' => 3.15,
+ 'CGI::Carp' => 1.29,
+ 'CGI::Session' => 4.20,
+ 'CGI::Session::Serialize::yaml' => 4.20,
+ 'Class::Factory::Util' => 1.6,
+ 'Class::Accessor' => 0.30,
+ 'DBD::mysql' => 4.004,
+ 'DBD::SQLite2' => 0.33, # optional, used for offline circulation
+ 'DBI' => 1.53,
+ 'Data::Dumper' => 2.121,
+ 'Data::ICal' => 0.13,
+ 'Date::Calc' => 5.4,
+ 'Date::ICal' => 1.72,
+ 'Date::Manip' => 5.44,
+ 'Digest::MD5' => 2.36,
+ 'Digest::SHA' => 5.43,
+ 'Email::Date' => 1.103,
+ 'File::Temp' => 0.16,
+ 'GD' => 2.39, #optional
+ 'GD::Barcode::UPCE' => 1.1,
+ 'Getopt::Long' => 2.35,
+ 'Getopt::Std' => 1.05,
+ 'HTML::Template::Pro' => 0.69,
+ 'HTML::Scrubber' => 0.08,
+ 'HTTP::Cookies' => 1.39,
+ 'HTTP::OAI' => 3.20,
+ 'HTTP::Request::Common' => 1.26,
+ 'IPC::Cmd' => 0.46,
+ 'JSON' => 2.07, # Needed by admin/item_circulation_alerts.pl
+ 'LWP::Simple' => 1.41,
+ 'LWP::UserAgent' => 2.033,
+ 'Lingua::Stem' => 0.82,
+ 'List::Util' => 1.18,
+ 'List::MoreUtils' => 0.21,
+ 'Locale::Language' => 2.07,
+ 'MARC::Charset' => 0.98,
+ 'MARC::Crosswalk::DublinCore' => 0.02,
+ 'MARC::File::XML' => 0.88,
+ 'MARC::Record' => 2.00,
+ 'MIME::Base64' => 3.07,
+ 'MIME::Lite' => 3.00,
+ 'MIME::QuotedPrint' => 3.07,
+ 'Mail::Sendmail' => 0.79,
+ 'Memoize::Memcached' => 0.03, # optional
+ 'Net::LDAP' => 0.33, # optional
+ 'Net::LDAP::Filter' => 0.14, # optional
+ 'Net::Z3950::ZOOM' => 1.16,
+ 'PDF::API2' => 2.000,
+ 'PDF::API2::Page' => 2.000,
+ 'PDF::API2::Util' => 2.000,
+ 'PDF::Reuse' => 0.33,
+ 'PDF::Reuse::Barcode' => 0.05,
+ 'POE' => 0.9999,
+ 'POSIX' => 1.09,
+ 'Schedule::At' => 1.06,
+ 'Storable' => 2.21,
+ 'SMS::Send' => 0.05, # optional
+ 'Term::ANSIColor' => 1.10,
+ 'Test' => 1.25,
+ 'Test::Harness' => 2.56,
+ 'Test::More' => 0.80,
+ 'Text::CSV' => 0.01,
+ 'Text::CSV_XS' => 0.32,
+ 'Text::Iconv' => 1.7,
+ 'Text::Wrap' => 2005.082401,
+ 'Time::HiRes' => 1.86,
+ 'Time::localtime' => 1.02,
+ 'Unicode::Normalize' => 0.32,
+ 'URI::Escape' => 1.36,
+ 'XML::Dumper' => 0.81,
+ 'XML::LibXML' => 1.59,
+ 'XML::LibXSLT' => 1.59,
+ 'XML::SAX::ParserFactory' => 1.01,
+ 'XML::SAX::Writer' => 0.44,
+ 'XML::Simple' => 2.14,
+ 'XML::RSS' => 1.31,
+ 'YAML::Syck' => 0.71,
+ },
+
+ # File tree mapping
+ PM => $file_map,
+
+ # Man pages generated from POD
+ # ExtUtils::MakeMaker already manage $(DESTDIR)
+ INSTALLMAN1DIR => File::Spec->catdir(_strip_destdir($target_directories->{'MAN_DIR'}), 'man1'),
+ INSTALLMAN3DIR => File::Spec->catdir(_strip_destdir($target_directories->{'MAN_DIR'}), 'man3'),
+
+ PL_FILES => $pl_files,
);
=head1 FUNCTIONS
next if /^#/ or /^\s*$/;
next if /^=/;
next unless m/=/;
+ s/\s+$//g;
my ($key, $value) = split /=/, $_, 2;
$values->{$key} = $value;
}
$config{'INSTALL_ZEBRA'} = _get_value('INSTALL_ZEBRA', $msg, $defaults->{'INSTALL_ZEBRA'}, $valid_values, $install_log_values);
if ($config{'INSTALL_ZEBRA'} eq 'yes') {
+
+ if (defined(my $zebra_path = find_zebra())) {
+ $config{'PATH_TO_ZEBRA'} = $zebra_path;
+ print qq(
+Found 'zebrasrv' and 'zebraidx' in $zebra_path.
+);
+ } else {
+ print q(
+Unable to find the Zebra programs 'zebrasrv' and 'zebraidx'
+in your PATH or in some of the usual places. If you haven't
+installed Zebra yet, please do so and run Makefile.PL again.
+
+);
+ }
+
$msg = q(
Since you've chosen to use Zebra with Koha,
you must specify the primary MARC format of the
}
}
+ $msg = q(
+Use memcached and memoize to cache the results of some function calls?
+This provides a signficant performance improvement.
+You will need a Memcached server running.);
+ $msg .= _add_valid_values_disp('USE_MEMCACHED', $valid_values);
+ $config{'USE_MEMCACHED'} = _get_value('USE_MEMCACHED', $msg, $defaults->{'USE_MEMCACHED'}, $valid_values, $install_log_values);
+ if ($config{'USE_MEMCACHED'} eq 'yes'){
+ $msg = q(
+Since you've chosen to use caching, you must specify the memcached servers and the namespace to use:
+);
+ $msg = q(
+Memcached server address?);
+ $config{'MEMCACHED_SERVERS'} = _get_value('MEMCACHED_SERVERS', $msg, $defaults->{'MEMCACHED_SERVERS'}, $valid_values, $install_log_values);
+
+ $msg = q(
+Memcached namespace?);
+ $config{'MEMCACHED_NAMESPACE'} = _get_value('MEMCACHED_NAMESPACE', $msg, $defaults->{'MEMCACHED_NAMESPACE'}, $valid_values, $install_log_values);
+ }
+
+
+
+ $msg = q(
+Would you like to run the database-dependent test suite?);
+ $msg .= _add_valid_values_disp( 'RUN_DATABASE_TESTS', $valid_values );
+ $config{'RUN_DATABASE_TESTS'} = _get_value( 'RUN_DATABASE_TESTS', $msg, $defaults->{'RUN_DATABASE_TESTS'}, $valid_values, $install_log_values );
+
+ if ( $config{'RUN_DATABASE_TESTS'} eq 'yes' ) {
+ $config{'TEST_DB_TYPE'} = $config{'DB_TYPE'};
+ $config{'TEST_DB_HOST'} = $config{'DB_HOST'};
+ $msg = q(TEST DATABASE
+
+THE DATA IN THIS DATABASE WILL BE DESTROYED during the process of
+testing. Please don't do this on your production database. It is not
+reversable.
+
+YOU WILL SUFFER DATA LOSS if you run this test suite on your test
+database. You are better off not running this optional test suite than
+doing it in a database that you don't want to lose.
+
+Please specify the name of the test database to be
+used by Koha);
+
+ $config{'TEST_DB_NAME'} = _get_value('TEST_DB_NAME', $msg, $defaults->{'TEST_DB_NAME'}, $valid_values, $install_log_values);
+ while ( $config{'TEST_DB_NAME'} eq $config{'DB_NAME'} ) {
+ $msg = q(Please do not use the same database for testing as you do for production. You run the severe risk of data loss.);
+ $config{'TEST_DB_NAME'} = _get_value('TEST_DB_NAME', $msg, $defaults->{'TEST_DB_NAME'}, $valid_values, $install_log_values);
+ }
+
+ $msg = q(
+Please specify the user that owns the database to be
+used by Koha);
+ $config{'TEST_DB_USER'} = _get_value('TEST_DB_USER', $msg, $defaults->{'TEST_DB_USER'}, $valid_values, $install_log_values);
+
+ $msg = q(
+Please specify the password of the user that owns the
+database to be used by Koha);
+ $config{'TEST_DB_PASS'} = _get_value('TEST_DB_PASS', $msg, $defaults->{'TEST_DB_PASS'}, $valid_values, $install_log_values);
+ }
print "\n\n";
$dirmap{'PAZPAR2_CONF_DIR'} = File::Spec->catdir(@basedir, $package, 'etc', 'pazpar2');
$dirmap{'MISC_DIR'} = File::Spec->catdir(@basedir, $package, 'misc');
$dirmap{'SCRIPT_DIR'} = File::Spec->catdir(@basedir, $package, 'bin');
+ $dirmap{'SCRIPT_NONDEV_DIR'} = $dirmap{'SCRIPT_DIR'};
$dirmap{'MAN_DIR'} = File::Spec->catdir(@basedir, $package, 'man');
$dirmap{'DOC_DIR'} = File::Spec->catdir(@basedir, $package, 'doc');
$dirmap{'ZEBRA_LOCK_DIR'} = File::Spec->catdir(@basedir, $package, 'var', 'lock', 'zebradb');
$dirmap{'PAZPAR2_CONF_DIR'} = File::Spec->catdir(@basedir, $package, 'etc', 'pazpar2');
$dirmap{'MISC_DIR'} = File::Spec->catdir(@basedir, $package, 'misc');
$dirmap{'SCRIPT_DIR'} = File::Spec->catdir(@basedir, $package, 'bin');
- $skipdirs{'SCRIPT_DIR'} = 1;
+ $dirmap{'SCRIPT_NONDEV_DIR'} = $dirmap{'SCRIPT_DIR'};
+ $skipdirs{'SCRIPT_NONDEV_DIR'} = 1;
$dirmap{'MAN_DIR'} = File::Spec->catdir(@basedir, $package, 'man');
$dirmap{'DOC_DIR'} = File::Spec->catdir(@basedir, $package, 'doc');
$dirmap{'ZEBRA_LOCK_DIR'} = File::Spec->catdir(@basedir, $package, 'var', 'lock', 'zebradb');
$dirmap{'PAZPAR2_CONF_DIR'} = File::Spec->catdir(File::Spec->rootdir(), 'etc', $package, 'pazpar2');
$dirmap{'MISC_DIR'} = File::Spec->catdir(@basedir, $package, 'misc');
$dirmap{'SCRIPT_DIR'} = File::Spec->catdir(@basedir, $package, 'bin');
+ $dirmap{'SCRIPT_NONDEV_DIR'} = $dirmap{'SCRIPT_DIR'};
$dirmap{'MAN_DIR'} = File::Spec->catdir(@basedir, $package, 'man');
$dirmap{'DOC_DIR'} = File::Spec->catdir(@basedir, $package, 'doc');
$dirmap{'ZEBRA_LOCK_DIR'} = File::Spec->catdir(File::Spec->rootdir(), 'var', 'lock', $package, 'zebradb');
_get_env_overrides(\%dirmap);
_get_argv_overrides(\%dirmap);
+ _add_destdir(\%dirmap);
return \%dirmap, \%skipdirs;
}
+=head2 get_test_dir
+
+Map a directory target to the corresponding path for
+the test suite.
+
+=cut
+
+sub get_test_dir {
+ my ($dirname) = @_;
+
+ my @basedir = (File::Spec->rel2abs(File::Spec->curdir()), 't', 'run');
+ if (exists $test_suite_override_dirs{$dirname}) {
+ return File::Spec->catdir(@basedir, @{ $test_suite_override_dirs{$dirname} });
+ } else {
+ return;
+ }
+
+}
+
sub _get_env_overrides {
my $dirmap = shift;
@ARGV = @new_argv;
}
+sub _strip_destdir {
+ my $dir = shift;
+ $dir =~ s/^\$\(DESTDIR\)//;
+ return $dir;
+}
+
+sub _add_destdir {
+ my $dirmap = shift;
+
+ foreach my $key (keys %$dirmap) {
+ $dirmap->{$key} = '$(DESTDIR)'.$dirmap->{$key};
+ }
+}
+
sub display_configuration {
my $config = shift;
my $dirmap = shift;
print "perl Makefile.PL\n";
print "\nor\n\n";
print "DB_USER=my_koha DOC_DIR=/usr/local/info perl Makefile.PL\n\n";
+ print "If installing on a Win32 platform, be sure to use:\n";
+ print "'dmake -x MAXLINELENGTH=300000'\n\n";
+}
+
+=head2 find_zebra
+
+Attempt to find Zebra - check user's PATH and
+a few other directories for zebrasrv and zebraidx.
+
+FIXME: doesn't handle Win32
+
+=cut
+
+sub find_zebra {
+ my @search_dirs = map {
+ my $abs = File::Spec->rel2abs($_);
+ my ($toss, $directories);
+ ($toss, $directories, $toss) = File::Spec->splitpath($abs, 1);
+ $directories;
+ } split /:/, $ENV{PATH};
+ push @search_dirs, qw(/usr/local/bin /opt/local/bin /usr/bin);
+ my @zebrasrv_dirs = grep { -x File::Spec->catpath('', $_, 'zebrasrv') } @search_dirs;
+ return unless @zebrasrv_dirs;
+ # verify that directory that contains zebrasrv also contains zebraidx
+ foreach my $dir (@zebrasrv_dirs) {
+ return $dir if -x File::Spec->catpath('', $dir, 'zebraidx');
+ }
+ return;
}
package MY;
# installation and uninstallation targets.
# If installation is on Win32, we need to do permissions different from *nix
- if ( $^O =~ /darwin|linux|cygwin|freebsd/ ) { # this value needs to be verified for each platform and modified accordingly
+ if ( $^O =~ /darwin|linux|cygwin|freebsd|solaris/ ) { # this value needs to be verified for each platform and modified accordingly
foreach my $key (sort keys %$target_directories) {
$install .= qq(
KOHA_INST_$key = blib/$key
$install .= "\n";
$install .= "set_koha_ownership ::\n";
+# Do not try to change ownership if DESTDIR is set
if ($config{'INSTALL_MODE'} eq 'standard' and $config{'KOHA_USER'} ne "root") {
foreach my $key (sort keys %$target_directories) {
- $install .= "\t\$(NOECHO) chown -R $config{'KOHA_USER'}:$config{'KOHA_GROUP'} \$(KOHA_DEST_$key)\n"
+ $install .= "\t\$(NOECHO) if test -z \"\$(DESTDIR)\"; then chown -R $config{'KOHA_USER'}:$config{'KOHA_GROUP'} \$(KOHA_DEST_$key); fi\n"
unless ($config{'INSTALL_ZEBRA'} ne "yes" and $key =~ /ZEBRA/) or exists $skip_directories->{$key};
}
} else {
$install .= "\t\$(NOECHO) \$(ECHO) export KOHA_CONF=\$(KOHA_DEST_KOHA_CONF_DIR)/koha-conf.xml\n";
$install .= "\t\$(NOECHO) \$(ECHO) export PERL5LIB=$target_directories->{'PERL_MODULE_DIR'}\n";
$install .= "\t\$(NOECHO) \$(ECHO)\n";
- $install .= "\t\$(NOECHO) \$(ECHO) If installing on a Win32 platform, be sure to use:\n";
- $install .= "\t\$(NOECHO) \$(ECHO) 'dmake -x MAXLINELENGTH=300000'\n";
- $install .= "\t\$(NOECHO) \$(ECHO)\n";
$install .= "\t\$(NOECHO) \$(ECHO) For other post-installation tasks, please consult the README.\n";
$install .= "\t\$(NOECHO) \$(ECHO)\n";
$install .= _update_zebra_conf_target();
}
+ $install .= upgrade();
+
return $install;
}
return $target;
}
+sub upgrade {
+ my $upgrade = "";
+
+ my $backup_suffix;
+ if (exists $install_log_values{'KOHA_INSTALLED_VERSION'}) {
+ my $version = $install_log_values{'KOHA_INSTALLED_VERSION'};
+ $version =~ s/\./_/g;
+ $backup_suffix = "_koha_$version";
+ } else {
+ $backup_suffix = "_upgrade_backup";
+ }
+
+ $upgrade .= qq/
+MOD_BACKUP = \$(ABSPERLRUN) -Minstall_misc::UpgradeBackup -e 'backup_changed_files({\@ARGV}, '$backup_suffix', '\''\$(VERBINST)'\'', '\''\$(UNINST)'\'');' --
+
+upgrade :: make_upgrade_backup install
+\t\$(NOECHO) \$(NOOP)
+make_upgrade_backup ::
+\t\$(NOECHO) umask 022; \$(MOD_BACKUP) \\
+/;
+ foreach my $key (qw/KOHA_CONF_DIR INTRANET_TMPL_DIR INTRANET_WWW_DIR OPAC_TMPL_DIR OPAC_WWW_DIR
+ PAZPAR2_CONF_DIR ZEBRA_CONF_DIR/) {
+ $upgrade .= "\t\t\$(KOHA_INST_$key) \$(KOHA_DEST_$key) \\\n"
+ unless ($config{'INSTALL_ZEBRA'} ne "yes" and $key =~ /ZEBRA/) or
+ exists $skip_directories->{$key} or
+ not exists $target_directories->{$key};
+ }
+ $upgrade =~ s/\\\n$/\n/;
+
+ return $upgrade;
+}
+
sub postamble {
# put directory mappings into Makefile
# so that Make will export as environment
$config{'ZEBRA_PASS'} =~ s/\$/\$\$/g;
}
+ my $env;
# Hereagain, we must alter syntax per platform...
if ( $^O eq 'MSWin32' ) {
# NOTE: it is imperative that there be no whitespaces in ENV=value...
- my $env = join("\n", map { "__${_}__=$target_directories->{$_}" } keys %$target_directories);
+ $env = join("\n", map { "__${_}__=$target_directories->{$_}" } keys %$target_directories);
$env .= "\n\n";
$env .= join("\n", map { "__${_}__=$config{$_}" } keys %config);
- return "$env\n";
}
else {
- my $env = join("\n", map { "export __${_}__ := $target_directories->{$_}" } keys %$target_directories);
+ $env = join("\n", map { "export __${_}__ := $target_directories->{$_}" } keys %$target_directories);
$env .= "\n\n";
$env .= join("\n", map { "export __${_}__ := $config{$_}" } keys %config);
- return "$env\n";
}
+
+ if ( $config{'RUN_DATABASE_TESTS'} eq 'yes' ) {
+ if ( open( my $confhandle, '>', 't/test-config.txt' ) ) {
+ print $confhandle "# This configuration file lets the t/Makefile prepare a test koha-conf.xml file.\n";
+ print $confhandle "# It is generated by the top-level Makefile.PL.\n";
+ print $confhandle "# It is separate from the standard koha-conf.xml so that you can edit this by hand and test with different configurations.\n";
+
+ # these directories will be relocated to the 't' directory
+ foreach my $dirname ( keys %$target_directories ) {
+ my $dir = main::_strip_destdir( $target_directories->{$dirname} );
+ if ( exists $test_suite_override_dirs{$dirname} ) {
+ $dir = main::get_test_dir($dirname);
+ }
+ print $confhandle "$dirname = $dir\n"
+ }
+ print $confhandle "\n";
+
+ print $confhandle join( "\n", map { "$_ = $config{$_}" } keys( %config ) ), "\n";
+ close( $confhandle );
+ } else {
+ warn 'unable to open conf file for database dependent tests: $!';
+ }
+
+ }
+ return "$env\n";
}