1 # Copyright 2007 MJ Ray
2 # Copyright 2016 PTFS Europe
4 # This file is part of Koha.
6 # Koha is free software; you can redistribute it and/or modify it
7 # under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 3 of the License, or
9 # (at your option) any later version.
11 # Koha is distributed in the hope that it will be useful, but
12 # WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with Koha; if not, see <http://www.gnu.org/licenses>.
19 # Current maintainer MJR http://mjr.towers.org.uk/
24 use ExtUtils::MakeMaker;
27 use Getopt::Long qw/HelpMessage/;
28 use FindBin; # we need to enforce which C4::Installer::PerlModule is used in case more than one is installed
30 use lib $FindBin::Bin;
32 use C4::Installer::PerlModules;
34 my $koha_pm = C4::Installer::PerlModules->new;
37 die "perl 5.10 or later required" unless ($] >= 5.010000);
39 # Hash up directory structure & files beginning with the directory we were called from (should be the base of koha)...
41 my $dirtree = hashdir('.');
46 Makefile.PL - Koha packager and installer
50 =head2 BASIC INSTALLATION
57 =head2 UPGRADE INSTALLATION
59 NOTE: This option is only available if koha-install-log exists.
61 perl Makefile.PL --prev-install-log /path/to/koha-install-log
67 =head2 PACKAGING RELEASE TARBALLS
78 --prev-install-log Read configuration from previous installation
79 --install_mode Installation mode (dev, standard, single)
80 --db_type Database (mysql, Pg)
81 --db_host Database host (e.g. localhost)
82 --db_port Database port (e.g. 3306)
83 --db_name Database name (e.g. koha)
84 --db_user Database user (e.g. kohaadmin)
85 --db_pass Database password (e.g. katikoan)
86 --zebra_marc_format Zebra MARC format (marc21, unimarc)
87 --zebra_language Zebra language (e.g. en)
88 --zebra_tokenizer Zebra tokenizer (chr, icu)
89 --zebra_user Zebra user (e.g. kohauser)
90 --zebra_pass Zebra password (e.g. zebrastripes)
91 --zebra_sru_host Zebra SRU servername (e.g. localhost)
92 --zebra_sru_biblios_port Zebra SRU biblios port (e.g. 9998)
93 --zebra_sru_authorities_port Zebra SRU biblios port (e.g. 9999)
94 --koha_user Koha Unix user (e.g. koha)
95 --koha_group Koha Unix group (e.g. koha)
96 --install_sru Install the SRU server (yes, no)
97 --use_memcached Use Memcached (yes, no)
98 --font_dir Location of fonts (e.g. /usr/share/fonts/truetype/dejavu)
99 --run_database_tests Run database dependent tests (yes, no)
100 --install_base Base directory of installation (e.g. /usr/share/koha)
101 --template-cache-dir Specify a template cache directory (e.g. /var/cache/koha)
102 --help Display this help message
106 This is a packager and installer that uses
107 ExtUtils::MakeMaker, which is fairly common
109 As well as building tar or zip files
110 and installing with the above commands,
111 it allows us to check pre-requisites
112 and generate configuration files.
116 =head2 NAME, VERSION_FROM, ABSTRACT, AUTHOR
118 Basic metadata about this software.
122 Suppress generation of META.yml file.
126 Hash of perl modules and versions required.
130 Hash of file mappings
134 This is a hash of PL scripts to run after installation and
135 the files to ask them to generate.
136 Maybe use the values from CONFIGURE
137 to generate initial configuration files in future.
143 This is a hash mapping directories and files in the
144 source tree to installation target directories. The rules
145 for this mapping are:
149 =item If a directory or file is specified, it and its
150 contents will be copied to the installation target directory.
152 =item If a subdirectory of a mapped directory is specified,
153 its target overrides the parent's target for that subdirectory.
155 =item The value of each map entry may either be a scalar containing
156 one target or a reference to a hash containing 'target' and 'trimdir'
159 =item Any files at the top level of the source tree that are
160 not included in the map will not be installed.
162 =item Any directories at the top level of the source tree
163 that are not included in the map will be installed in
164 INTRANET_CGI_DIR. This is a sensible default given the
165 current organization of the source tree, but (FIXME) it
166 would be better to reorganize the source tree to better
167 match the installation system, to allow adding new directories
168 without having to adjust Makefile.PL each time. The idea
169 is to make the C<$target_map> hash as minimal as possible.
173 The permitted installation targets are:
177 =item INTRANET_CGI_DIR
179 CGI scripts for intranet (staff) interface.
181 =item INTRANET_TMPL_DIR
183 HTML templates for the intranet interface.
185 =item INTRANET_WWW_DIR
187 HTML files, images, etc. for DocumentRoot for the intranet interface.
191 CGI scripts for OPAC (public) interface.
195 HTML templates for the OPAC interface.
199 HTML files, images, etc. for DocumentRoot for the OPAC interface.
201 =item PERL_MODULE_DIR
203 Perl modules (at present just the C4 modules) that are intimately
204 tied to Koha. Depending on the installation options, these
205 may or may not be installed one of the standard directories
206 in Perl's default @LIB.
210 Directory for Koha configuration files.
214 Directory for Zebra configuration files.
218 Directory for Zebra's lock files. This includes subdirs for authorities,
219 biblios, and the zebra rebuild function. Any activity to reindex
220 zebra from koha should interlock here with rebuild_zebra.pl.
224 Directory for Zebra's data files.
228 Directory for Zebra's UNIX-domain sockets.
230 =item ELASTICSEARCH_SERVERS
232 Server:port of the Elasticsearch server to use, as a comma separated list:
233 eg. 192.168.0.100:9200, localhost:9200
235 =item ELASTICSEARCH_INDEX
237 Unique index in Elasticsearch, for this Koha-instance
238 eg. koha-mykoha or just koha
242 Directory for for miscellaenous scripts, among other
243 things the translation toolkit and RSS feed tools.
247 Directory for command-line scripts and daemons to
248 be set up all for installation modes.
250 =item SCRIPT_NONDEV_DIR
252 Directory for command-line scripts that should
253 be installed in the same directory as the
254 SCRIPT_DIR target except 'dev' installs.
258 Directory for man pages created from POD -- will mostly
259 contain information of interest to Koha developers.
263 Directory for Koha documentation accessed from the
264 command-line, e.g., READMEs.
268 Directory for Koha scripts to put their locks.
272 Directory for Apache and Zebra logs produced by Koha.
276 Directory for backup files produced by Koha.
280 Directory for external Koha plugins.
284 Directory where DejaVu fonts are installed.
288 This is a dummy target used to explicitly state
289 that a given file or directory is not to be installed.
290 This is used either for parts of the installer itself
291 or for development tools that are not applicable to a
292 production installation.
299 './about.pl' => 'INTRANET_CGI_DIR',
300 './acqui' => 'INTRANET_CGI_DIR',
301 './admin' => 'INTRANET_CGI_DIR',
302 './api' => { target => 'API_CGI_DIR', trimdir => -1 },
303 './app.psgi' => 'SCRIPT_DIR',
304 './authorities' => 'INTRANET_CGI_DIR',
305 './basket' => 'INTRANET_CGI_DIR',
306 './bin' => { target => 'SCRIPT_DIR', trimdir => -1 },
307 './C4' => 'PERL_MODULE_DIR',
308 './catalogue' => 'INTRANET_CGI_DIR',
309 './cataloguing' => 'INTRANET_CGI_DIR',
310 './changelanguage.pl' => 'INTRANET_CGI_DIR',
311 './check_sysprefs.pl' => 'NONE',
312 './circ' => 'INTRANET_CGI_DIR',
313 './clubs' => 'INTRANET_CGI_DIR',
314 './course_reserves' => 'INTRANET_CGI_DIR',
315 './cpanfile' => 'PERL_MODULE_DIR',
316 './cypress.config.ts' => 'NONE',
317 './docs/history.txt' => { target => 'DOC_DIR', trimdir => -1 },
318 './docs/contributors.yaml' => { target => 'DOC_DIR', trimdir => -1 },
319 './docs/teams.yaml' => { target => 'DOC_DIR', trimdir => -1 },
320 './offline_circ' => 'INTRANET_CGI_DIR',
321 './erm' => 'INTRANET_CGI_DIR',
322 './etc' => { target => 'KOHA_CONF_DIR', trimdir => -1 },
323 './etc/zebradb' => { target => 'ZEBRA_CONF_DIR', trimdir => -1 },
324 './etc/z3950' => { target => 'Z3950_CONF_DIR', trimdir => -1 },
325 './help.pl' => 'INTRANET_CGI_DIR',
326 './ill' => 'INTRANET_CGI_DIR',
327 './installer-CPAN.pl' => 'NONE',
328 './installer' => 'INTRANET_CGI_DIR',
329 './errors' => {target => 'INTRANET_CGI_DIR'},
330 './Koha' => 'PERL_MODULE_DIR',
331 './Koha.pm' => 'PERL_MODULE_DIR',
332 './koha-tmpl/intranet-tmpl' => {target => 'INTRANET_TMPL_DIR', trimdir => -1},
333 './koha-tmpl/opac-tmpl' => {target => 'OPAC_TMPL_DIR', trimdir => -1},
334 './kohaversion.pl' => 'INTRANET_CGI_DIR',
335 './labels' => 'INTRANET_CGI_DIR',
336 './lib' => {target => 'PERL_MODULE_LIB_DIR', trimdir => -1},
337 './mainpage.pl' => 'INTRANET_CGI_DIR',
338 './Makefile.PL' => 'NONE',
339 './MANIFEST.SKIP' => 'NONE',
340 './members' => 'INTRANET_CGI_DIR',
341 './misc' => { target => 'SCRIPT_NONDEV_DIR', trimdir => -1 },
342 './misc/bin' => { target => 'SCRIPT_DIR', trimdir => -1 },
343 './misc/release_notes' => { target => 'DOC_DIR', trimdir => 2 },
344 './misc/translator' => { target => 'MISC_DIR', trimdir => 2 },
345 './misc/koha-install-log' => { target => 'MISC_DIR', trimdir => -1 },
346 './misc/installer_devel_notes' => 'NONE',
347 './opac' => 'OPAC_CGI_DIR',
348 './OpenILS' => 'PERL_MODULE_DIR',
349 './README.txt' => 'NONE',
350 './patroncards' => 'INTRANET_CGI_DIR',
351 './patron_lists' => 'INTRANET_CGI_DIR',
352 './perltidyrc' => 'NONE',
353 './plugins' => 'INTRANET_CGI_DIR',
354 './pos' => 'INTRANET_CGI_DIR',
355 './recalls' => 'INTRANET_CGI_DIR',
356 './reports' => 'INTRANET_CGI_DIR',
357 './reserve' => 'INTRANET_CGI_DIR',
358 './reviews' => 'INTRANET_CGI_DIR',
359 './rewrite-config.PL' => 'NONE',
360 './reviews' => 'INTRANET_CGI_DIR',
361 './rotating_collections' => 'INTRANET_CGI_DIR',
362 './serials' => 'INTRANET_CGI_DIR',
363 './services' => 'INTRANET_CGI_DIR',
365 './skel/var/lock/koha' => { target => 'LOCK_DIR', trimdir => -1 },
366 './skel/var/log/koha' => { target => 'LOG_DIR', trimdir => -1 },
367 './skel/var/spool/koha' => { target => 'BACKUP_DIR', trimdir => -1 },
368 './skel/var/run/koha/zebradb' => { target => 'ZEBRA_RUN_DIR', trimdir => -1 },
369 './skel/var/lock/koha/zebradb/authorities' => { target => 'ZEBRA_LOCK_DIR', trimdir => 6 },
370 './skel/var/lib/koha/zebradb/authorities/key' => { target => 'ZEBRA_DATA_DIR', trimdir => 6 },
371 './skel/var/lib/koha/zebradb/authorities/register' => { target => 'ZEBRA_DATA_DIR', trimdir => 6 },
372 './skel/var/lib/koha/zebradb/authorities/shadow' => { target => 'ZEBRA_DATA_DIR', trimdir => 6 },
373 './skel/var/lib/koha/zebradb/authorities/tmp' => { target => 'ZEBRA_DATA_DIR', trimdir => 6 },
374 './skel/var/lock/koha/zebradb/biblios' => { target => 'ZEBRA_LOCK_DIR', trimdir => 6 },
375 './skel/var/lib/koha/zebradb/biblios/key' => { target => 'ZEBRA_DATA_DIR', trimdir => 6 },
376 './skel/var/lib/koha/zebradb/biblios/register' => { target => 'ZEBRA_DATA_DIR', trimdir => 6 },
377 './skel/var/lib/koha/zebradb/biblios/shadow' => { target => 'ZEBRA_DATA_DIR', trimdir => 6 },
378 './skel/var/lib/koha/zebradb/biblios/tmp' => { target => 'ZEBRA_DATA_DIR', trimdir => 6 },
379 './skel/var/lock/koha/zebradb/rebuild' => { target => 'ZEBRA_LOCK_DIR', trimdir => 6 },
380 './skel/var/lib/koha/plugins' => { target => 'PLUGINS_DIR', trimdir => 6 },
381 './sms' => 'INTRANET_CGI_DIR',
382 './suggestion' => 'INTRANET_CGI_DIR',
383 './svc' => 'INTRANET_CGI_DIR',
386 './tags' => 'INTRANET_CGI_DIR',
387 './tmp' => 'NONE', # FIXME need to determine whether
388 # Koha generates any persistent temp files
389 # that should go in /var/tmp/koha
390 './tools' => 'INTRANET_CGI_DIR',
391 './virtualshelves' => 'INTRANET_CGI_DIR',
392 # ignore files and directories created by the install itself
393 './pm_to_blib' => 'NONE',
395 '.sass-lint.yml' => 'NONE',
396 '.scss-lint.yml' => 'NONE',
397 '.eslintrc.json' => 'NONE',
398 'gulpfile.js' => 'NONE',
399 'package.json' => 'NONE',
400 'yarn.lock' => 'NONE',
401 'cypress.json' => 'NONE',
402 'tsconfig.json' => 'NONE',
403 'webpack.config.js' => 'NONE',
406 =head1 CONFIGURATION OPTIONS
408 The following configuration options are used by the installer.
414 Specifies whether installation will be FHS-compliant (default,
415 assumes user has root), put everything under
416 a single directory (for users installing on a web host
417 that allows CGI scripts and a MySQL database but not root
418 access), or development (for a developer who wants to run
419 Koha from a git clone with no fuss).
423 Directory under which most components will go. Default
424 value will vary depending on INSTALL_MODE.
428 Type of DBMS (e.g., mysql or Pg).
436 Port that DBMS server is listening on.
440 Name of the DBMS database for Koha.
444 Name of DBMS user account for Koha's database.
448 Pasword of DMBS user account for Koha's database.
450 =item ZEBRA_MARC_FORMAT
452 Specifies format of MARC records to be indexed by Zebra.
456 Specifies primary language of records that will be
461 Internal Zebra user account for the index.
465 Internal Zebra user account's password.
469 System user account that will own Koha's files.
473 System group that will own Koha's files.
477 SMTP server host name (default: localhost)
481 SMTP server port (default: 25)
485 Connection timeour in seconds (default: 120)
489 SSL mode. Options are 'disabled' (default), 'ssl' and 'starttls'
493 SMTP authentication user name
497 SMTP authentication password
501 Enable debug mode for SMTP (default: no)
507 # default configuration options
508 my %config_defaults = (
509 'DB_TYPE' => 'mysql',
510 'DB_HOST' => 'localhost',
512 'DB_USER' => 'kohaadmin',
513 'DB_PASS' => 'katikoan',
514 'DB_USE_TLS' => 'no',
515 'DB_TLS_CA_CERTIFICATE' => '/etc/mysql-ssl/server-ca.pem',
516 'DB_TLS_CLIENT_CERTIFICATE' => '/etc/mysql-ssl/client-cert.pem',
517 'DB_TLS_CLIENT_KEY' => '/etc/mysql-ssl/client-key.pem',
518 'INSTALL_SRU' => 'yes',
519 'ZEBRA_MARC_FORMAT' => 'marc21',
520 'ZEBRA_LANGUAGE' => 'en',
521 'ZEBRA_TOKENIZER' => 'chr',
522 'ZEBRA_USER' => 'kohauser',
523 'ZEBRA_PASS' => 'zebrastripes',
524 'ZEBRA_SRU_HOST' => 'localhost',
525 'ZEBRA_SRU_BIBLIOS_PORT' => '9998',
526 'ZEBRA_SRU_AUTHORITIES_PORT' => '9999',
527 'KOHA_USER' => 'koha',
528 'KOHA_GROUP' => 'koha',
529 'MERGE_SERVER_HOST' => 'localhost',
530 'MERGE_SERVER_PORT' => '11001',
531 'RUN_DATABASE_TESTS' => 'no',
532 'PATH_TO_ZEBRA' => '',
533 'USE_MEMCACHED' => 'yes',
534 'MEMCACHED_SERVERS' => '127.0.0.1:11211',
535 'MEMCACHED_NAMESPACE' => 'KOHA',
536 'TEMPLATE_CACHE_DIR' => '/tmp/koha',
537 'USE_ELASTICSEARCH' => 'no',
538 'ELASTICSEARCH_SERVERS' => 'localhost:9200',
539 'ELASTICSEARCH_INDEX' => 'koha',
540 'FONT_DIR' => '/usr/share/fonts/truetype/dejavu',
541 'SMTP_HOST' => 'localhost',
543 'SMTP_TIMEOUT' => '120',
544 'SMTP_SSL_MODE' => 'disabled',
545 'SMTP_USER_NAME' => '',
546 'SMTP_PASSWORD' => '',
547 'SMTP_DEBUG' => 'no',
550 # set some default configuration options based on OS
551 # more conditions need to be added for other OS's
553 warn "Your platform appears to be $^O.\n" if $DEBUG;
555 if ( $^O eq 'cygwin' ) {
556 # Most Unix2Win32 ports seem to poke everything into the Program Files directory
557 # this could be changed to put some files (ie. libraries) into system32, etc.
558 $config_defaults{'INSTALL_MODE'} = 'single';
559 $config_defaults{'INSTALL_BASE'} = 'c:/progra~1/koha'; # Use 8.3 names to be safe...
562 $config_defaults{'INSTALL_MODE'} = 'standard';
563 $config_defaults{'INSTALL_BASE'} = '/usr/share/koha';
566 # valid values for certain configuration options
567 my %valid_config_values = (
568 'INSTALL_MODE' => { 'standard' => 1, 'single' => 1, 'dev' => 1 },
569 'DB_TYPE' => { 'mysql' => 1, 'Pg' => 1 },
570 'DB_USE_TLS' => {'yes', 'no'},
571 'INSTALL_SRU' => { 'yes' => 1, 'no' => 1 },
572 'ZEBRA_MARC_FORMAT' => { 'marc21' => 1, 'unimarc' => 1 }, # FIXME should generate from contents of distributation
573 'ZEBRA_LANGUAGE' => { 'cs' => 1, 'el' => 1, 'en' => 1, 'es' => 1, 'fr' => 1, 'nb' => 1, 'ru' => 1, 'uk' => 1 }, # FIXME should generate from contents of distribution
574 'ZEBRA_TOKENIZER' => { chr => 1, icu => 1 },
575 'RUN_DATABASE_TESTS' => { 'yes' => 1, 'no' => 1 },
576 'USE_MEMCACHED' => { 'yes' => 1, 'no' => 1 },
577 'USE_ELASTICSEARCH' => { 'yes' => 1, 'no' => 1 },
578 'SMTP_SSL_MODE' => { 'disabled' => 1, 'ssl' => 1, 'starttls' => 1 },
579 'SMTP_DEBUG' => { 'yes' => 1, 'no' => 1 },
582 # get settings from command-line
583 my $koha_install_log = "";
584 my $cli_koha_install_mode = "";
585 my $cli_koha_db_type = "";
586 my $cli_koha_db_host = "";
587 my $cli_koha_db_port = "";
588 my $cli_koha_db_name = "";
589 my $cli_koha_db_user = "";
590 my $cli_koha_db_pass = "";
591 my $cli_zebra_marc_format = "";
592 my $cli_zebra_language = "",
593 my $cli_zebra_tokenizer = "";
594 my $cli_zebra_user = "";
595 my $cli_zebra_pass = "";
596 my $cli_zebra_sru_host = "";
597 my $cli_zebra_sru_bib_port = "";
598 my $cli_zebra_sru_auth_port = "";
599 my $cli_koha_user = "";
600 my $cli_koha_group = "";
601 my $cli_koha_install_sru = "";
602 my $cli_koha_use_memcached = "";
603 my $cli_koha_font_dir = "";
604 my $cli_koha_run_database_tests = "";
605 my $cli_koha_install_base = "";
606 my $cli_koha_template_cache_dir = "";
607 my $cli_smtp_host = "";
608 my $cli_smtp_port = "";
609 my $cli_smtp_timeout = "";
610 my $cli_smtp_ssl_mode = "";
611 my $cli_smtp_user_name = "";
612 my $cli_smtp_password = "";
613 my $cli_smtp_debug = "";
615 Getopt::Long::Configure('pass_through');
616 my $results = GetOptions(
617 "prev-install-log=s" => \$koha_install_log,
618 "install_mode=s" => \$cli_koha_install_mode,
619 "db_type=s" => \$cli_koha_db_type,
620 "db_host=s" => \$cli_koha_db_host,
621 "db_port=s" => \$cli_koha_db_port,
622 "db_name=s" => \$cli_koha_db_name,
623 "db_user=s" => \$cli_koha_db_user,
624 "db_pass=s" => \$cli_koha_db_pass,
625 "zebra_marc_format=s" => \$cli_zebra_marc_format,
626 "zebra_language=s" => \$cli_zebra_language,
627 "zebra_tokenizer=s" => \$cli_zebra_tokenizer,
628 "zebra_user=s" => \$cli_zebra_user,
629 "zebra_pass=s" => \$cli_zebra_pass,
630 "zebra_sru_host=s" => \$cli_zebra_sru_host,
631 "zebra_sru_biblios_port=s" => \$cli_zebra_sru_bib_port,
632 "zebra_sru_authorities_port=s" => \$cli_zebra_sru_auth_port,
633 "koha_user=s" => \$cli_koha_user,
634 "koha_group=s" => \$cli_koha_group,
635 "install_sru=s" => \$cli_koha_install_sru,
636 "use_memcached=s" => \$cli_koha_use_memcached,
637 "font_dir=s" => \$cli_koha_font_dir,
638 "run_database_tests=s" => \$cli_koha_run_database_tests,
639 "install_base=s" => \$cli_koha_install_base,
640 "template-cache-dir=s" => \$cli_koha_template_cache_dir,
641 "smtp-host=s" => \$cli_smtp_host,
642 "smtp-port=s" => \$cli_smtp_port,
643 "smtp-timeout=s" => \$cli_smtp_timeout,
644 "smtp-ssl-mode=s" => \$cli_smtp_ssl_mode,
645 "smtp-user-name=s" => \$cli_smtp_user_name,
646 "smtp-password=s" => \$cli_smtp_password,
647 "smtp-debug" => \$cli_smtp_debug,
648 "help" => sub { HelpMessage(0) },
651 my %install_log_values = ();
652 if ($koha_install_log ne "") {
653 get_install_log_values($koha_install_log, \%install_log_values);
655 # Try to set install_log_values for provided values;
656 get_cli_values(\%install_log_values);
659 my %config = get_configuration(\%config_defaults, \%valid_config_values, \%install_log_values);
660 my ($target_directories, $skip_directories) = get_target_directories(\%config);
661 display_configuration(\%config, $target_directories);
663 get_file_map($target_map, $dirtree, $file_map);
665 #NOTE: List files generated by build-resources.PL, so that they're copied into blib for installation
667 $file_map->{'koha-tmpl/intranet-tmpl/prog/css/calendar.css'} = 'blib/INTRANET_TMPL_DIR/prog/css/calendar.css';
668 $file_map->{'koha-tmpl/intranet-tmpl/prog/css/holds.css'} = 'blib/INTRANET_TMPL_DIR/prog/css/holds.css';
669 $file_map->{'koha-tmpl/intranet-tmpl/prog/css/installer.css'} = 'blib/INTRANET_TMPL_DIR/prog/css/installer.css';
670 $file_map->{'koha-tmpl/intranet-tmpl/prog/css/mainpage.css'} = 'blib/INTRANET_TMPL_DIR/prog/css/mainpage.css';
671 $file_map->{'koha-tmpl/intranet-tmpl/prog/css/staff-global.css'} = 'blib/INTRANET_TMPL_DIR/prog/css/staff-global.css';
672 $file_map->{'koha-tmpl/intranet-tmpl/prog/js/vue/dist/erm.js'} = 'blib/INTRANET_TMPL_DIR/prog/js/vue/dist/erm.js';
673 $file_map->{'koha-tmpl/intranet-tmpl/prog/js/vue/dist/erm.js.LICENSE.txt'} = 'blib/INTRANET_TMPL_DIR/prog/js/vue/dist/erm.js.LICENSE.txt';
675 $file_map->{'koha-tmpl/opac-tmpl/bootstrap/css/opac.css'} = 'blib/OPAC_TMPL_DIR/bootstrap/css/opac.css';
676 $file_map->{'koha-tmpl/opac-tmpl/bootstrap/css/opac-rtl.css'} = 'blib/OPAC_TMPL_DIR/bootstrap/css/opac-rtl.css';
677 $file_map->{'koha-tmpl/opac-tmpl/bootstrap/css/print.css'} = 'blib/OPAC_TMPL_DIR/bootstrap/css/print.css';
678 $file_map->{'koha-tmpl/opac-tmpl/bootstrap/css/print-rtl.css'} = 'blib/OPAC_TMPL_DIR/bootstrap/css/print-rtl.css';
679 $file_map->{'koha-tmpl/opac-tmpl/bootstrap/css/sco.css'} = 'blib/OPAC_TMPL_DIR/bootstrap/css/sco.css';
680 $file_map->{'koha-tmpl/opac-tmpl/bootstrap/css/sco-rtl.css'} = 'blib/OPAC_TMPL_DIR/bootstrap/css/sco-rtl.css';
683 'rewrite-config.PL' => [
684 'blib/KOHA_CONF_DIR/koha-conf.xml',
685 'blib/KOHA_CONF_DIR/koha-httpd.conf',
686 'blib/KOHA_CONF_DIR/log4perl.conf',
687 'blib/KOHA_CONF_DIR/koha-worker.service',
688 'blib/ZEBRA_CONF_DIR/etc/default.idx',
689 'blib/MISC_DIR/koha-install-log'
691 'fix-perl-path.PL' => [ # this script ensures the correct shebang line for the platform installed on...
696 push @{ $pl_files->{'rewrite-config.PL'} }, (
697 'blib/ZEBRA_CONF_DIR/etc/passwd',
698 'blib/ZEBRA_CONF_DIR/zebra-biblios-dom.cfg',
699 'blib/ZEBRA_CONF_DIR/zebra-authorities-dom.cfg',
700 'blib/ZEBRA_CONF_DIR/explain-authorities.xml',
701 'blib/ZEBRA_CONF_DIR/explain-biblios.xml',
702 'blib/ZEBRA_CONF_DIR/retrieval-info-auth-dom.xml',
703 'blib/ZEBRA_CONF_DIR/retrieval-info-bib-dom.xml',
705 push @{ $pl_files->{'rewrite-config.PL'} }, (
706 'blib/SCRIPT_DIR/koha-zebra-ctl.sh',
707 'blib/SCRIPT_DIR/koha-index-daemon-ctl.sh',
709 $config{'ZEBRA_AUTH_CFG'} = 'zebra-authorities-dom.cfg';
710 $config{'ZEBRA_BIB_CFG'} = 'zebra-biblios-dom.cfg';
711 $config{'AUTH_RETRIEVAL_CFG'} = 'retrieval-info-auth-dom.xml';
712 $config{'BIB_RETRIEVAL_CFG'} = 'retrieval-info-bib-dom.xml';
714 if ($config{'INSTALL_MODE'} ne "dev") {
715 push @{ $pl_files->{'rewrite-config.PL'} }, (
716 'blib/PERL_MODULE_DIR/C4/Context.pm',
720 $config{ZEBRA_TOKENIZER_STMT} = $config{ZEBRA_TOKENIZER} eq 'icu'
721 ? 'icuchain words-icu.xml'
722 : 'charmap word-phrase-utf.chr';
724 $config{ZEBRA_PTOKENIZER_STMT} = $config{ZEBRA_TOKENIZER} eq 'icu'
725 ? 'icuchain phrases-icu.xml'
726 : 'charmap word-phrase-utf.chr';
728 my %test_suite_override_dirs = (
729 KOHA_CONF_DIR => ['etc'],
730 ZEBRA_CONF_DIR => ['etc', 'zebradb'],
731 Z3950_CONF_DIR => ['etc', 'z3950'],
732 LOCK_DIR => ['var', 'lock'],
733 LOG_DIR => ['var', 'log'],
734 BACKUP_DIR => ['var', 'spool'],
735 SCRIPT_DIR => ['bin'],
736 ZEBRA_LOCK_DIR => ['var', 'lock', 'zebradb'],
737 ZEBRA_DATA_DIR => ['var', 'lib', 'zebradb'],
738 ZEBRA_RUN_DIR => ['var', 'run', 'zebradb'],
743 #VERSION => strftime('2.9.%Y%m%d%H',gmtime),
744 VERSION_FROM => 'kohaversion.pl',
745 ABSTRACT => 'Award-winning integrated library system (ILS) and Web OPAC',
746 AUTHOR => 'Koha Contributors <https://koha-community.org/>',
748 PREREQ_PM => $koha_pm->prereq_pm,
753 # Man pages generated from POD
754 # ExtUtils::MakeMaker already manage $(DESTDIR)
755 INSTALLMAN1DIR => File::Spec->catdir(_strip_destdir($target_directories->{'MAN_DIR'}), 'man1'),
756 INSTALLMAN3DIR => File::Spec->catdir(_strip_destdir($target_directories->{'MAN_DIR'}), 'man3'),
758 PL_FILES => $pl_files,
765 This function recurses through the directory structure and builds
766 a hash of hashes containing the structure with arrays holding filenames.
767 This directory hashing routine was taken from BrowserUK @ http://www.perlmonks.org/?node_id=219919
773 opendir my $dh, $dir or die $!;
774 my $tree = {}->{$dir} = {};
775 while( my $file = readdir($dh) ) {
776 next if $file =~ m/^\.{1,2}/ and $file !~ /^\.htaccess/; # .htaccess is a special case
777 my $path = $dir .'/' . $file;
778 $tree->{$file} = hashdir($path), next if -d $path;
779 push @{$tree->{'.'}}, $file;
786 This function combines the target_map and file hash to
787 map each source file to its destination relative to
788 the set of installation targets.
790 Output will be a hash mapping from each source file
791 to its destination value, like this:
793 'mainpage.pl' => '$(INTRANET_CGI_DIR)/mainpage.pl'
798 my $target_map = shift;
800 my $file_map = shift;
801 my $curr_path = @_ ? shift : ['.'];
803 # Traverse the directory tree.
804 # For each file or directory, identify the
805 # most specific match in the target_map
806 foreach my $dir (sort keys %{ $dirtree }) {
808 # deal with files in directory
809 foreach my $file (sort @{ $dirtree->{$dir} }) {
810 my $targetdir = undef;
811 my $matchlevel = undef;
812 # first, see if there is a match on this specific
813 # file in the target map
814 my $filepath = join("/", @$curr_path, $file);
815 if (exists $target_map->{$filepath}) {
816 $targetdir = $target_map->{$filepath};
817 $matchlevel = scalar(@$curr_path) + 1;
819 # no match on the specific file; look for
821 for (my $i = scalar(@$curr_path) - 1; $i >= 0; $i--) {
822 my $dirpath = join("/", @$curr_path[0..$i]);
823 if (exists $target_map->{$dirpath}) {
824 $targetdir = $target_map->{$dirpath};
825 $matchlevel = $i + 1;
830 if (defined $targetdir) {
831 _add_to_file_map($file_map, $targetdir, $curr_path, $file, $matchlevel);
833 my $path = join("/", @$curr_path);
834 print "failed to map: $path/$file\n" if $DEBUG;
838 # dealing with subdirectory
839 push @$curr_path, $dir;
840 get_file_map($target_map, $dirtree->{$dir}, $file_map, $curr_path);
846 sub _add_to_file_map {
847 my $file_map = shift;
848 my $targetdir = shift;
849 my $curr_path = shift;
851 my $matchlevel = shift;
852 my $dest_path = @_ ? shift : $curr_path;
854 # The target can be one of the following:
855 # 1. scalar representing target symbol
856 # 2. hash ref containing target and trimdir keys
858 # Consequently, this routine traverses this structure,
859 # calling itself recursively, until it deals with
860 # all of the scalar target symbols.
861 if (ref $targetdir eq 'HASH') {
862 my $subtarget = $targetdir->{target};
863 if (exists $targetdir->{trimdir}) {
864 # if we get here, we've specified that
865 # rather than installing the file to
866 # $(TARGET)/matching/dirs/subdirs/file,
867 # we want to install it to
868 # $(TARGET)/subdirs/file
870 # Note that this the only place where
871 # $matchlevel is used.
872 my @new_dest_path = @$dest_path;
873 if ($targetdir->{trimdir} == -1) {
874 splice @new_dest_path, 0, $matchlevel;
876 splice @new_dest_path, 0, $targetdir->{trimdir};
878 _add_to_file_map($file_map, $subtarget, $curr_path, $file, $matchlevel, \@new_dest_path);
880 # actually getting here means that the
881 # target was unnecessarily listed
882 # as a hash, but we'll forgive that
883 _add_to_file_map($file_map, $subtarget, $curr_path, $file, $matchlevel);
885 } elsif ($targetdir ne 'NONE' and $targetdir ne '') {
886 my $source = File::Spec->catfile(@$curr_path, $file);
887 my $destination = File::Spec->catfile('blib', $targetdir, @$dest_path, $file);
888 #print "$source => $destination\n"; # DEBUG
889 # quote spaces in file names
890 # FIXME: this is of questionable portability and
891 # probably depends on user's make recognizing this
892 # quoting syntax -- probably better to remove
893 # spaces and shell metacharacters from all file names
894 $source =~ s/ /\\ /g;
895 $destination =~ s/ /\\ /g;
897 $file_map->{$source} = $destination;
901 =head2 get_cli_values
903 Reads values provided on cli for configuration values
910 INSTALL_MODE => $cli_koha_install_mode,
911 DB_TYPE => $cli_koha_db_type,
912 DB_HOST => $cli_koha_db_host,
913 DB_PORT => $cli_koha_db_port,
914 DB_NAME => $cli_koha_db_name,
915 DB_USER => $cli_koha_db_user,
916 DB_PASS => $cli_koha_db_pass,
917 ZEBRA_MARC_FORMAT => $cli_zebra_marc_format,
918 ZEBRA_LANGUAGE => $cli_zebra_language,
919 ZEBRA_TOKENIZER => $cli_zebra_tokenizer,
920 ZEBRA_USER => $cli_zebra_user,
921 ZEBRA_PASS => $cli_zebra_pass,
922 ZEBRA_SRU_HOST => $cli_zebra_sru_host,
923 ZEBRA_SRU_BIBLIOS_PORT => $cli_zebra_sru_bib_port,
924 ZEBRA_SRU_AUTHORITIES_PORT => $cli_zebra_sru_auth_port,
925 KOHA_USER => $cli_koha_user,
926 KOHA_GROUP => $cli_koha_group,
927 INSTALL_SRU => $cli_koha_install_sru,
928 USE_MEMCACHED => $cli_koha_use_memcached,
929 FONT_DIR => $cli_koha_font_dir,
930 RUN_DATABASE_TESTS => $cli_koha_run_database_tests,
931 INSTALL_BASE => $cli_koha_install_base,
932 TEMPLATE_CACHE_DIR => $cli_koha_template_cache_dir,
933 SMTP_HOST => $cli_smtp_host,
934 SMTP_PORT => $cli_smtp_port,
935 SMTP_TIMEOUT => $cli_smtp_timeout,
936 SMTP_SSL_MODE => $cli_smtp_ssl_mode,
937 SMTP_USER_NAME => $cli_smtp_user_name,
938 SMTP_PASSWORD => $cli_smtp_password,
939 SMTP_DEBUG => (defined $cli_smtp_debug) ? ( $cli_smtp_debug ? 'yes' : 'no' ) : $values->{SMTP_DEBUG},
941 foreach my $key (keys %{$map}) {
942 $values->{$key} = $map->{$key} if ($map->{$key});
946 =head2 get_install_log_values
948 Reads value from the Koha install log specified by
953 sub get_install_log_values {
954 my $install_log = shift;
957 open my $log, '<', $install_log or die "Cannot open install log $install_log: $!\n";
960 next if /^#/ or /^\s*$/;
964 my ($key, $value) = split /=/, $_, 2;
965 $values->{$key} = $value;
969 print <<_EXPLAIN_INSTALL_LOG_;
970 Reading values from install log $install_log. You
971 will be prompted only for settings that have been
972 added since the last time you installed Koha. To
973 be prompted for all settings, run 'perl Makefile.PL'
974 without the --prev-install-log option.
975 _EXPLAIN_INSTALL_LOG_
978 =head2 get_configuration
980 This prompts the user for various configuration options.
984 sub get_configuration {
985 my $defaults = shift;
986 my $valid_values = shift;
987 my $install_log_values = shift;
991 By default, Koha can be installed in one of three ways:
993 standard: Install files in conformance with the Filesystem
994 Hierarchy Standard (FHS). This is the default mode
995 and should be used when installing a production
996 Koha system. On Unix systems, root access is
997 needed to complete a standard installation.
999 single: Install files under a single directory. This option
1000 is useful for installing Koha without root access, e.g.,
1001 on a web host that allows CGI scripts and MySQL databases
1002 but requires the user to keep all files under the user's
1005 dev: Create a set of symbolic links and configuration files to
1006 allow Koha to run directly from the source distribution.
1007 This mode is useful for developers who want to run
1008 Koha from a git clone.
1011 $msg .= _add_valid_values_disp('INSTALL_MODE', $valid_values);
1012 $config{'INSTALL_MODE'} = _get_value('INSTALL_MODE', $msg, $defaults->{'INSTALL_MODE'}, $valid_values, $install_log_values);
1014 # set message and default value for INSTALL_BASE
1015 # depending on value of INSTALL_MODE
1016 my $install_base_default = $defaults->{'INSTALL_BASE'};
1017 if ($config{'INSTALL_MODE'} eq 'dev') {
1019 Please specify the directory in which to install Koha's
1020 active configuration files and (if applicable) the
1021 Zebra database. Koha's CGI scripts and templates will
1022 be run from the current directory.
1024 Configuration directory:);
1025 # FIXME - home directory portability consideration apply
1026 $install_base_default =
1028 || ( exists $ENV{HOME} ? "$ENV{HOME}/koha-dev" : "$defaults->{'INSTALL_BASE'}-dev" )
1030 } elsif ($config{'INSTALL_MODE'} eq 'single') {
1031 $msg = "\nPlease specify the directory in which to install Koha";
1032 # FIXME -- we're assuming under a 'single' mode install
1033 # that user will likely want to install under the home
1034 # directory. This is OK in and of itself, but we should
1035 # use File::HomeDir to locate the home directory portably.
1036 # This is deferred for now because File::HomeDir is not yet
1038 # --we must also keep this portable to the major OS's -fbcit
1039 $install_base_default = (exists $ENV{'HOME'}) ? "$ENV{'HOME'}/koha" : $defaults->{'INSTALL_BASE'};
1043 Please specify the directory under which most Koha files
1046 Note that if you are planning in installing more than
1047 one instance of Koha, you may want to modify the last
1048 component of the directory path, which will be used
1049 as the package name in the FHS layout.
1051 Base installation directory);
1053 $config{'INSTALL_BASE'} = _get_value('INSTALL_BASE', $msg, $install_base_default, $valid_values, $install_log_values);
1055 $config{'INSTALL_BASE'} = File::Spec->rel2abs($config{'INSTALL_BASE'});
1056 print "INSTALL_BASE=$config{'INSTALL_BASE'}\r\n" if $DEBUG;
1057 if ($config{'INSTALL_MODE'} eq "standard") {
1059 Since you are using the 'standard' install
1060 mode, you should run 'make install' as root.
1061 However, it is recommended that a non-root
1062 user (on Unix and Linux platforms) have
1063 ownership of Koha's files, including the
1064 Zebra indexes if applicable.
1066 Please specify a user account. This
1067 user account does not need to exist
1068 right now, but it needs to exist
1069 before you run 'make install'. Please
1070 note that for security reasons, this
1071 user should not be the same as the user
1072 account Apache runs under.
1075 $config{'KOHA_USER'} = _get_value('KOHA_USER', $msg, $defaults->{'KOHA_USER'}, $valid_values, $install_log_values);
1078 Please specify the group that should own
1079 Koha's files. As above, this group need
1080 not exist right now, but should be created
1081 before you run 'make install'.
1084 $config{'KOHA_GROUP'} = _get_value('KOHA_GROUP', $msg, $defaults->{'KOHA_GROUP'}, $valid_values, $install_log_values);
1088 Please specify which database engine you will use
1089 to store data in Koha. The choices are MySQL and
1090 PostgreSQL; please note that at the moment
1091 PostgreSQL support is highly experimental.
1094 $msg .= _add_valid_values_disp('DB_TYPE', $valid_values);
1095 $config{'DB_TYPE'} = _get_value('DB_TYPE', $msg, $defaults->{'DB_TYPE'}, $valid_values, $install_log_values);
1098 Please specify the name or address of your
1099 database server. Note that the database
1100 does not have to exist at this point, it
1101 can be created after running 'make install'
1102 and before you try using Koha for the first time.
1105 $config{'DB_HOST'} = _get_value('DB_HOST', $msg, $defaults->{'DB_HOST'}, $valid_values, $install_log_values);
1108 Please specify the port used to connect to the
1110 my $db_port_default = $config{'DB_TYPE'} eq 'mysql' ? '3306' : '5432';
1111 $config{'DB_PORT'} = _get_value('DB_PORT', $msg, $db_port_default, $valid_values, $install_log_values);
1114 Please specify the name of the database to be
1116 $config{'DB_NAME'} = _get_value('DB_NAME', $msg, $defaults->{'DB_NAME'}, $valid_values, $install_log_values);
1117 if ($config{'DB_TYPE'} eq 'mysql'){
1119 Please specify whether the connection to MySQL will use TLS
1121 $config{'DB_USE_TLS'} = _get_value('DB_USE_TLS', $msg, $defaults->{'DB_USE_TLS'}, $valid_values, $install_log_values);
1123 if ($config{'DB_USE_TLS'} eq 'yes'){
1125 Please enter the path to the CA certificate for TLS
1127 $config{'DB_TLS_CA_CERTIFICATE'} = _get_value('DB_TLS_CA_CERTIFICATE', $msg, $defaults->{'DB_TLS_CA_CERTIFICATE'}, $valid_values, $install_log_values);
1130 Please enter the path to the client certificate for TLS
1132 $config{'DB_TLS_CLIENT_CERTIFICATE'} = _get_value('DB_TLS_CLIENT_CERTIFICATE', $msg, $defaults->{'DB_TLS_CLIENT_CERTIFICATE'}, $valid_values, $install_log_values);
1134 Please enter the path to the client key for TLS
1136 $config{'DB_TLS_CLIENT_KEY'} = _get_value('DB_TLS_CLIENT_KEY', $msg, $defaults->{'DB_TLS_CLIENT_KEY'}, $valid_values, $install_log_values);
1140 Please specify the user that owns the database to be
1142 $config{'DB_USER'} = _get_value('DB_USER', $msg, $defaults->{'DB_USER'}, $valid_values, $install_log_values);
1145 Please specify the password of the user that owns the
1146 database to be used by Koha);
1147 $config{'DB_PASS'} = _get_value('DB_PASS', $msg, $defaults->{'DB_PASS'}, $valid_values, $install_log_values);
1150 Koha uses the Zebra search engine for high-performance
1151 searching of bibliographic and authority records. Checking
1152 to see if you have installed the Zebra software...
1155 if (defined(my $zebra_path = find_zebra())) {
1156 $config{'PATH_TO_ZEBRA'} = $zebra_path;
1158 Found 'zebrasrv' and 'zebraidx' in $zebra_path.
1162 Unable to find the Zebra programs 'zebrasrv' and 'zebraidx'
1163 in your PATH or in some of the usual places. If you haven't
1164 installed Zebra yet, please do so and run Makefile.PL again.
1170 You must specify the primary MARC format of the
1171 records to be indexed by Zebra.
1173 Koha provides Zebra configuration files for MARC21,
1176 MARC format for Zebra indexing);
1177 $msg .= _add_valid_values_disp('ZEBRA_MARC_FORMAT', $valid_values);
1178 $config{'ZEBRA_MARC_FORMAT'} = _get_value('ZEBRA_MARC_FORMAT', $msg, $defaults->{'ZEBRA_MARC_FORMAT'}, $valid_values, $install_log_values);
1180 Koha supplies Zebra configuration files tuned for
1181 searching either English (en) or French (fr) MARC
1184 Primary language for Zebra indexing);
1185 $msg .= _add_valid_values_disp('ZEBRA_LANGUAGE', $valid_values);
1186 $config{'ZEBRA_LANGUAGE'} = _get_value('ZEBRA_LANGUAGE', $msg, $defaults->{'ZEBRA_LANGUAGE'}, $valid_values, $install_log_values);
1189 Zebra has two methods to perform records tokenization
1190 and characters normalization: CHR and ICU. ICU is
1191 recommended for catalogs containing non-Latin
1194 $msg .= _add_valid_values_disp('ZEBRA_TOKENIZER', $valid_values);
1195 $config{'ZEBRA_TOKENIZER'} = _get_value('ZEBRA_TOKENIZER', $msg, $defaults->{'ZEBRA_TOKENIZER'}, $valid_values, $install_log_values);
1198 Please specify Zebra database user);
1199 $config{'ZEBRA_USER'} = _get_value('ZEBRA_USER', $msg, $defaults->{'ZEBRA_USER'}, $valid_values, $install_log_values);
1202 Please specify the Zebra database password);
1203 $config{'ZEBRA_PASS'} = _get_value('ZEBRA_PASS', $msg, $defaults->{'ZEBRA_PASS'}, $valid_values, $install_log_values);
1206 Since you've chosen to use Zebra, you can enable the SRU/
1207 Z39.50 Server if you so choose, but you must specify a
1208 few configuration options for it.
1210 Please note that if you choose *NOT* to configure SRU,
1211 koha-conf.xml will still contain some references to SRU
1212 settings. Those references will be ignored by Koha.
1214 Install the SRU configuration files?);
1215 $msg .= _add_valid_values_disp('INSTALL_SRU', $valid_values);
1216 $config{'INSTALL_SRU'} = _get_value('INSTALL_SRU', $msg, $defaults->{'INSTALL_SRU'}, $valid_values, $install_log_values);
1218 if ($config{'INSTALL_SRU'} eq 'yes') {
1220 Since you've chosen to configure SRU, you must
1221 specify the host and port(s) that the SRU
1222 Servers (bibliographic and authority) should run on.
1225 SRU Database host?);
1226 $config{'ZEBRA_SRU_HOST'} = _get_value('ZEBRA_SRU_HOST', $msg, $defaults->{'ZEBRA_SRU_HOST'}, $valid_values, $install_log_values);
1229 SRU port for bibliographic data?);
1230 $config{'ZEBRA_SRU_BIBLIOS_PORT'} = _get_value('ZEBRA_SRU_BIBLIOS_PORT', $msg, $defaults->{'ZEBRA_SRU_BIBLIOS_PORT'}, $valid_values, $install_log_values);
1233 SRU port for authority data?);
1234 $config{'ZEBRA_SRU_AUTHORITIES_PORT'} = _get_value('ZEBRA_SRU_AUTHORITIES_PORT', $msg, $defaults->{'ZEBRA_SRU_AUTHORITIES_PORT'}, $valid_values, $install_log_values);
1239 Use memcached to cache the results of some function calls?
1240 This provides a significant performance improvement.
1241 You will need a Memcached server running.);
1242 $msg .= _add_valid_values_disp('USE_MEMCACHED', $valid_values);
1243 $config{'USE_MEMCACHED'} = _get_value('USE_MEMCACHED', $msg, $defaults->{'USE_MEMCACHED'}, $valid_values, $install_log_values);
1244 if ($config{'USE_MEMCACHED'} eq 'yes'){
1246 Since you've chosen to use caching, you must specify the memcached servers and the namespace to use:
1249 Memcached server address?);
1250 $config{'MEMCACHED_SERVERS'} = _get_value('MEMCACHED_SERVERS', $msg, $defaults->{'MEMCACHED_SERVERS'}, $valid_values, $install_log_values);
1253 Memcached namespace?);
1254 $config{'MEMCACHED_NAMESPACE'} = _get_value('MEMCACHED_NAMESPACE', $msg, $defaults->{'MEMCACHED_NAMESPACE'}, $valid_values, $install_log_values);
1259 Use Elasticsearch to serve search results?
1260 You will need a Elasticsearch server running.);
1261 $msg .= _add_valid_values_disp('USE_ELASTICSEARCH', $valid_values);
1262 $config{'USE_ELASTICSEARCH'} = _get_value('USE_ELASTICSEARCH', $msg, $defaults->{'USE_ELASTICSEARCH'}, $valid_values, $install_log_values);
1263 if ($config{'USE_ELASTICSEARCH'} eq 'yes'){
1265 Define the ELASTICSEARCH_SERVERS with a comma-separated list. Eg
1266 localhost:9200, 192.168.0.100:9200
1269 Elasticsearch server addresses?);
1270 $config{'ELASTICSEARCH_SERVERS'} = _get_value('ELASTICSEARCH_SERVERS', $msg, $defaults->{'ELASTICSEARCH_SERVERS'}, $valid_values, $install_log_values);
1273 What index name to use for this Koha-instance? It must be unique for each Koha
1274 sharing the same Elasticsearch-cluster
1276 Elasticsearch index?);
1277 $config{'ELASTICSEARCH_INDEX'} = _get_value('ELASTICSEARCH_INDEX', $msg, $defaults->{'ELASTICSEARCH_INDEX'}, $valid_values, $install_log_values);
1281 Template cache directory?);
1282 $config{'TEMPLATE_CACHE_DIR'} = _get_value('TEMPLATE_CACHE_DIR', $msg, $defaults->{'TEMPLATE_CACHE_DIR'}, $valid_values, $install_log_values);
1285 Path to DejaVu fonts?);
1286 $config{'FONT_DIR'} = _get_value('FONT_DIR', $msg, $defaults->{'FONT_DIR'}, $valid_values, $install_log_values);
1290 You will be able to set your default SMTP configuration.);
1293 $config{'SMTP_HOST'} = _get_value('SMTP_HOST', $msg, $defaults->{'SMTP_HOST'}, $valid_values, $install_log_values);
1297 $config{'SMTP_PORT'} = _get_value('SMTP_PORT', $msg, $defaults->{'SMTP_PORT'}, $valid_values, $install_log_values);
1300 SMTP timeout (in seconds)?};
1301 $config{'SMTP_TIMEOUT'} = _get_value('SMTP_TIMEOUT', $msg, $defaults->{'SMTP_TIMEOUT'}, $valid_values, $install_log_values);
1305 $msg .= _add_valid_values_disp('SMTP_SSL_MODE', $valid_values);
1306 $config{'SMTP_SSL_MODE'} = _get_value('SMTP_SSL_MODE', $msg, $defaults->{'SMTP_SSL_MODE'}, $valid_values, $install_log_values);
1310 $config{'SMTP_USER_NAME'} = _get_value('SMTP_USER_NAME', $msg, $defaults->{'SMTP_USER_NAME'}, $valid_values, $install_log_values);
1314 $config{'SMTP_PASSWORD'} = _get_value('SMTP_PASSWORD', $msg, $defaults->{'SMTP_PASSWORD'}, $valid_values, $install_log_values);
1318 $msg .= _add_valid_values_disp('SMTP_DEBUG', $valid_values);
1319 $config{'SMTP_DEBUG'} = _get_value('SMTP_DEBUG', $msg, $defaults->{'SMTP_DEBUG'}, $valid_values, $install_log_values);
1321 $config{'SMTP_DEBUG'} = ( $config{'SMTP_DEBUG'} eq 'yes' ) ? 1 : 0;
1324 Would you like to run the database-dependent test suite?);
1325 $msg .= _add_valid_values_disp( 'RUN_DATABASE_TESTS', $valid_values );
1326 $config{'RUN_DATABASE_TESTS'} = _get_value( 'RUN_DATABASE_TESTS', $msg, $defaults->{'RUN_DATABASE_TESTS'}, $valid_values, $install_log_values );
1328 if ( $config{'RUN_DATABASE_TESTS'} eq 'yes' ) {
1329 $config{'TEST_DB_TYPE'} = $config{'DB_TYPE'};
1330 $config{'TEST_DB_HOST'} = $config{'DB_HOST'};
1331 $msg = q(TEST DATABASE
1333 THE DATA IN THIS DATABASE WILL BE DESTROYED during the process of
1334 testing. Please don't do this on your production database. It is not
1337 YOU WILL SUFFER DATA LOSS if you run this test suite on your test
1338 database. You are better off not running this optional test suite than
1339 doing it in a database that you don't want to lose.
1341 Please specify the name of the test database to be
1344 $config{'TEST_DB_NAME'} = _get_value('TEST_DB_NAME', $msg, $defaults->{'TEST_DB_NAME'}, $valid_values, $install_log_values);
1345 while ( $config{'TEST_DB_NAME'} eq $config{'DB_NAME'} ) {
1346 $msg = q(Please do not use the same database for testing as you do for production. You run the severe risk of data loss.);
1347 $config{'TEST_DB_NAME'} = _get_value('TEST_DB_NAME', $msg, $defaults->{'TEST_DB_NAME'}, $valid_values, $install_log_values);
1351 Please specify the user that owns the database to be
1353 $config{'TEST_DB_USER'} = _get_value('TEST_DB_USER', $msg, $defaults->{'TEST_DB_USER'}, $valid_values, $install_log_values);
1356 Please specify the password of the user that owns the
1357 database to be used by Koha);
1358 $config{'TEST_DB_PASS'} = _get_value('TEST_DB_PASS', $msg, $defaults->{'TEST_DB_PASS'}, $valid_values, $install_log_values);
1363 # add version number
1364 my $version = "no_version_found";
1366 require 'kohaversion.pl';
1367 $version = kohaversion();
1369 $config{'KOHA_INSTALLED_VERSION'} = $version;
1374 sub _add_valid_values_disp {
1376 my $valid_values = shift;
1379 if (exists $valid_values->{$key}) {
1380 $disp = " (" . join(", ", sort keys %{ $valid_values->{$key} }) . ")";
1388 my $default = shift;
1389 my $valid_values = shift;
1390 my $install_log_values = shift;
1392 # take value from install log if present
1393 if (exists $install_log_values{$key}) {
1394 $install_log_values{$key} =~ s/\$/\$\$/g;
1395 return $install_log_values{$key};
1398 # override default value from environment
1399 if (exists $ENV{$key}) {
1400 $default = $ENV{$key};
1401 $msg .= " (default from environment)";
1404 my $val = prompt($msg, $default);
1406 while (exists $valid_values->{$key} and
1407 $val ne $default and
1408 not exists $valid_values->{$key}->{$val}) {
1409 my $retry_msg = "Value '$val' is not a valid option.\n";
1410 $retry_msg .= "Please enter a value";
1411 $retry_msg .= _add_valid_values_disp($key, $valid_values);
1412 $val = prompt($retry_msg, $default);
1414 $val =~ s/\$/\$\$/g;
1418 =head2 get_target_directories
1420 Creates a hash mapping from symbols for installation target
1421 directories to actual directory paths.
1423 Also returns a hash indicating targets for which
1424 files need not be copied -- this is used for the 'dev'
1425 mode installation, where some files are installed in place.
1429 sub get_target_directories {
1432 my $base = $config->{'INSTALL_BASE'};
1433 my $mode = $config->{'INSTALL_MODE'};
1435 # get last component of install base directory
1436 # to treat as package name
1437 my ($volume, $directories, $file) = File::Spec->splitpath($base, 1);
1439 my @basedir = File::Spec->splitdir($directories);
1441 if ( $^O eq 'cygwin' ) { shift @basedir; unshift @basedir, 'c:'; } # in a cygwin environment, $volume is returned empty
1443 my $package = pop @basedir;
1448 if ($mode eq 'single') {
1449 $dirmap{'API_CGI_DIR'} = File::Spec->catdir(@basedir, $package, 'api');
1450 $dirmap{'INTRANET_CGI_DIR'} = File::Spec->catdir(@basedir, $package, 'intranet', 'cgi-bin');
1451 $dirmap{'INTRANET_TMPL_DIR'} = File::Spec->catdir(@basedir, $package, 'intranet', 'htdocs', 'intranet-tmpl');
1452 $dirmap{'INTRANET_WWW_DIR'} = File::Spec->catdir(@basedir, $package, 'intranet', 'htdocs');
1453 $dirmap{'OPAC_CGI_DIR'} = File::Spec->catdir(@basedir, $package, 'opac', 'cgi-bin');
1454 $dirmap{'OPAC_TMPL_DIR'} = File::Spec->catdir(@basedir, $package, 'opac', 'htdocs', 'opac-tmpl');
1455 $dirmap{'OPAC_WWW_DIR'} = File::Spec->catdir(@basedir, $package, 'opac', 'htdocs');
1456 $dirmap{'PERL_MODULE_DIR'} = File::Spec->catdir(@basedir, $package, 'lib');
1457 $dirmap{'PERL_MODULE_LIB_DIR'} = File::Spec->catdir(@basedir, $package, 'lib');
1458 $dirmap{'KOHA_CONF_DIR'} = File::Spec->catdir(@basedir, $package, 'etc');
1459 $dirmap{'ZEBRA_CONF_DIR'} = File::Spec->catdir(@basedir, $package, 'etc', 'zebradb');
1460 $dirmap{'Z3950_CONF_DIR'} = File::Spec->catdir(@basedir, $package, 'etc', 'z3950');
1461 $dirmap{'MISC_DIR'} = File::Spec->catdir(@basedir, $package, 'misc');
1462 $dirmap{'SCRIPT_DIR'} = File::Spec->catdir(@basedir, $package, 'bin');
1463 $dirmap{'SCRIPT_NONDEV_DIR'} = $dirmap{'SCRIPT_DIR'};
1464 $dirmap{'MAN_DIR'} = File::Spec->catdir(@basedir, $package, 'man');
1465 $dirmap{'DOC_DIR'} = File::Spec->catdir(@basedir, $package, 'doc');
1466 $dirmap{'ZEBRA_LOCK_DIR'} = File::Spec->catdir(@basedir, $package, 'var', 'lock', 'zebradb');
1467 $dirmap{'LOCK_DIR'} = File::Spec->catdir(@basedir, $package, 'var', 'lock');
1468 $dirmap{'LOG_DIR'} = File::Spec->catdir(@basedir, $package, 'var', 'log');
1469 $dirmap{'BACKUP_DIR'} = File::Spec->catdir(@basedir, $package, 'var', 'spool');
1470 $dirmap{'PLUGINS_DIR'} = File::Spec->catdir(@basedir, $package, 'var', 'lib', 'koha', 'plugins');
1471 $dirmap{'ZEBRA_DATA_DIR'} = File::Spec->catdir(@basedir, $package, 'var', 'lib', 'zebradb');
1472 $dirmap{'ZEBRA_RUN_DIR'} = File::Spec->catdir(@basedir, $package, 'var', 'run', 'zebradb');
1473 } elsif ($mode eq 'dev') {
1474 my $curdir = File::Spec->rel2abs(File::Spec->curdir());
1475 $dirmap{'API_CGI_DIR'} = File::Spec->catdir($curdir, 'api');
1476 $skipdirs{'API_CGI_DIR'} = 1;
1477 $dirmap{'INTRANET_CGI_DIR'} = File::Spec->catdir($curdir);
1478 $skipdirs{'INTRANET_CGI_DIR'} = 1;
1479 $dirmap{'INTRANET_TMPL_DIR'} = File::Spec->catdir($curdir, 'koha-tmpl', 'intranet-tmpl');
1480 $skipdirs{'INTRANET_TMPL_DIR'} = 1;
1481 $dirmap{'INTRANET_WWW_DIR'} = File::Spec->catdir($curdir, 'koha-tmpl');
1482 $skipdirs{'INTRANET_WWW_DIR'} = 1;
1483 $dirmap{'OPAC_CGI_DIR'} = File::Spec->catdir($curdir);
1484 $skipdirs{'OPAC_CGI_DIR'} = 1;
1485 $dirmap{'OPAC_TMPL_DIR'} = File::Spec->catdir($curdir, 'koha-tmpl', 'opac-tmpl');
1486 $skipdirs{'OPAC_TMPL_DIR'} = 1;
1487 $dirmap{'OPAC_WWW_DIR'} = File::Spec->catdir($curdir, 'koha-tmpl');
1488 $skipdirs{'OPAC_WWW_DIR'} = 1;
1489 #NOTE: We're hacking the dirmap here, so that PERL_MODULE_DIR tokens get rewritten correctly for git installs
1490 $dirmap{'PERL_MODULE_DIR'} = File::Spec->catdir($curdir);
1491 $skipdirs{'PERL_MODULE_DIR'} = 1;
1492 $dirmap{'PERL_MODULE_LIB_DIR'} = File::Spec->catdir($curdir,'lib');
1493 $skipdirs{'PERL_MODULE_LIB_DIR'} = 1;
1494 $dirmap{'KOHA_CONF_DIR'} = File::Spec->catdir(@basedir, $package, 'etc');
1495 $dirmap{'ZEBRA_CONF_DIR'} = File::Spec->catdir(@basedir, $package, 'etc', 'zebradb');
1496 $dirmap{'Z3950_CONF_DIR'} = File::Spec->catdir(@basedir, $package, 'etc', 'z3950');
1497 $dirmap{'MISC_DIR'} = File::Spec->catdir(@basedir, $package, 'misc');
1498 $dirmap{'SCRIPT_DIR'} = File::Spec->catdir(@basedir, $package, 'bin');
1499 #For dev install, point NONDEV_DIR to misc in current dir (not base)
1500 #Used by supportdir in koha-conf.xml (BZ 12031)
1501 $dirmap{'SCRIPT_NONDEV_DIR'} = File::Spec->catdir($curdir, 'misc');
1502 $skipdirs{'SCRIPT_NONDEV_DIR'} = 1;
1503 $dirmap{'MAN_DIR'} = File::Spec->catdir(@basedir, $package, 'man');
1504 $dirmap{'DOC_DIR'} = File::Spec->catdir(@basedir, $package, 'doc');
1505 $dirmap{'ZEBRA_LOCK_DIR'} = File::Spec->catdir(@basedir, $package, 'var', 'lock', 'zebradb');
1506 $dirmap{'LOCK_DIR'} = File::Spec->catdir(@basedir, $package, 'var', 'lock');
1507 $dirmap{'LOG_DIR'} = File::Spec->catdir(@basedir, $package, 'var', 'log');
1508 $dirmap{'BACKUP_DIR'} = File::Spec->catdir(@basedir, $package, 'var', 'spool');
1509 $dirmap{'PLUGINS_DIR'} = File::Spec->catdir(@basedir, $package, 'var', 'lib', 'plugins');
1510 $dirmap{'ZEBRA_DATA_DIR'} = File::Spec->catdir(@basedir, $package, 'var', 'lib', 'zebradb');
1511 $dirmap{'ZEBRA_RUN_DIR'} = File::Spec->catdir(@basedir, $package, 'var', 'run', 'zebradb');
1513 # mode is standard, i.e., 'fhs'
1514 $dirmap{'API_CGI_DIR'} = File::Spec->catdir(@basedir, $package, 'api');
1515 $dirmap{'INTRANET_CGI_DIR'} = File::Spec->catdir(@basedir, $package, 'intranet', 'cgi-bin');
1516 $dirmap{'INTRANET_TMPL_DIR'} = File::Spec->catdir(@basedir, $package, 'intranet', 'htdocs', 'intranet-tmpl');
1517 $dirmap{'INTRANET_WWW_DIR'} = File::Spec->catdir(@basedir, $package, 'intranet', 'htdocs');
1518 $dirmap{'OPAC_CGI_DIR'} = File::Spec->catdir(@basedir, $package, 'opac', 'cgi-bin');
1519 $dirmap{'OPAC_TMPL_DIR'} = File::Spec->catdir(@basedir, $package, 'opac', 'htdocs', 'opac-tmpl');
1520 $dirmap{'OPAC_WWW_DIR'} = File::Spec->catdir(@basedir, $package, 'opac', 'htdocs');
1521 $dirmap{'PERL_MODULE_DIR'} = File::Spec->catdir(@basedir, $package, 'lib');
1522 $dirmap{'PERL_MODULE_LIB_DIR'} = File::Spec->catdir(@basedir, $package, 'lib');
1523 $dirmap{'KOHA_CONF_DIR'} = File::Spec->catdir(File::Spec->rootdir(), 'etc', $package);
1524 $dirmap{'ZEBRA_CONF_DIR'} = File::Spec->catdir(File::Spec->rootdir(), 'etc', $package, 'zebradb');
1525 $dirmap{'Z3950_CONF_DIR'} = File::Spec->catdir(File::Spec->rootdir(), 'etc', $package, 'z3950');
1526 $dirmap{'MISC_DIR'} = File::Spec->catdir(@basedir, $package, 'misc');
1527 $dirmap{'SCRIPT_DIR'} = File::Spec->catdir(@basedir, $package, 'bin');
1528 $dirmap{'SCRIPT_NONDEV_DIR'} = $dirmap{'SCRIPT_DIR'};
1529 $dirmap{'MAN_DIR'} = File::Spec->catdir(@basedir, $package, 'man');
1530 $dirmap{'DOC_DIR'} = File::Spec->catdir(@basedir, $package, 'doc');
1531 $dirmap{'ZEBRA_LOCK_DIR'} = File::Spec->catdir(File::Spec->rootdir(), 'var', 'lock', $package, 'zebradb');
1532 $dirmap{'LOCK_DIR'} = File::Spec->catdir(File::Spec->rootdir(), 'var', 'lock', $package);
1533 $dirmap{'LOG_DIR'} = File::Spec->catdir(File::Spec->rootdir(), 'var', 'log', $package);
1534 $dirmap{'BACKUP_DIR'} = File::Spec->catdir(File::Spec->rootdir(), 'var', 'spool', $package);
1535 $dirmap{'PLUGINS_DIR'} = File::Spec->catdir(File::Spec->rootdir(), 'var', 'lib', $package, 'plugins');
1536 $dirmap{'ZEBRA_DATA_DIR'} = File::Spec->catdir(File::Spec->rootdir(), 'var', 'lib', $package, 'zebradb');
1537 $dirmap{'ZEBRA_RUN_DIR'} = File::Spec->catdir(File::Spec->rootdir(), 'var', 'run', $package, 'zebradb');
1540 _get_env_overrides(\%dirmap);
1541 _get_argv_overrides(\%dirmap);
1542 _add_destdir(\%dirmap);
1544 return \%dirmap, \%skipdirs;
1549 Map a directory target to the corresponding path for
1557 my @basedir = (File::Spec->rel2abs(File::Spec->curdir()), 't', 'run');
1558 if (exists $test_suite_override_dirs{$dirname}) {
1559 return File::Spec->catdir(@basedir, @{ $test_suite_override_dirs{$dirname} });
1566 sub _get_env_overrides {
1569 foreach my $key (keys %$dirmap) {
1570 if (exists $ENV{$key}) {
1571 $dirmap->{$key} = $ENV{$key};
1572 print "Setting $key from environment\n";
1577 sub _get_argv_overrides {
1581 for (my $i = 0; $i <= $#ARGV; $i++) {
1582 if ($ARGV[$i] =~ /^([^=]+)=([^=]+)$/ and exists $dirmap->{$1}) {
1585 push @new_argv, $ARGV[$i];
1591 sub _strip_destdir {
1593 $dir =~ s/^\$\(DESTDIR\)//;
1600 foreach my $key (keys %$dirmap) {
1601 $dirmap->{$key} = '$(DESTDIR)'.$dirmap->{$key};
1605 sub display_configuration {
1608 my @version = grep /\/usr\/share\/perl\//, @INC;
1609 push @version, ('/usr/share/perl/5.10') if !$version[0];
1610 print "\n\nKoha will be installed with the following configuration parameters:\n\n";
1611 foreach my $key (sort keys %$config) {
1612 print sprintf("%-25.25s%s\n", $key, $config->{$key});
1615 print "\nand in the following directories:\n\n";
1616 foreach my $key (sort keys %$dirmap) {
1617 print sprintf("%-25.25s%s\n", $key, $dirmap->{$key});
1619 print "\n\nTo change any configuration setting, please run\n";
1620 print "perl Makefile.PL again. To override one of the target\n";
1621 print "directories, you can do so on the command line like this:\n";
1622 print "\nperl Makefile.PL PERL_MODULE_DIR=$version[0]\n\n";
1623 print "You can also set different default values for parameters\n";
1624 print "or override directory locations by using environment variables.\n";
1625 print "\nFor example:\n\n";
1626 print "export DB_USER=my_koha\n";
1627 print "perl Makefile.PL\n";
1629 print "DB_USER=my_koha DOC_DIR=/usr/local/info perl Makefile.PL\n\n";
1634 Attempt to find Zebra - check user's PATH and
1635 a few other directories for zebrasrv and zebraidx.
1640 my @search_dirs = map {
1641 my $abs = File::Spec->rel2abs($_);
1642 my ($toss, $directories);
1643 ($toss, $directories, $toss) = File::Spec->splitpath($abs, 1);
1645 } split /:/, $ENV{PATH};
1646 push @search_dirs, qw(/usr/local/bin /opt/local/bin /usr/bin);
1647 my @zebrasrv_dirs = grep { -x File::Spec->catpath('', $_, 'zebrasrv') } @search_dirs;
1648 return unless @zebrasrv_dirs;
1649 # verify that directory that contains zebrasrv also contains zebraidx
1650 foreach my $dir (@zebrasrv_dirs) {
1651 return $dir if -x File::Spec->catpath('', $dir, 'zebraidx');
1660 my $test = $self->SUPER::test(@_);
1661 $test =~ s!\$\(INST_LIB\)!blib/PERL_MODULE_DIR!g;
1664 $test =~ s!\$\(FULLPERLRUN\)!KOHA_CONF=blib/KOHA_CONF_DIR/koha-conf.xml \$(FULLPERLRUN)!g;
1671 # NOTE: we're *not* doing this: my $install = $self->SUPER::install(@_);
1672 # This means that we're completely overriding EU::MM's default
1673 # installation and uninstallation targets.
1675 my $perl5lib_dirs = _build_perl5lib_string({ target_dirs => $target_directories });
1677 # If installation is on Win32, we need to do permissions different from *nix
1678 if ( $^O =~ /darwin|linux|cygwin|freebsd|solaris/ ) { # this value needs to be verified for each platform and modified accordingly
1679 foreach my $key (sort keys %$target_directories) {
1681 KOHA_INST_$key = blib/$key
1682 KOHA_DEST_$key = $target_directories->{$key}
1683 ) unless exists $skip_directories->{$key};
1686 install :: all install_koha set_koha_ownership set_koha_permissions warn_koha_env_vars
1687 \t\$(NOECHO) \$(NOOP)
1689 $install .= "install_koha ::\n";
1690 $install .= "\t\$(NOECHO) umask 022; \$(MOD_INSTALL) \\\n";
1691 foreach my $key (sort keys %$target_directories) {
1692 $install .= "\t\t\$(KOHA_INST_$key) \$(KOHA_DEST_$key) \\\n"
1693 unless exists $skip_directories->{$key};
1695 $install .= "\t\t\$(INST_MAN1DIR) \$(DESTINSTALLMAN1DIR) \\\n";
1696 $install .= "\t\t\$(INST_MAN3DIR) \$(DESTINSTALLMAN3DIR)\n";
1699 $install .= "set_koha_ownership ::\n";
1700 # Do not try to change ownership if DESTDIR is set
1701 if ($config{'INSTALL_MODE'} eq 'standard' and $config{'KOHA_USER'} ne "root") {
1702 foreach my $key (sort keys %$target_directories) {
1703 $install .= "\t\$(NOECHO) if test -z \"\$(DESTDIR)\"; then chown -R $config{'KOHA_USER'}:$config{'KOHA_GROUP'} \$(KOHA_DEST_$key); fi\n"
1704 unless exists $skip_directories->{$key};
1707 $install .= "\t\t\$(NOECHO) \$(NOOP)\n\n";
1711 $install .= "set_koha_permissions ::\n";
1712 # This is necessary because EU::MM installs files
1713 # as either 0444 or 0555, and we want the owner
1714 # of Koha's files to have write permission by default.
1715 foreach my $key (sort keys %$target_directories) {
1716 $install .= "\t\$(NOECHO) chmod -R u+w \$(KOHA_DEST_$key)\n"
1717 unless exists $skip_directories->{$key};
1723 $install .= "warn_koha_env_vars ::\n";
1724 $install .= "\t\$(NOECHO) \$(ECHO)\n";
1725 $install .= "\t\$(NOECHO) \$(ECHO) Koha\\'s files have now been installed. \n";
1726 $install .= "\t\$(NOECHO) \$(ECHO)\n";
1727 $install .= "\t\$(NOECHO) \$(ECHO) In order to use Koha\\'s command-line batch jobs,\n";
1728 $install .= "\t\$(NOECHO) \$(ECHO) you should set the following environment variables:\n";
1729 $install .= "\t\$(NOECHO) \$(ECHO)\n";
1730 $install .= "\t\$(NOECHO) \$(ECHO) export KOHA_CONF=\$(KOHA_DEST_KOHA_CONF_DIR)/koha-conf.xml\n";
1731 $install .= "\t\$(NOECHO) \$(ECHO) export PERL5LIB=$perl5lib_dirs\n";
1732 $install .= "\t\$(NOECHO) \$(ECHO)\n";
1733 $install .= "\t\$(NOECHO) \$(ECHO) For other post-installation tasks, please consult the README.\n";
1734 $install .= "\t\$(NOECHO) \$(ECHO)\n";
1736 $install .= _update_zebra_conf_target();
1738 $install .= upgrade();
1743 =head2 _update_zebra_conf_target
1745 Add an installation target for updating
1746 Zebra's configuration files.
1750 sub _update_zebra_conf_target {
1752 my $target = "\nupdate_zebra_conf ::\n";
1753 $target .= "\tumask 022; \$(MOD_INSTALL) \\\n";
1754 $target .= "\t\t\$(KOHA_INST_ZEBRA_CONF_DIR) \$(KOHA_DEST_ZEBRA_CONF_DIR) \n";
1755 $target .= "\t\$(NOECHO) chmod -R u+w \$(KOHA_DEST_ZEBRA_CONF_DIR)\n";
1756 $target .= "\tumask 022; \$(MOD_INSTALL) \\\n";
1765 if (exists $install_log_values{'KOHA_INSTALLED_VERSION'}) {
1766 my $version = $install_log_values{'KOHA_INSTALLED_VERSION'};
1767 $version =~ s/\./_/g;
1768 $backup_suffix = "_koha_$version";
1770 $backup_suffix = "_upgrade_backup";
1774 MOD_BACKUP = \$(ABSPERLRUN) -MC4::Installer::UpgradeBackup -e 'backup_changed_files({\@ARGV}, '$backup_suffix', '\''\$(VERBINST)'\'', '\''\$(UNINST)'\'');' --
1776 upgrade :: make_upgrade_backup install
1777 \t\$(NOECHO) \$(NOOP)
1778 make_upgrade_backup ::
1779 \t\$(NOECHO) umask 022; \$(MOD_BACKUP) \\
1781 foreach my $key (qw/KOHA_CONF_DIR INTRANET_TMPL_DIR INTRANET_WWW_DIR OPAC_TMPL_DIR OPAC_WWW_DIR
1782 ZEBRA_CONF_DIR PLUGINS_DIR/) {
1783 $upgrade .= "\t\t\$(KOHA_INST_$key) \$(KOHA_DEST_$key) \\\n"
1784 unless exists $skip_directories->{$key} or
1785 not exists $target_directories->{$key};
1787 $upgrade =~ s/\\\n$/\n/;
1792 # put directory mappings into Makefile
1793 # so that Make will export as environment
1794 # variables -- this is for the use of
1799 #NOTE: Build __PERL5LIB_DIRS__ for rewrite-config.PL
1800 my $perl5lib_dirs = _build_perl5lib_string({ target_dirs => $target_directories });
1801 if ($perl5lib_dirs){
1802 $env .= "export __PERL5LIB_DIRS__ := $perl5lib_dirs\n"
1805 # Hereagain, we must alter syntax per platform...
1807 $env .= join("\n", map { "export __${_}__ := $target_directories->{$_}" } keys %$target_directories);
1809 $env .= join("\n", map { "export __${_}__ := $config{$_}" } keys %config);
1816 my $inherited = shift->SUPER::top_targets(@_);
1818 $compile_step .= "all :: compile_css_js\n";
1819 $compile_step .= "\t" . '$(NOECHO) $(NOOP)' . "\n";
1820 $compile_step .= "\n";
1821 $compile_step .= "compile_css_js:\n";
1822 $compile_step .= "\t" . '$(PERLRUN) build-resources.PL' . "\n";
1823 my $top_targets = $compile_step . "\n" . $inherited;
1824 return $top_targets;
1827 sub _build_perl5lib_string {
1829 my %unique_map = ();
1831 my $target_dirs = $args->{target_dirs};
1832 my @dir_codes = ("PERL_MODULE_DIR","PERL_MODULE_LIB_DIR");
1834 foreach my $code (@dir_codes){
1835 my $path = $target_dirs->{ $code };
1837 $unique_map{$path} = 1 unless $unique_map{$path};
1840 my @paths = sort keys %unique_map;
1842 $perl5lib_str = join(':',@paths);
1845 return $perl5lib_str;
1853 ExtUtils::MakeMaker(3)
1857 MJ Ray mjr at phonecoop.coop
1858 Galen Charlton galen.charlton at liblime.com
1862 FIXME: deal with .htaccess