View | Details | Raw Unified | Return to bug 39149
Collapse All | Expand All

(-)a/Makefile.PL (-503 / +591 lines)
Lines 25-31 use ExtUtils::MakeMaker; Link Here
25
use POSIX;
25
use POSIX;
26
use File::Spec;
26
use File::Spec;
27
use Getopt::Long qw/HelpMessage/;
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
28
use FindBin;    # we need to enforce which C4::Installer::PerlModule is used in case more than one is installed
29
29
30
use lib $FindBin::Bin;
30
use lib $FindBin::Bin;
31
31
Lines 34-45 use C4::Installer::PerlModules; Link Here
34
my $koha_pm = C4::Installer::PerlModules->new;
34
my $koha_pm = C4::Installer::PerlModules->new;
35
35
36
my $DEBUG = 0;
36
my $DEBUG = 0;
37
die "perl 5.10 or later required" unless ($] >= 5.010000);
37
die "perl 5.10 or later required" unless ( $] >= 5.010000 );
38
38
39
# Hash up directory structure & files beginning with the directory we were called from (should be the base of koha)...
39
# Hash up directory structure & files beginning with the directory we were called from (should be the base of koha)...
40
40
41
my $dirtree = hashdir('.');
41
my $dirtree = hashdir('.');
42
my %result = ();
42
my %result  = ();
43
43
44
=head1 NAME
44
=head1 NAME
45
45
Lines 392-411 my $target_map = { Link Here
392
    './virtualshelves'                                 => 'INTRANET_CGI_DIR',
392
    './virtualshelves'                                 => 'INTRANET_CGI_DIR',
393
393
394
    # ignore files and directories created by the install itself
394
    # ignore files and directories created by the install itself
395
    './pm_to_blib'      => 'NONE',
395
    './pm_to_blib'           => 'NONE',
396
    './blib'            => 'NONE',
396
    './blib'                 => 'NONE',
397
    '.git-blame-ignore-revs' => 'NONE',
397
    '.git-blame-ignore-revs' => 'NONE',
398
    '.prettierrc.js'    => 'NONE',
398
    '.prettierrc.js'         => 'NONE',
399
    '.sass-lint.yml'    => 'NONE',
399
    '.sass-lint.yml'         => 'NONE',
400
    '.scss-lint.yml'    => 'NONE',
400
    '.scss-lint.yml'         => 'NONE',
401
    'gulpfile.js'       => 'NONE',
401
    'gulpfile.js'            => 'NONE',
402
    'package.json'      => 'NONE',
402
    'package.json'           => 'NONE',
403
    'yarn.lock'         => 'NONE',
403
    'yarn.lock'              => 'NONE',
404
    'cypress.config.ts' => 'NONE',
404
    'cypress.config.ts'      => 'NONE',
405
    'tsconfig.json'     => 'NONE',
405
    'tsconfig.json'          => 'NONE',
406
    'webpack.config.js' => 'NONE',
406
    'webpack.config.js'      => 'NONE',
407
    'rspack.config.js'  => 'NONE',
407
    'rspack.config.js'       => 'NONE',
408
    'eslint.config.mjs' => 'NONE',
408
    'eslint.config.mjs'      => 'NONE',
409
};
409
};
410
410
411
=head1 CONFIGURATION OPTIONS
411
=head1 CONFIGURATION OPTIONS
Lines 511-555 Enable debug mode for SMTP (default: no) Link Here
511
511
512
# default configuration options
512
# default configuration options
513
my %config_defaults = (
513
my %config_defaults = (
514
  'DB_TYPE'           => 'mysql',
514
    'DB_TYPE'                    => 'mysql',
515
  'DB_HOST'           => 'localhost',
515
    'DB_HOST'                    => 'localhost',
516
  'DB_NAME'           => 'koha',
516
    'DB_NAME'                    => 'koha',
517
  'DB_USER'           => 'kohaadmin',
517
    'DB_USER'                    => 'kohaadmin',
518
  'DB_PASS'           => 'katikoan',
518
    'DB_PASS'                    => 'katikoan',
519
  'DB_USE_TLS'	      => 'no',
519
    'DB_USE_TLS'                 => 'no',
520
  'DB_TLS_CA_CERTIFICATE'  => '/etc/mysql-ssl/server-ca.pem',
520
    'DB_TLS_CA_CERTIFICATE'      => '/etc/mysql-ssl/server-ca.pem',
521
  'DB_TLS_CLIENT_CERTIFICATE'  => '/etc/mysql-ssl/client-cert.pem',
521
    'DB_TLS_CLIENT_CERTIFICATE'  => '/etc/mysql-ssl/client-cert.pem',
522
  'DB_TLS_CLIENT_KEY' => '/etc/mysql-ssl/client-key.pem',
522
    'DB_TLS_CLIENT_KEY'          => '/etc/mysql-ssl/client-key.pem',
523
  'INSTALL_SRU'       => 'yes',
523
    'INSTALL_SRU'                => 'yes',
524
  'ZEBRA_MARC_FORMAT' => 'marc21',
524
    'ZEBRA_MARC_FORMAT'          => 'marc21',
525
  'ZEBRA_LANGUAGE'    => 'en',
525
    'ZEBRA_LANGUAGE'             => 'en',
526
  'ZEBRA_TOKENIZER'   => 'chr',
526
    'ZEBRA_TOKENIZER'            => 'chr',
527
  'ZEBRA_USER'        => 'kohauser',
527
    'ZEBRA_USER'                 => 'kohauser',
528
  'ZEBRA_PASS'        => 'zebrastripes',
528
    'ZEBRA_PASS'                 => 'zebrastripes',
529
  'ZEBRA_SRU_HOST'    => 'localhost',
529
    'ZEBRA_SRU_HOST'             => 'localhost',
530
  'ZEBRA_SRU_BIBLIOS_PORT'    => '9998',
530
    'ZEBRA_SRU_BIBLIOS_PORT'     => '9998',
531
  'ZEBRA_SRU_AUTHORITIES_PORT'    => '9999',
531
    'ZEBRA_SRU_AUTHORITIES_PORT' => '9999',
532
  'KOHA_USER'         => 'koha',
532
    'KOHA_USER'                  => 'koha',
533
  'KOHA_GROUP'        => 'koha',
533
    'KOHA_GROUP'                 => 'koha',
534
  'MERGE_SERVER_HOST' => 'localhost',
534
    'MERGE_SERVER_HOST'          => 'localhost',
535
  'MERGE_SERVER_PORT' => '11001',
535
    'MERGE_SERVER_PORT'          => '11001',
536
  'RUN_DATABASE_TESTS' => 'no',
536
    'RUN_DATABASE_TESTS'         => 'no',
537
  'PATH_TO_ZEBRA' => '',
537
    'PATH_TO_ZEBRA'              => '',
538
  'USE_MEMCACHED'     => 'yes',
538
    'USE_MEMCACHED'              => 'yes',
539
  'MEMCACHED_SERVERS' => '127.0.0.1:11211',
539
    'MEMCACHED_SERVERS'          => '127.0.0.1:11211',
540
  'MEMCACHED_NAMESPACE' => 'KOHA',
540
    'MEMCACHED_NAMESPACE'        => 'KOHA',
541
  'TEMPLATE_CACHE_DIR' => '/tmp/koha',
541
    'TEMPLATE_CACHE_DIR'         => '/tmp/koha',
542
  'USE_ELASTICSEARCH'     => 'no',
542
    'USE_ELASTICSEARCH'          => 'no',
543
  'ELASTICSEARCH_SERVERS' => 'localhost:9200',
543
    'ELASTICSEARCH_SERVERS'      => 'localhost:9200',
544
  'ELASTICSEARCH_INDEX'  => 'koha',
544
    'ELASTICSEARCH_INDEX'        => 'koha',
545
  'FONT_DIR'          => '/usr/share/fonts/truetype/dejavu',
545
    'FONT_DIR'                   => '/usr/share/fonts/truetype/dejavu',
546
  'SMTP_HOST'      => 'localhost',
546
    'SMTP_HOST'                  => 'localhost',
547
  'SMTP_PORT'      => '25',
547
    'SMTP_PORT'                  => '25',
548
  'SMTP_TIMEOUT'   => '120',
548
    'SMTP_TIMEOUT'               => '120',
549
  'SMTP_SSL_MODE'  => 'disabled',
549
    'SMTP_SSL_MODE'              => 'disabled',
550
  'SMTP_USER_NAME' => '',
550
    'SMTP_USER_NAME'             => '',
551
  'SMTP_PASSWORD'  => '',
551
    'SMTP_PASSWORD'              => '',
552
  'SMTP_DEBUG'     => 'no',
552
    'SMTP_DEBUG'                 => 'no',
553
);
553
);
554
554
555
# set some default configuration options based on OS
555
# set some default configuration options based on OS
Lines 558-621 my %config_defaults = ( Link Here
558
warn "Your platform appears to be $^O.\n" if $DEBUG;
558
warn "Your platform appears to be $^O.\n" if $DEBUG;
559
559
560
if ( $^O eq 'cygwin' ) {
560
if ( $^O eq 'cygwin' ) {
561
	# Most Unix2Win32 ports seem to poke everything into the Program Files directory
561
562
	# this could be changed to put some files (ie. libraries) into system32, etc.
562
    # Most Unix2Win32 ports seem to poke everything into the Program Files directory
563
	$config_defaults{'INSTALL_MODE'} = 'single';
563
    # this could be changed to put some files (ie. libraries) into system32, etc.
564
	$config_defaults{'INSTALL_BASE'} = 'c:/progra~1/koha';	# Use 8.3 names to be safe...
564
    $config_defaults{'INSTALL_MODE'} = 'single';
565
}
565
    $config_defaults{'INSTALL_BASE'} = 'c:/progra~1/koha';    # Use 8.3 names to be safe...
566
else {
566
} else {
567
	$config_defaults{'INSTALL_MODE'} = 'standard';
567
    $config_defaults{'INSTALL_MODE'} = 'standard';
568
	$config_defaults{'INSTALL_BASE'} = '/usr/share/koha';
568
    $config_defaults{'INSTALL_BASE'} = '/usr/share/koha';
569
}
569
}
570
570
571
# valid values for certain configuration options
571
# valid values for certain configuration options
572
my %valid_config_values = (
572
my %valid_config_values = (
573
  'INSTALL_MODE'  => { 'standard' => 1, 'single' => 1, 'dev' => 1 },
573
    'INSTALL_MODE'      => { 'standard' => 1, 'single' => 1, 'dev' => 1 },
574
  'DB_TYPE' => { 'mysql' => 1, 'Pg' => 1 },
574
    'DB_TYPE'           => { 'mysql'    => 1, 'Pg'     => 1 },
575
  'DB_USE_TLS' => {'yes', 'no'},
575
    'DB_USE_TLS'        => { 'yes', 'no' },
576
  'INSTALL_SRU' => { 'yes' => 1, 'no' => 1 },
576
    'INSTALL_SRU'       => { 'yes'    => 1, 'no'      => 1 },
577
  'ZEBRA_MARC_FORMAT' => { 'marc21' => 1, 'unimarc' => 1 }, # FIXME should generate from contents of distributation
577
    'ZEBRA_MARC_FORMAT' => { 'marc21' => 1, 'unimarc' => 1 },    # FIXME should generate from contents of distributation
578
  '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
578
    'ZEBRA_LANGUAGE'    => { 'cs' => 1, 'el' => 1, 'en' => 1, 'es' => 1, 'fr' => 1, 'nb' => 1, 'ru' => 1, 'uk' => 1 }
579
  'ZEBRA_TOKENIZER' => { chr => 1, icu => 1 },
579
    ,                                                            # FIXME should generate from contents of distribution
580
  'RUN_DATABASE_TESTS' => { 'yes' => 1, 'no' => 1 },
580
    'ZEBRA_TOKENIZER'    => { chr        => 1, icu   => 1 },
581
  'USE_MEMCACHED'      => { 'yes' => 1, 'no' => 1 },
581
    'RUN_DATABASE_TESTS' => { 'yes'      => 1, 'no'  => 1 },
582
  'USE_ELASTICSEARCH'  => { 'yes' => 1, 'no' => 1 },
582
    'USE_MEMCACHED'      => { 'yes'      => 1, 'no'  => 1 },
583
  'SMTP_SSL_MODE'      => { 'disabled' => 1, 'ssl' => 1, 'starttls' => 1 },
583
    'USE_ELASTICSEARCH'  => { 'yes'      => 1, 'no'  => 1 },
584
  'SMTP_DEBUG'         => { 'yes' => 1, 'no' => 1 },
584
    'SMTP_SSL_MODE'      => { 'disabled' => 1, 'ssl' => 1, 'starttls' => 1 },
585
    'SMTP_DEBUG'         => { 'yes'      => 1, 'no'  => 1 },
585
);
586
);
586
587
587
# get settings from command-line
588
# get settings from command-line
588
my $koha_install_log = "";
589
my $koha_install_log      = "";
589
my $cli_koha_install_mode = "";
590
my $cli_koha_install_mode = "";
590
my $cli_koha_db_type = "";
591
my $cli_koha_db_type      = "";
591
my $cli_koha_db_host = "";
592
my $cli_koha_db_host      = "";
592
my $cli_koha_db_port = "";
593
my $cli_koha_db_port      = "";
593
my $cli_koha_db_name = "";
594
my $cli_koha_db_name      = "";
594
my $cli_koha_db_user = "";
595
my $cli_koha_db_user      = "";
595
my $cli_koha_db_pass = "";
596
my $cli_koha_db_pass      = "";
596
my $cli_zebra_marc_format = "";
597
my $cli_zebra_marc_format = "";
597
my $cli_zebra_language = "",
598
my $cli_zebra_language    = "",
598
my $cli_zebra_tokenizer = "";
599
    my $cli_zebra_tokenizer = "";
599
my $cli_zebra_user = "";
600
my $cli_zebra_user              = "";
600
my $cli_zebra_pass = "";
601
my $cli_zebra_pass              = "";
601
my $cli_zebra_sru_host = "";
602
my $cli_zebra_sru_host          = "";
602
my $cli_zebra_sru_bib_port = "";
603
my $cli_zebra_sru_bib_port      = "";
603
my $cli_zebra_sru_auth_port = "";
604
my $cli_zebra_sru_auth_port     = "";
604
my $cli_koha_user = "";
605
my $cli_koha_user               = "";
605
my $cli_koha_group = "";
606
my $cli_koha_group              = "";
606
my $cli_koha_install_sru = "";
607
my $cli_koha_install_sru        = "";
607
my $cli_koha_use_memcached = "";
608
my $cli_koha_use_memcached      = "";
608
my $cli_koha_font_dir = "";
609
my $cli_koha_font_dir           = "";
609
my $cli_koha_run_database_tests = "";
610
my $cli_koha_run_database_tests = "";
610
my $cli_koha_install_base = "";
611
my $cli_koha_install_base       = "";
611
my $cli_koha_template_cache_dir = "";
612
my $cli_koha_template_cache_dir = "";
612
my $cli_smtp_host      = "";
613
my $cli_smtp_host               = "";
613
my $cli_smtp_port      = "";
614
my $cli_smtp_port               = "";
614
my $cli_smtp_timeout   = "";
615
my $cli_smtp_timeout            = "";
615
my $cli_smtp_ssl_mode  = "";
616
my $cli_smtp_ssl_mode           = "";
616
my $cli_smtp_user_name = "";
617
my $cli_smtp_user_name          = "";
617
my $cli_smtp_password  = "";
618
my $cli_smtp_password           = "";
618
my $cli_smtp_debug     = "";
619
my $cli_smtp_debug              = "";
619
620
620
Getopt::Long::Configure('pass_through');
621
Getopt::Long::Configure('pass_through');
621
my $results = GetOptions(
622
my $results = GetOptions(
Lines 654-704 my $results = GetOptions( Link Here
654
) or HelpMessage(1);
655
) or HelpMessage(1);
655
656
656
my %install_log_values = ();
657
my %install_log_values = ();
657
if ($koha_install_log ne "") {
658
if ( $koha_install_log ne "" ) {
658
    get_install_log_values($koha_install_log, \%install_log_values);
659
    get_install_log_values( $koha_install_log, \%install_log_values );
659
} else {
660
} else {
661
660
    # Try to set install_log_values for provided values;
662
    # Try to set install_log_values for provided values;
661
    get_cli_values(\%install_log_values);
663
    get_cli_values( \%install_log_values );
662
}
664
}
663
665
664
my %config = get_configuration(\%config_defaults, \%valid_config_values, \%install_log_values);
666
my %config = get_configuration( \%config_defaults, \%valid_config_values, \%install_log_values );
665
my ($target_directories, $skip_directories) = get_target_directories(\%config);
667
my ( $target_directories, $skip_directories ) = get_target_directories( \%config );
666
display_configuration(\%config, $target_directories);
668
display_configuration( \%config, $target_directories );
667
my $file_map = {};
669
my $file_map = {};
668
get_file_map($target_map, $dirtree, $file_map);
670
get_file_map( $target_map, $dirtree, $file_map );
669
671
670
#NOTE: List files generated by build-resources.PL, so that they're copied into blib for installation
672
#NOTE: List files generated by build-resources.PL, so that they're copied into blib for installation
671
#INTRANET_TMPL_DIR
673
#INTRANET_TMPL_DIR
672
$file_map->{'koha-tmpl/intranet-tmpl/prog/css/calendar.css'} = 'blib/INTRANET_TMPL_DIR/prog/css/calendar.css';
674
$file_map->{'koha-tmpl/intranet-tmpl/prog/css/calendar.css'}     = 'blib/INTRANET_TMPL_DIR/prog/css/calendar.css';
673
$file_map->{'koha-tmpl/intranet-tmpl/prog/css/holds.css'} = 'blib/INTRANET_TMPL_DIR/prog/css/holds.css';
675
$file_map->{'koha-tmpl/intranet-tmpl/prog/css/holds.css'}        = 'blib/INTRANET_TMPL_DIR/prog/css/holds.css';
674
$file_map->{'koha-tmpl/intranet-tmpl/prog/css/installer.css'} = 'blib/INTRANET_TMPL_DIR/prog/css/installer.css';
676
$file_map->{'koha-tmpl/intranet-tmpl/prog/css/installer.css'}    = 'blib/INTRANET_TMPL_DIR/prog/css/installer.css';
675
$file_map->{'koha-tmpl/intranet-tmpl/prog/css/mainpage.css'} = 'blib/INTRANET_TMPL_DIR/prog/css/mainpage.css';
677
$file_map->{'koha-tmpl/intranet-tmpl/prog/css/mainpage.css'}     = 'blib/INTRANET_TMPL_DIR/prog/css/mainpage.css';
676
$file_map->{'koha-tmpl/intranet-tmpl/prog/css/staff-global.css'} = 'blib/INTRANET_TMPL_DIR/prog/css/staff-global.css';
678
$file_map->{'koha-tmpl/intranet-tmpl/prog/css/staff-global.css'} = 'blib/INTRANET_TMPL_DIR/prog/css/staff-global.css';
677
$file_map->{'koha-tmpl/intranet-tmpl/prog/js/vue/dist/erm.js'} = 'blib/INTRANET_TMPL_DIR/prog/js/vue/dist/erm.js';
679
$file_map->{'koha-tmpl/intranet-tmpl/prog/js/vue/dist/erm.js'}   = 'blib/INTRANET_TMPL_DIR/prog/js/vue/dist/erm.js';
678
$file_map->{'koha-tmpl/intranet-tmpl/prog/js/vue/dist/preservation.js'} = 'blib/INTRANET_TMPL_DIR/prog/js/vue/dist/preservation.js';
680
$file_map->{'koha-tmpl/intranet-tmpl/prog/js/vue/dist/preservation.js'} =
679
$file_map->{'koha-tmpl/intranet-tmpl/prog/js/vue/dist/admin/record_sources.js'} = 'blib/INTRANET_TMPL_DIR/prog/js/vue/dist/admin/record_sources.js';
681
    'blib/INTRANET_TMPL_DIR/prog/js/vue/dist/preservation.js';
682
$file_map->{'koha-tmpl/intranet-tmpl/prog/js/vue/dist/admin/record_sources.js'} =
683
    'blib/INTRANET_TMPL_DIR/prog/js/vue/dist/admin/record_sources.js';
684
680
#OPAC_TMPL_DIR
685
#OPAC_TMPL_DIR
681
$file_map->{'koha-tmpl/opac-tmpl/bootstrap/css/opac.css'} = 'blib/OPAC_TMPL_DIR/bootstrap/css/opac.css';
686
$file_map->{'koha-tmpl/opac-tmpl/bootstrap/css/opac.css'}      = 'blib/OPAC_TMPL_DIR/bootstrap/css/opac.css';
682
$file_map->{'koha-tmpl/opac-tmpl/bootstrap/css/opac-rtl.css'} = 'blib/OPAC_TMPL_DIR/bootstrap/css/opac-rtl.css';
687
$file_map->{'koha-tmpl/opac-tmpl/bootstrap/css/opac-rtl.css'}  = 'blib/OPAC_TMPL_DIR/bootstrap/css/opac-rtl.css';
683
$file_map->{'koha-tmpl/opac-tmpl/bootstrap/css/print.css'} = 'blib/OPAC_TMPL_DIR/bootstrap/css/print.css';
688
$file_map->{'koha-tmpl/opac-tmpl/bootstrap/css/print.css'}     = 'blib/OPAC_TMPL_DIR/bootstrap/css/print.css';
684
$file_map->{'koha-tmpl/opac-tmpl/bootstrap/css/print-rtl.css'} = 'blib/OPAC_TMPL_DIR/bootstrap/css/print-rtl.css';
689
$file_map->{'koha-tmpl/opac-tmpl/bootstrap/css/print-rtl.css'} = 'blib/OPAC_TMPL_DIR/bootstrap/css/print-rtl.css';
685
$file_map->{'koha-tmpl/opac-tmpl/bootstrap/css/sco.css'} = 'blib/OPAC_TMPL_DIR/bootstrap/css/sco.css';
690
$file_map->{'koha-tmpl/opac-tmpl/bootstrap/css/sco.css'}       = 'blib/OPAC_TMPL_DIR/bootstrap/css/sco.css';
686
$file_map->{'koha-tmpl/opac-tmpl/bootstrap/css/sco-rtl.css'} = 'blib/OPAC_TMPL_DIR/bootstrap/css/sco-rtl.css';
691
$file_map->{'koha-tmpl/opac-tmpl/bootstrap/css/sco-rtl.css'}   = 'blib/OPAC_TMPL_DIR/bootstrap/css/sco-rtl.css';
692
687
#API_CGI_DIR
693
#API_CGI_DIR
688
$file_map->{'api/v1/swagger/swagger_bundle.json'} = 'blib/API_CGI_DIR/v1/swagger/swagger_bundle.json';
694
$file_map->{'api/v1/swagger/swagger_bundle.json'} = 'blib/API_CGI_DIR/v1/swagger/swagger_bundle.json';
689
695
690
my $pl_files = {
696
my $pl_files = {
691
      'rewrite-config.PL' => [
697
    'rewrite-config.PL' => [
692
         'blib/KOHA_CONF_DIR/koha-conf.xml',
698
        'blib/KOHA_CONF_DIR/koha-conf.xml',
693
         'blib/KOHA_CONF_DIR/koha-httpd.conf',
699
        'blib/KOHA_CONF_DIR/koha-httpd.conf',
694
         'blib/KOHA_CONF_DIR/log4perl.conf',
700
        'blib/KOHA_CONF_DIR/log4perl.conf',
695
         'blib/KOHA_CONF_DIR/koha-worker.service',
701
        'blib/KOHA_CONF_DIR/koha-worker.service',
696
         'blib/ZEBRA_CONF_DIR/etc/default.idx',
702
        'blib/ZEBRA_CONF_DIR/etc/default.idx',
697
         'blib/MISC_DIR/koha-install-log'
703
        'blib/MISC_DIR/koha-install-log'
698
         ],
704
    ],
699
	  'fix-perl-path.PL' => [	# this script ensures the correct shebang line for the platform installed on...
705
    'fix-perl-path.PL' => [    # this script ensures the correct shebang line for the platform installed on...
700
		 'blib'
706
        'blib'
701
		 ],
707
    ],
702
};
708
};
703
709
704
push @{ $pl_files->{'rewrite-config.PL'} }, (
710
push @{ $pl_files->{'rewrite-config.PL'} }, (
Lines 713-768 push @{ $pl_files->{'rewrite-config.PL'} }, ( Link Here
713
push @{ $pl_files->{'rewrite-config.PL'} }, (
719
push @{ $pl_files->{'rewrite-config.PL'} }, (
714
    'blib/SCRIPT_DIR/koha-zebra-ctl.sh',
720
    'blib/SCRIPT_DIR/koha-zebra-ctl.sh',
715
);
721
);
716
$config{'ZEBRA_AUTH_CFG'} = 'zebra-authorities-dom.cfg';
722
$config{'ZEBRA_AUTH_CFG'}     = 'zebra-authorities-dom.cfg';
717
$config{'ZEBRA_BIB_CFG'}  = 'zebra-biblios-dom.cfg';
723
$config{'ZEBRA_BIB_CFG'}      = 'zebra-biblios-dom.cfg';
718
$config{'AUTH_RETRIEVAL_CFG'} = 'retrieval-info-auth-dom.xml';
724
$config{'AUTH_RETRIEVAL_CFG'} = 'retrieval-info-auth-dom.xml';
719
$config{'BIB_RETRIEVAL_CFG'}  = 'retrieval-info-bib-dom.xml';
725
$config{'BIB_RETRIEVAL_CFG'}  = 'retrieval-info-bib-dom.xml';
720
726
721
if ($config{'INSTALL_MODE'} ne "dev") {
727
if ( $config{'INSTALL_MODE'} ne "dev" ) {
722
    push @{ $pl_files->{'rewrite-config.PL'} }, (
728
    push @{ $pl_files->{'rewrite-config.PL'} }, (
723
        'blib/PERL_MODULE_DIR/C4/Context.pm',
729
        'blib/PERL_MODULE_DIR/C4/Context.pm',
724
    );
730
    );
725
}
731
}
726
732
727
$config{ZEBRA_TOKENIZER_STMT} = $config{ZEBRA_TOKENIZER} eq 'icu'
733
$config{ZEBRA_TOKENIZER_STMT} =
734
    $config{ZEBRA_TOKENIZER} eq 'icu'
728
    ? 'icuchain words-icu.xml'
735
    ? 'icuchain words-icu.xml'
729
    : 'charmap word-phrase-utf.chr';
736
    : 'charmap word-phrase-utf.chr';
730
737
731
$config{ZEBRA_PTOKENIZER_STMT} = $config{ZEBRA_TOKENIZER} eq 'icu'
738
$config{ZEBRA_PTOKENIZER_STMT} =
739
    $config{ZEBRA_TOKENIZER} eq 'icu'
732
    ? 'icuchain phrases-icu.xml'
740
    ? 'icuchain phrases-icu.xml'
733
    : 'charmap word-phrase-utf.chr';
741
    : 'charmap word-phrase-utf.chr';
734
742
735
my %test_suite_override_dirs = (
743
my %test_suite_override_dirs = (
736
    KOHA_CONF_DIR  => ['etc'],
744
    KOHA_CONF_DIR  => ['etc'],
737
    ZEBRA_CONF_DIR => ['etc', 'zebradb'],
745
    ZEBRA_CONF_DIR => [ 'etc', 'zebradb' ],
738
    Z3950_CONF_DIR => ['etc', 'z3950'],
746
    Z3950_CONF_DIR => [ 'etc', 'z3950' ],
739
    LOCK_DIR       => ['var', 'lock'],
747
    LOCK_DIR       => [ 'var', 'lock' ],
740
    LOG_DIR        => ['var', 'log'],
748
    LOG_DIR        => [ 'var', 'log' ],
741
    BACKUP_DIR     => ['var', 'spool'],
749
    BACKUP_DIR     => [ 'var', 'spool' ],
742
    SCRIPT_DIR     => ['bin'],
750
    SCRIPT_DIR     => ['bin'],
743
    ZEBRA_LOCK_DIR => ['var', 'lock', 'zebradb'],
751
    ZEBRA_LOCK_DIR => [ 'var', 'lock', 'zebradb' ],
744
    ZEBRA_DATA_DIR => ['var', 'lib', 'zebradb'],
752
    ZEBRA_DATA_DIR => [ 'var', 'lib',  'zebradb' ],
745
    ZEBRA_RUN_DIR  => ['var', 'run', 'zebradb'],
753
    ZEBRA_RUN_DIR  => [ 'var', 'run',  'zebradb' ],
746
);
754
);
747
755
748
WriteMakefile(
756
WriteMakefile(
749
              NAME         => 'koha',
757
    NAME => 'koha',
750
              #VERSION     => strftime('2.9.%Y%m%d%H',gmtime),
758
751
              VERSION_FROM => 'kohaversion.pl',
759
    #VERSION     => strftime('2.9.%Y%m%d%H',gmtime),
752
              ABSTRACT     => 'Award-winning integrated library system (ILS) and Web OPAC',
760
    VERSION_FROM => 'kohaversion.pl',
753
              AUTHOR       => 'Koha Contributors <https://koha-community.org/>',
761
    ABSTRACT     => 'Award-winning integrated library system (ILS) and Web OPAC',
754
              NO_META      => 1,
762
    AUTHOR       => 'Koha Contributors <https://koha-community.org/>',
755
              PREREQ_PM    => $koha_pm->prereq_pm,
763
    NO_META      => 1,
756
764
    PREREQ_PM    => $koha_pm->prereq_pm,
757
              # File tree mapping
765
758
              PM => $file_map,
766
    # File tree mapping
759
767
    PM => $file_map,
760
              # Man pages generated from POD
768
761
	      # ExtUtils::MakeMaker already manage $(DESTDIR)
769
    # Man pages generated from POD
762
              INSTALLMAN1DIR => File::Spec->catdir(_strip_destdir($target_directories->{'MAN_DIR'}), 'man1'),
770
    # ExtUtils::MakeMaker already manage $(DESTDIR)
763
              INSTALLMAN3DIR => File::Spec->catdir(_strip_destdir($target_directories->{'MAN_DIR'}), 'man3'),
771
    INSTALLMAN1DIR => File::Spec->catdir( _strip_destdir( $target_directories->{'MAN_DIR'} ), 'man1' ),
764
772
    INSTALLMAN3DIR => File::Spec->catdir( _strip_destdir( $target_directories->{'MAN_DIR'} ), 'man3' ),
765
              PL_FILES => $pl_files,
773
774
    PL_FILES => $pl_files,
766
);
775
);
767
776
768
=head1 FUNCTIONS
777
=head1 FUNCTIONS
Lines 775-789 This directory hashing routine was taken from BrowserUK @ http://www.perlmonks.o Link Here
775
784
776
=cut
785
=cut
777
786
778
sub hashdir{
787
sub hashdir {
779
    my $dir = shift;
788
    my $dir = shift;
780
    opendir my $dh, $dir or die $!;
789
    opendir my $dh, $dir or die $!;
781
    my $tree = {}->{$dir} = {};
790
    my $tree = {}->{$dir} = {};
782
    while( my $file = readdir($dh) ) {
791
    while ( my $file = readdir($dh) ) {
783
        next if $file =~ m/^\.{1,2}/ and $file !~ /^\.htaccess/; # .htaccess is a special case
792
        next if $file =~ m/^\.{1,2}/ and $file !~ /^\.htaccess/;    # .htaccess is a special case
784
        my $path = $dir .'/' . $file;
793
        my $path = $dir . '/' . $file;
785
        $tree->{$file} = hashdir($path), next if -d $path;
794
        $tree->{$file} = hashdir($path), next if -d $path;
786
        push @{$tree->{'.'}}, $file;
795
        push @{ $tree->{'.'} }, $file;
787
    }
796
    }
788
    return $tree;
797
    return $tree;
789
}
798
}
Lines 803-862 to its destination value, like this: Link Here
803
812
804
sub get_file_map {
813
sub get_file_map {
805
    my $target_map = shift;
814
    my $target_map = shift;
806
    my $dirtree = shift;
815
    my $dirtree    = shift;
807
    my $file_map = shift;
816
    my $file_map   = shift;
808
    my $curr_path = @_ ? shift : ['.'];
817
    my $curr_path  = @_ ? shift : ['.'];
809
818
810
    # Traverse the directory tree.
819
    # Traverse the directory tree.
811
    # For each file or directory, identify the
820
    # For each file or directory, identify the
812
    # most specific match in the target_map
821
    # most specific match in the target_map
813
    foreach my $dir (sort keys %{ $dirtree }) {
822
    foreach my $dir ( sort keys %{$dirtree} ) {
814
        if ($dir eq '.') {
823
        if ( $dir eq '.' ) {
824
815
            # deal with files in directory
825
            # deal with files in directory
816
            foreach my $file (sort @{ $dirtree->{$dir} }) {
826
            foreach my $file ( sort @{ $dirtree->{$dir} } ) {
817
                my $targetdir = undef;
827
                my $targetdir  = undef;
818
                my $matchlevel = undef;
828
                my $matchlevel = undef;
829
819
                # first, see if there is a match on this specific
830
                # first, see if there is a match on this specific
820
                # file in the target map
831
                # file in the target map
821
                my $filepath = join("/", @$curr_path, $file);
832
                my $filepath = join( "/", @$curr_path, $file );
822
                if (exists $target_map->{$filepath}) {
833
                if ( exists $target_map->{$filepath} ) {
823
                    $targetdir = $target_map->{$filepath};
834
                    $targetdir  = $target_map->{$filepath};
824
                    $matchlevel = scalar(@$curr_path) + 1;
835
                    $matchlevel = scalar(@$curr_path) + 1;
825
                } else {
836
                } else {
837
826
                    # no match on the specific file; look for
838
                    # no match on the specific file; look for
827
                    # a directory match
839
                    # a directory match
828
                    for (my $i = scalar(@$curr_path) - 1; $i >= 0; $i--)  {
840
                    for ( my $i = scalar(@$curr_path) - 1 ; $i >= 0 ; $i-- ) {
829
                        my $dirpath = join("/", @$curr_path[0..$i]);
841
                        my $dirpath = join( "/", @$curr_path[ 0 .. $i ] );
830
                        if (exists $target_map->{$dirpath}) {
842
                        if ( exists $target_map->{$dirpath} ) {
831
                            $targetdir = $target_map->{$dirpath};
843
                            $targetdir  = $target_map->{$dirpath};
832
                            $matchlevel = $i + 1;
844
                            $matchlevel = $i + 1;
833
                            last;
845
                            last;
834
                        }
846
                        }
835
                    }
847
                    }
836
                }
848
                }
837
                if (defined $targetdir) {
849
                if ( defined $targetdir ) {
838
                     _add_to_file_map($file_map, $targetdir, $curr_path, $file, $matchlevel);
850
                    _add_to_file_map( $file_map, $targetdir, $curr_path, $file, $matchlevel );
839
                } else {
851
                } else {
840
                    my $path = join("/", @$curr_path);
852
                    my $path = join( "/", @$curr_path );
841
                    print "failed to map: $path/$file\n" if $DEBUG;
853
                    print "failed to map: $path/$file\n" if $DEBUG;
842
                }
854
                }
843
            }
855
            }
844
        } else {
856
        } else {
857
845
            # dealing with subdirectory
858
            # dealing with subdirectory
846
            push @$curr_path, $dir;
859
            push @$curr_path, $dir;
847
            get_file_map($target_map, $dirtree->{$dir}, $file_map, $curr_path);
860
            get_file_map( $target_map, $dirtree->{$dir}, $file_map, $curr_path );
848
            pop @$curr_path;
861
            pop @$curr_path;
849
        }
862
        }
850
    }
863
    }
851
}
864
}
852
865
853
sub _add_to_file_map {
866
sub _add_to_file_map {
854
    my $file_map = shift;
867
    my $file_map   = shift;
855
    my $targetdir = shift;
868
    my $targetdir  = shift;
856
    my $curr_path = shift;
869
    my $curr_path  = shift;
857
    my $file = shift;
870
    my $file       = shift;
858
    my $matchlevel = shift;
871
    my $matchlevel = shift;
859
    my $dest_path = @_ ? shift : $curr_path;
872
    my $dest_path  = @_ ? shift : $curr_path;
860
873
861
    # The target can be one of the following:
874
    # The target can be one of the following:
862
    # 1. scalar representing target symbol
875
    # 1. scalar representing target symbol
Lines 865-873 sub _add_to_file_map { Link Here
865
    # Consequently, this routine traverses this structure,
878
    # Consequently, this routine traverses this structure,
866
    # calling itself recursively, until it deals with
879
    # calling itself recursively, until it deals with
867
    # all of the scalar target symbols.
880
    # all of the scalar target symbols.
868
    if (ref $targetdir eq 'HASH') {
881
    if ( ref $targetdir eq 'HASH' ) {
869
        my $subtarget = $targetdir->{target};
882
        my $subtarget = $targetdir->{target};
870
        if (exists $targetdir->{trimdir}) {
883
        if ( exists $targetdir->{trimdir} ) {
884
871
            # if we get here, we've specified that
885
            # if we get here, we've specified that
872
            # rather than installing the file to
886
            # rather than installing the file to
873
            # $(TARGET)/matching/dirs/subdirs/file,
887
            # $(TARGET)/matching/dirs/subdirs/file,
Lines 877-904 sub _add_to_file_map { Link Here
877
            # Note that this the only place where
891
            # Note that this the only place where
878
            # $matchlevel is used.
892
            # $matchlevel is used.
879
            my @new_dest_path = @$dest_path;
893
            my @new_dest_path = @$dest_path;
880
            if ($targetdir->{trimdir} == -1)  {
894
            if ( $targetdir->{trimdir} == -1 ) {
881
                splice @new_dest_path, 0, $matchlevel;
895
                splice @new_dest_path, 0, $matchlevel;
882
            } else {
896
            } else {
883
                splice @new_dest_path, 0, $targetdir->{trimdir};
897
                splice @new_dest_path, 0, $targetdir->{trimdir};
884
            }
898
            }
885
            _add_to_file_map($file_map, $subtarget, $curr_path, $file, $matchlevel, \@new_dest_path);
899
            _add_to_file_map( $file_map, $subtarget, $curr_path, $file, $matchlevel, \@new_dest_path );
886
        } else {
900
        } else {
901
887
            # actually getting here means that the
902
            # actually getting here means that the
888
            # target was unnecessarily listed
903
            # target was unnecessarily listed
889
            # as a hash, but we'll forgive that
904
            # as a hash, but we'll forgive that
890
            _add_to_file_map($file_map, $subtarget, $curr_path, $file, $matchlevel);
905
            _add_to_file_map( $file_map, $subtarget, $curr_path, $file, $matchlevel );
891
        }
906
        }
892
    } elsif ($targetdir ne 'NONE' and $targetdir ne '') {
907
    } elsif ( $targetdir ne 'NONE' and $targetdir ne '' ) {
893
        my $source = File::Spec->catfile(@$curr_path, $file);
908
        my $source      = File::Spec->catfile( @$curr_path, $file );
894
        my $destination = File::Spec->catfile('blib', $targetdir, @$dest_path, $file);
909
        my $destination = File::Spec->catfile( 'blib', $targetdir, @$dest_path, $file );
910
895
        #print "$source => $destination\n"; # DEBUG
911
        #print "$source => $destination\n"; # DEBUG
896
        # quote spaces in file names
912
        # quote spaces in file names
897
        # FIXME: this is of questionable portability and
913
        # FIXME: this is of questionable portability and
898
        # probably depends on user's make recognizing this
914
        # probably depends on user's make recognizing this
899
        # quoting syntax -- probably better to remove
915
        # quoting syntax -- probably better to remove
900
        # spaces and shell metacharacters from all file names
916
        # spaces and shell metacharacters from all file names
901
        $source =~ s/ /\\ /g;
917
        $source      =~ s/ /\\ /g;
902
        $destination =~ s/ /\\ /g;
918
        $destination =~ s/ /\\ /g;
903
919
904
        $file_map->{$source} = $destination;
920
        $file_map->{$source} = $destination;
Lines 913-919 Reads values provided on cli for configuration values Link Here
913
929
914
sub get_cli_values {
930
sub get_cli_values {
915
    my $values = shift;
931
    my $values = shift;
916
    my $map = {
932
    my $map    = {
917
        INSTALL_MODE               => $cli_koha_install_mode,
933
        INSTALL_MODE               => $cli_koha_install_mode,
918
        DB_TYPE                    => $cli_koha_db_type,
934
        DB_TYPE                    => $cli_koha_db_type,
919
        DB_HOST                    => $cli_koha_db_host,
935
        DB_HOST                    => $cli_koha_db_host,
Lines 943-952 sub get_cli_values { Link Here
943
        SMTP_SSL_MODE              => $cli_smtp_ssl_mode,
959
        SMTP_SSL_MODE              => $cli_smtp_ssl_mode,
944
        SMTP_USER_NAME             => $cli_smtp_user_name,
960
        SMTP_USER_NAME             => $cli_smtp_user_name,
945
        SMTP_PASSWORD              => $cli_smtp_password,
961
        SMTP_PASSWORD              => $cli_smtp_password,
946
        SMTP_DEBUG                 => (defined $cli_smtp_debug) ? ( $cli_smtp_debug ? 'yes' : 'no' ) : $values->{SMTP_DEBUG},
962
        SMTP_DEBUG => ( defined $cli_smtp_debug ) ? ( $cli_smtp_debug ? 'yes' : 'no' ) : $values->{SMTP_DEBUG},
947
    };
963
    };
948
    foreach my $key (keys %{$map}) {
964
    foreach my $key ( keys %{$map} ) {
949
        $values->{$key} = $map->{$key} if ($map->{$key});
965
        $values->{$key} = $map->{$key} if ( $map->{$key} );
950
    }
966
    }
951
}
967
}
952
968
Lines 959-965 Reads value from the Koha install log specified by Link Here
959
975
960
sub get_install_log_values {
976
sub get_install_log_values {
961
    my $install_log = shift;
977
    my $install_log = shift;
962
    my $values = shift;
978
    my $values      = shift;
963
979
964
    open my $log, '<', $install_log or die "Cannot open install log $install_log: $!\n";
980
    open my $log, '<', $install_log or die "Cannot open install log $install_log: $!\n";
965
    while (<$log>) {
981
    while (<$log>) {
Lines 968-974 sub get_install_log_values { Link Here
968
        next if /^=/;
984
        next if /^=/;
969
        next unless m/=/;
985
        next unless m/=/;
970
        s/\s+$//g;
986
        s/\s+$//g;
971
        my ($key, $value) = split /=/, $_, 2;
987
        my ( $key, $value ) = split /=/, $_, 2;
972
        $values->{$key} = $value;
988
        $values->{$key} = $value;
973
    }
989
    }
974
    close $log;
990
    close $log;
Lines 989-1000 This prompts the user for various configuration options. Link Here
989
=cut
1005
=cut
990
1006
991
sub get_configuration {
1007
sub get_configuration {
992
  my $defaults = shift;
1008
    my $defaults           = shift;
993
  my $valid_values = shift;
1009
    my $valid_values       = shift;
994
  my $install_log_values = shift;
1010
    my $install_log_values = shift;
995
  my %config = ();
1011
    my %config             = ();
996
1012
997
  my $msg = q(
1013
    my $msg = q(
998
By default, Koha can be installed in one of three ways:
1014
By default, Koha can be installed in one of three ways:
999
1015
1000
standard: Install files in conformance with the Filesystem
1016
standard: Install files in conformance with the Filesystem
Lines 1015-1027 dev: Create a set of symbolic links and configuration files to Link Here
1015
          Koha from a git clone.
1031
          Koha from a git clone.
1016
1032
1017
Installation mode);
1033
Installation mode);
1018
    $msg .= _add_valid_values_disp('INSTALL_MODE', $valid_values);
1034
    $msg .= _add_valid_values_disp( 'INSTALL_MODE', $valid_values );
1019
    $config{'INSTALL_MODE'} = _get_value('INSTALL_MODE', $msg, $defaults->{'INSTALL_MODE'}, $valid_values, $install_log_values);
1035
    $config{'INSTALL_MODE'} =
1036
        _get_value( 'INSTALL_MODE', $msg, $defaults->{'INSTALL_MODE'}, $valid_values, $install_log_values );
1020
1037
1021
    # set message and default value for INSTALL_BASE
1038
    # set message and default value for INSTALL_BASE
1022
    # depending on value of INSTALL_MODE
1039
    # depending on value of INSTALL_MODE
1023
    my $install_base_default = $defaults->{'INSTALL_BASE'};
1040
    my $install_base_default = $defaults->{'INSTALL_BASE'};
1024
    if ($config{'INSTALL_MODE'} eq 'dev') {
1041
    if ( $config{'INSTALL_MODE'} eq 'dev' ) {
1025
        $msg = q(
1042
        $msg = q(
1026
Please specify the directory in which to install Koha's
1043
Please specify the directory in which to install Koha's
1027
active configuration files and (if applicable) the
1044
active configuration files and (if applicable) the
Lines 1029-1050 Zebra database. Koha's CGI scripts and templates will Link Here
1029
be run from the current directory.
1046
be run from the current directory.
1030
1047
1031
Configuration directory:);
1048
Configuration directory:);
1049
1032
        # FIXME - home directory portability consideration apply
1050
        # FIXME - home directory portability consideration apply
1033
        $install_base_default =
1051
        $install_base_default = $ENV{DESTDIR}
1034
	    $ENV{DESTDIR}
1052
            || ( exists $ENV{HOME} ? "$ENV{HOME}/koha-dev" : "$defaults->{'INSTALL_BASE'}-dev" );
1035
	    || ( exists $ENV{HOME} ? "$ENV{HOME}/koha-dev" : "$defaults->{'INSTALL_BASE'}-dev" )
1053
    } elsif ( $config{'INSTALL_MODE'} eq 'single' ) {
1036
	;
1037
    } elsif ($config{'INSTALL_MODE'} eq 'single') {
1038
        $msg = "\nPlease specify the directory in which to install Koha";
1054
        $msg = "\nPlease specify the directory in which to install Koha";
1055
1039
        # FIXME -- we're assuming under a 'single' mode install
1056
        # FIXME -- we're assuming under a 'single' mode install
1040
        # that user will likely want to install under the home
1057
        # that user will likely want to install under the home
1041
        # directory.  This is OK in and of itself, but we should
1058
        # directory.  This is OK in and of itself, but we should
1042
        # use File::HomeDir to locate the home directory portably.
1059
        # use File::HomeDir to locate the home directory portably.
1043
        # This is deferred for now because File::HomeDir is not yet
1060
        # This is deferred for now because File::HomeDir is not yet
1044
        # core.
1061
        # core.
1045
		# --we must also keep this portable to the major OS's -fbcit
1062
        # --we must also keep this portable to the major OS's -fbcit
1046
        $install_base_default = (exists $ENV{'HOME'}) ? "$ENV{'HOME'}/koha" : $defaults->{'INSTALL_BASE'};
1063
        $install_base_default = ( exists $ENV{'HOME'} ) ? "$ENV{'HOME'}/koha" : $defaults->{'INSTALL_BASE'};
1047
    } else {
1064
    } else {
1065
1048
        # must be standard
1066
        # must be standard
1049
        $msg = q(
1067
        $msg = q(
1050
Please specify the directory under which most Koha files
1068
Please specify the directory under which most Koha files
Lines 1057-1067 as the package name in the FHS layout. Link Here
1057
1075
1058
Base installation directory);
1076
Base installation directory);
1059
    }
1077
    }
1060
    $config{'INSTALL_BASE'} = _get_value('INSTALL_BASE', $msg, $install_base_default, $valid_values, $install_log_values);
1078
    $config{'INSTALL_BASE'} =
1079
        _get_value( 'INSTALL_BASE', $msg, $install_base_default, $valid_values, $install_log_values );
1061
1080
1062
    $config{'INSTALL_BASE'} = File::Spec->rel2abs($config{'INSTALL_BASE'});
1081
    $config{'INSTALL_BASE'} = File::Spec->rel2abs( $config{'INSTALL_BASE'} );
1063
	print "INSTALL_BASE=$config{'INSTALL_BASE'}\r\n" if $DEBUG;
1082
    print "INSTALL_BASE=$config{'INSTALL_BASE'}\r\n" if $DEBUG;
1064
    if ($config{'INSTALL_MODE'} eq "standard") {
1083
    if ( $config{'INSTALL_MODE'} eq "standard" ) {
1065
        $msg = q(
1084
        $msg = q(
1066
Since you are using the 'standard' install
1085
Since you are using the 'standard' install
1067
mode, you should run 'make install' as root.
1086
mode, you should run 'make install' as root.
Lines 1079-1085 user should not be the same as the user Link Here
1079
account Apache runs under.
1098
account Apache runs under.
1080
1099
1081
User account);
1100
User account);
1082
        $config{'KOHA_USER'} = _get_value('KOHA_USER', $msg, $defaults->{'KOHA_USER'}, $valid_values, $install_log_values);
1101
        $config{'KOHA_USER'} =
1102
            _get_value( 'KOHA_USER', $msg, $defaults->{'KOHA_USER'}, $valid_values, $install_log_values );
1083
1103
1084
        $msg = q(
1104
        $msg = q(
1085
Please specify the group that should own
1105
Please specify the group that should own
Lines 1088-1094 not exist right now, but should be created Link Here
1088
before you run 'make install'.
1108
before you run 'make install'.
1089
1109
1090
Group);
1110
Group);
1091
        $config{'KOHA_GROUP'} = _get_value('KOHA_GROUP', $msg, $defaults->{'KOHA_GROUP'}, $valid_values, $install_log_values);
1111
        $config{'KOHA_GROUP'} =
1112
            _get_value( 'KOHA_GROUP', $msg, $defaults->{'KOHA_GROUP'}, $valid_values, $install_log_values );
1092
    }
1113
    }
1093
1114
1094
    $msg = q(
1115
    $msg = q(
Lines 1098-1105 PostgreSQL; please note that at the moment Link Here
1098
PostgreSQL support is highly experimental.
1119
PostgreSQL support is highly experimental.
1099
1120
1100
DBMS to use);
1121
DBMS to use);
1101
    $msg .= _add_valid_values_disp('DB_TYPE', $valid_values);
1122
    $msg .= _add_valid_values_disp( 'DB_TYPE', $valid_values );
1102
    $config{'DB_TYPE'} = _get_value('DB_TYPE', $msg, $defaults->{'DB_TYPE'}, $valid_values, $install_log_values);
1123
    $config{'DB_TYPE'} = _get_value( 'DB_TYPE', $msg, $defaults->{'DB_TYPE'}, $valid_values, $install_log_values );
1103
1124
1104
    $msg = q(
1125
    $msg = q(
1105
Please specify the name or address of your
1126
Please specify the name or address of your
Lines 1109-1157 can be created after running 'make install' Link Here
1109
and before you try using Koha for the first time.
1130
and before you try using Koha for the first time.
1110
1131
1111
Database server);
1132
Database server);
1112
    $config{'DB_HOST'} = _get_value('DB_HOST', $msg, $defaults->{'DB_HOST'}, $valid_values, $install_log_values);
1133
    $config{'DB_HOST'} = _get_value( 'DB_HOST', $msg, $defaults->{'DB_HOST'}, $valid_values, $install_log_values );
1113
1134
1114
    $msg = q(
1135
    $msg = q(
1115
Please specify the port used to connect to the
1136
Please specify the port used to connect to the
1116
DMBS);
1137
DMBS);
1117
    my $db_port_default = $config{'DB_TYPE'} eq 'mysql' ? '3306' : '5432';
1138
    my $db_port_default = $config{'DB_TYPE'} eq 'mysql' ? '3306' : '5432';
1118
    $config{'DB_PORT'} = _get_value('DB_PORT', $msg, $db_port_default, $valid_values, $install_log_values);
1139
    $config{'DB_PORT'} = _get_value( 'DB_PORT', $msg, $db_port_default, $valid_values, $install_log_values );
1119
1140
1120
    $msg = q(
1141
    $msg = q(
1121
Please specify the name of the database to be
1142
Please specify the name of the database to be
1122
used by Koha);
1143
used by Koha);
1123
    $config{'DB_NAME'} = _get_value('DB_NAME', $msg, $defaults->{'DB_NAME'}, $valid_values, $install_log_values);
1144
    $config{'DB_NAME'} = _get_value( 'DB_NAME', $msg, $defaults->{'DB_NAME'}, $valid_values, $install_log_values );
1124
    if ($config{'DB_TYPE'} eq 'mysql'){
1145
    if ( $config{'DB_TYPE'} eq 'mysql' ) {
1125
        $msg = q(
1146
        $msg = q(
1126
Please specify whether the connection to MySQL will use TLS
1147
Please specify whether the connection to MySQL will use TLS
1127
        );
1148
        );
1128
        $config{'DB_USE_TLS'} = _get_value('DB_USE_TLS', $msg, $defaults->{'DB_USE_TLS'}, $valid_values, $install_log_values);
1149
        $config{'DB_USE_TLS'} =
1150
            _get_value( 'DB_USE_TLS', $msg, $defaults->{'DB_USE_TLS'}, $valid_values, $install_log_values );
1129
    }
1151
    }
1130
    if ($config{'DB_USE_TLS'} eq 'yes'){
1152
    if ( $config{'DB_USE_TLS'} eq 'yes' ) {
1131
        $msg = q(
1153
        $msg = q(
1132
Please enter the path to the CA certificate for TLS
1154
Please enter the path to the CA certificate for TLS
1133
        );
1155
        );
1134
        $config{'DB_TLS_CA_CERTIFICATE'} = _get_value('DB_TLS_CA_CERTIFICATE', $msg, $defaults->{'DB_TLS_CA_CERTIFICATE'}, $valid_values, $install_log_values);
1156
        $config{'DB_TLS_CA_CERTIFICATE'} = _get_value(
1157
            'DB_TLS_CA_CERTIFICATE', $msg, $defaults->{'DB_TLS_CA_CERTIFICATE'}, $valid_values,
1158
            $install_log_values
1159
        );
1135
1160
1136
        $msg = q(
1161
        $msg = q(
1137
Please enter the path to the client certificate for TLS
1162
Please enter the path to the client certificate for TLS
1138
        );
1163
        );
1139
        $config{'DB_TLS_CLIENT_CERTIFICATE'} = _get_value('DB_TLS_CLIENT_CERTIFICATE', $msg, $defaults->{'DB_TLS_CLIENT_CERTIFICATE'}, $valid_values, $install_log_values);
1164
        $config{'DB_TLS_CLIENT_CERTIFICATE'} = _get_value(
1165
            'DB_TLS_CLIENT_CERTIFICATE', $msg, $defaults->{'DB_TLS_CLIENT_CERTIFICATE'}, $valid_values,
1166
            $install_log_values
1167
        );
1140
        $msg = q(
1168
        $msg = q(
1141
Please enter the path to the client key for TLS
1169
Please enter the path to the client key for TLS
1142
        );
1170
        );
1143
        $config{'DB_TLS_CLIENT_KEY'} = _get_value('DB_TLS_CLIENT_KEY', $msg, $defaults->{'DB_TLS_CLIENT_KEY'}, $valid_values, $install_log_values);
1171
        $config{'DB_TLS_CLIENT_KEY'} = _get_value(
1172
            'DB_TLS_CLIENT_KEY', $msg, $defaults->{'DB_TLS_CLIENT_KEY'}, $valid_values,
1173
            $install_log_values
1174
        );
1144
    }
1175
    }
1145
1176
1146
    $msg = q(
1177
    $msg = q(
1147
Please specify the user that owns the database to be
1178
Please specify the user that owns the database to be
1148
used by Koha);
1179
used by Koha);
1149
    $config{'DB_USER'} = _get_value('DB_USER', $msg, $defaults->{'DB_USER'}, $valid_values, $install_log_values);
1180
    $config{'DB_USER'} = _get_value( 'DB_USER', $msg, $defaults->{'DB_USER'}, $valid_values, $install_log_values );
1150
1181
1151
    $msg = q(
1182
    $msg = q(
1152
Please specify the password of the user that owns the
1183
Please specify the password of the user that owns the
1153
database to be used by Koha);
1184
database to be used by Koha);
1154
    $config{'DB_PASS'} = _get_value('DB_PASS', $msg, $defaults->{'DB_PASS'}, $valid_values, $install_log_values);
1185
    $config{'DB_PASS'} = _get_value( 'DB_PASS', $msg, $defaults->{'DB_PASS'}, $valid_values, $install_log_values );
1155
1186
1156
    print q(
1187
    print q(
1157
Koha uses the Zebra search engine for high-performance
1188
Koha uses the Zebra search engine for high-performance
Lines 1159-1165 searching of bibliographic and authority records. Checking Link Here
1159
to see if you have installed the Zebra software...
1190
to see if you have installed the Zebra software...
1160
);
1191
);
1161
1192
1162
    if (defined(my $zebra_path = find_zebra())) {
1193
    if ( defined( my $zebra_path = find_zebra() ) ) {
1163
        $config{'PATH_TO_ZEBRA'} = $zebra_path;
1194
        $config{'PATH_TO_ZEBRA'} = $zebra_path;
1164
        print qq(
1195
        print qq(
1165
Found 'zebrasrv' and 'zebraidx' in $zebra_path.
1196
Found 'zebrasrv' and 'zebraidx' in $zebra_path.
Lines 1181-1196 Koha provides Zebra configuration files for MARC21, Link Here
1181
and UNIMARC.
1212
and UNIMARC.
1182
1213
1183
MARC format for Zebra indexing);
1214
MARC format for Zebra indexing);
1184
    $msg .= _add_valid_values_disp('ZEBRA_MARC_FORMAT', $valid_values);
1215
    $msg .= _add_valid_values_disp( 'ZEBRA_MARC_FORMAT', $valid_values );
1185
    $config{'ZEBRA_MARC_FORMAT'} = _get_value('ZEBRA_MARC_FORMAT', $msg, $defaults->{'ZEBRA_MARC_FORMAT'}, $valid_values, $install_log_values);
1216
    $config{'ZEBRA_MARC_FORMAT'} =
1217
        _get_value( 'ZEBRA_MARC_FORMAT', $msg, $defaults->{'ZEBRA_MARC_FORMAT'}, $valid_values, $install_log_values );
1186
    $msg = q(
1218
    $msg = q(
1187
Koha supplies Zebra configuration files tuned for
1219
Koha supplies Zebra configuration files tuned for
1188
searching either English (en) or French (fr) MARC
1220
searching either English (en) or French (fr) MARC
1189
records.
1221
records.
1190
1222
1191
Primary language for Zebra indexing);
1223
Primary language for Zebra indexing);
1192
    $msg .= _add_valid_values_disp('ZEBRA_LANGUAGE', $valid_values);
1224
    $msg .= _add_valid_values_disp( 'ZEBRA_LANGUAGE', $valid_values );
1193
    $config{'ZEBRA_LANGUAGE'} = _get_value('ZEBRA_LANGUAGE', $msg, $defaults->{'ZEBRA_LANGUAGE'}, $valid_values, $install_log_values);
1225
    $config{'ZEBRA_LANGUAGE'} =
1226
        _get_value( 'ZEBRA_LANGUAGE', $msg, $defaults->{'ZEBRA_LANGUAGE'}, $valid_values, $install_log_values );
1194
1227
1195
    $msg = q(
1228
    $msg = q(
1196
Zebra has two methods to perform records tokenization
1229
Zebra has two methods to perform records tokenization
Lines 1198-1213 and characters normalization: CHR and ICU. ICU is Link Here
1198
recommended for catalogs containing non-Latin
1231
recommended for catalogs containing non-Latin
1199
characters.);
1232
characters.);
1200
1233
1201
    $msg .= _add_valid_values_disp('ZEBRA_TOKENIZER', $valid_values);
1234
    $msg .= _add_valid_values_disp( 'ZEBRA_TOKENIZER', $valid_values );
1202
    $config{'ZEBRA_TOKENIZER'} = _get_value('ZEBRA_TOKENIZER', $msg, $defaults->{'ZEBRA_TOKENIZER'}, $valid_values, $install_log_values);
1235
    $config{'ZEBRA_TOKENIZER'} =
1236
        _get_value( 'ZEBRA_TOKENIZER', $msg, $defaults->{'ZEBRA_TOKENIZER'}, $valid_values, $install_log_values );
1203
1237
1204
    $msg = q(
1238
    $msg = q(
1205
Please specify Zebra database user);
1239
Please specify Zebra database user);
1206
    $config{'ZEBRA_USER'} = _get_value('ZEBRA_USER', $msg, $defaults->{'ZEBRA_USER'}, $valid_values, $install_log_values);
1240
    $config{'ZEBRA_USER'} =
1241
        _get_value( 'ZEBRA_USER', $msg, $defaults->{'ZEBRA_USER'}, $valid_values, $install_log_values );
1207
1242
1208
    $msg = q(
1243
    $msg = q(
1209
Please specify the Zebra database password);
1244
Please specify the Zebra database password);
1210
    $config{'ZEBRA_PASS'} = _get_value('ZEBRA_PASS', $msg, $defaults->{'ZEBRA_PASS'}, $valid_values, $install_log_values);
1245
    $config{'ZEBRA_PASS'} =
1246
        _get_value( 'ZEBRA_PASS', $msg, $defaults->{'ZEBRA_PASS'}, $valid_values, $install_log_values );
1211
1247
1212
    $msg = q(
1248
    $msg = q(
1213
Since you've chosen to use Zebra, you can enable the SRU/
1249
Since you've chosen to use Zebra, you can enable the SRU/
Lines 1219-1228 koha-conf.xml will still contain some references to SRU Link Here
1219
settings.  Those references will be ignored by Koha.
1255
settings.  Those references will be ignored by Koha.
1220
1256
1221
Install the SRU configuration files?);
1257
Install the SRU configuration files?);
1222
    $msg .= _add_valid_values_disp('INSTALL_SRU', $valid_values);
1258
    $msg .= _add_valid_values_disp( 'INSTALL_SRU', $valid_values );
1223
    $config{'INSTALL_SRU'} = _get_value('INSTALL_SRU', $msg, $defaults->{'INSTALL_SRU'}, $valid_values, $install_log_values);
1259
    $config{'INSTALL_SRU'} =
1260
        _get_value( 'INSTALL_SRU', $msg, $defaults->{'INSTALL_SRU'}, $valid_values, $install_log_values );
1224
1261
1225
    if ($config{'INSTALL_SRU'} eq 'yes') {
1262
    if ( $config{'INSTALL_SRU'} eq 'yes' ) {
1226
        $msg = q(
1263
        $msg = q(
1227
Since you've chosen to configure SRU, you must
1264
Since you've chosen to configure SRU, you must
1228
specify the host and port(s) that the SRU
1265
specify the host and port(s) that the SRU
Lines 1230-1341 Servers (bibliographic and authority) should run on. Link Here
1230
);
1267
);
1231
        $msg = q(
1268
        $msg = q(
1232
SRU Database host?);
1269
SRU Database host?);
1233
        $config{'ZEBRA_SRU_HOST'} = _get_value('ZEBRA_SRU_HOST', $msg, $defaults->{'ZEBRA_SRU_HOST'}, $valid_values, $install_log_values);
1270
        $config{'ZEBRA_SRU_HOST'} =
1271
            _get_value( 'ZEBRA_SRU_HOST', $msg, $defaults->{'ZEBRA_SRU_HOST'}, $valid_values, $install_log_values );
1234
1272
1235
        $msg = q(
1273
        $msg = q(
1236
SRU port for bibliographic data?);
1274
SRU port for bibliographic data?);
1237
        $config{'ZEBRA_SRU_BIBLIOS_PORT'} = _get_value('ZEBRA_SRU_BIBLIOS_PORT', $msg, $defaults->{'ZEBRA_SRU_BIBLIOS_PORT'}, $valid_values, $install_log_values);
1275
        $config{'ZEBRA_SRU_BIBLIOS_PORT'} = _get_value(
1276
            'ZEBRA_SRU_BIBLIOS_PORT', $msg, $defaults->{'ZEBRA_SRU_BIBLIOS_PORT'}, $valid_values,
1277
            $install_log_values
1278
        );
1238
1279
1239
        $msg = q(
1280
        $msg = q(
1240
SRU port for authority data?);
1281
SRU port for authority data?);
1241
        $config{'ZEBRA_SRU_AUTHORITIES_PORT'} = _get_value('ZEBRA_SRU_AUTHORITIES_PORT', $msg, $defaults->{'ZEBRA_SRU_AUTHORITIES_PORT'}, $valid_values, $install_log_values);
1282
        $config{'ZEBRA_SRU_AUTHORITIES_PORT'} = _get_value(
1283
            'ZEBRA_SRU_AUTHORITIES_PORT', $msg, $defaults->{'ZEBRA_SRU_AUTHORITIES_PORT'}, $valid_values,
1284
            $install_log_values
1285
        );
1242
1286
1243
    }
1287
    }
1244
1288
1245
  $msg = q(
1289
    $msg = q(
1246
Use memcached to cache the results of some function calls?
1290
Use memcached to cache the results of some function calls?
1247
This provides a significant performance improvement.
1291
This provides a significant performance improvement.
1248
You will need a Memcached server running.);
1292
You will need a Memcached server running.);
1249
  $msg .= _add_valid_values_disp('USE_MEMCACHED', $valid_values);
1293
    $msg .= _add_valid_values_disp( 'USE_MEMCACHED', $valid_values );
1250
  $config{'USE_MEMCACHED'} = _get_value('USE_MEMCACHED', $msg, $defaults->{'USE_MEMCACHED'}, $valid_values, $install_log_values);
1294
    $config{'USE_MEMCACHED'} =
1251
  if ($config{'USE_MEMCACHED'} eq 'yes'){
1295
        _get_value( 'USE_MEMCACHED', $msg, $defaults->{'USE_MEMCACHED'}, $valid_values, $install_log_values );
1252
      $msg = q(
1296
    if ( $config{'USE_MEMCACHED'} eq 'yes' ) {
1297
        $msg = q(
1253
Since you've chosen to use caching, you must specify the memcached servers and the namespace to use:
1298
Since you've chosen to use caching, you must specify the memcached servers and the namespace to use:
1254
);
1299
);
1255
      $msg = q(
1300
        $msg = q(
1256
Memcached server address?);
1301
Memcached server address?);
1257
      $config{'MEMCACHED_SERVERS'} = _get_value('MEMCACHED_SERVERS', $msg, $defaults->{'MEMCACHED_SERVERS'}, $valid_values, $install_log_values);
1302
        $config{'MEMCACHED_SERVERS'} = _get_value(
1303
            'MEMCACHED_SERVERS', $msg, $defaults->{'MEMCACHED_SERVERS'}, $valid_values,
1304
            $install_log_values
1305
        );
1258
1306
1259
      $msg = q(
1307
        $msg = q(
1260
Memcached namespace?);
1308
Memcached namespace?);
1261
      $config{'MEMCACHED_NAMESPACE'} = _get_value('MEMCACHED_NAMESPACE', $msg, $defaults->{'MEMCACHED_NAMESPACE'}, $valid_values, $install_log_values);
1309
        $config{'MEMCACHED_NAMESPACE'} = _get_value(
1262
  }
1310
            'MEMCACHED_NAMESPACE', $msg, $defaults->{'MEMCACHED_NAMESPACE'}, $valid_values,
1263
1311
            $install_log_values
1312
        );
1313
    }
1264
1314
1265
  $msg = q(
1315
    $msg = q(
1266
Use Elasticsearch to serve search results?
1316
Use Elasticsearch to serve search results?
1267
You will need a Elasticsearch server running.);
1317
You will need a Elasticsearch server running.);
1268
  $msg .= _add_valid_values_disp('USE_ELASTICSEARCH', $valid_values);
1318
    $msg .= _add_valid_values_disp( 'USE_ELASTICSEARCH', $valid_values );
1269
  $config{'USE_ELASTICSEARCH'} = _get_value('USE_ELASTICSEARCH', $msg, $defaults->{'USE_ELASTICSEARCH'}, $valid_values, $install_log_values);
1319
    $config{'USE_ELASTICSEARCH'} =
1270
  if ($config{'USE_ELASTICSEARCH'} eq 'yes'){
1320
        _get_value( 'USE_ELASTICSEARCH', $msg, $defaults->{'USE_ELASTICSEARCH'}, $valid_values, $install_log_values );
1271
      $msg = q(
1321
    if ( $config{'USE_ELASTICSEARCH'} eq 'yes' ) {
1322
        $msg = q(
1272
Define the ELASTICSEARCH_SERVERS with a comma-separated list. Eg
1323
Define the ELASTICSEARCH_SERVERS with a comma-separated list. Eg
1273
localhost:9200, 192.168.0.100:9200
1324
localhost:9200, 192.168.0.100:9200
1274
);
1325
);
1275
      $msg = q(
1326
        $msg = q(
1276
Elasticsearch server addresses?);
1327
Elasticsearch server addresses?);
1277
      $config{'ELASTICSEARCH_SERVERS'} = _get_value('ELASTICSEARCH_SERVERS', $msg, $defaults->{'ELASTICSEARCH_SERVERS'}, $valid_values, $install_log_values);
1328
        $config{'ELASTICSEARCH_SERVERS'} = _get_value(
1329
            'ELASTICSEARCH_SERVERS', $msg, $defaults->{'ELASTICSEARCH_SERVERS'}, $valid_values,
1330
            $install_log_values
1331
        );
1278
1332
1279
      $msg = q(
1333
        $msg = q(
1280
What index name to use for this Koha-instance? It must be unique for each Koha
1334
What index name to use for this Koha-instance? It must be unique for each Koha
1281
sharing the same Elasticsearch-cluster
1335
sharing the same Elasticsearch-cluster
1282
1336
1283
Elasticsearch index?);
1337
Elasticsearch index?);
1284
      $config{'ELASTICSEARCH_INDEX'} = _get_value('ELASTICSEARCH_INDEX', $msg, $defaults->{'ELASTICSEARCH_INDEX'}, $valid_values, $install_log_values);
1338
        $config{'ELASTICSEARCH_INDEX'} = _get_value(
1285
  }
1339
            'ELASTICSEARCH_INDEX', $msg, $defaults->{'ELASTICSEARCH_INDEX'}, $valid_values,
1340
            $install_log_values
1341
        );
1342
    }
1286
1343
1287
  $msg = q(
1344
    $msg = q(
1288
Template cache directory?);
1345
Template cache directory?);
1289
  $config{'TEMPLATE_CACHE_DIR'} = _get_value('TEMPLATE_CACHE_DIR', $msg, $defaults->{'TEMPLATE_CACHE_DIR'}, $valid_values, $install_log_values);
1346
    $config{'TEMPLATE_CACHE_DIR'} =
1347
        _get_value( 'TEMPLATE_CACHE_DIR', $msg, $defaults->{'TEMPLATE_CACHE_DIR'}, $valid_values, $install_log_values );
1290
1348
1291
  $msg = q(
1349
    $msg = q(
1292
Path to DejaVu fonts?);
1350
Path to DejaVu fonts?);
1293
  $config{'FONT_DIR'} = _get_value('FONT_DIR', $msg, $defaults->{'FONT_DIR'}, $valid_values, $install_log_values);
1351
    $config{'FONT_DIR'} = _get_value( 'FONT_DIR', $msg, $defaults->{'FONT_DIR'}, $valid_values, $install_log_values );
1294
1352
1295
  $msg = q(
1353
    $msg = q(
1296
SMTP settings
1354
SMTP settings
1297
You will be able to set your default SMTP configuration.);
1355
You will be able to set your default SMTP configuration.);
1298
  $msg .= q{
1356
    $msg .= q{
1299
SMTP host name?};
1357
SMTP host name?};
1300
  $config{'SMTP_HOST'} = _get_value('SMTP_HOST', $msg, $defaults->{'SMTP_HOST'}, $valid_values, $install_log_values);
1358
    $config{'SMTP_HOST'} =
1359
        _get_value( 'SMTP_HOST', $msg, $defaults->{'SMTP_HOST'}, $valid_values, $install_log_values );
1301
1360
1302
  $msg = q{
1361
    $msg = q{
1303
SMTP port?};
1362
SMTP port?};
1304
  $config{'SMTP_PORT'} = _get_value('SMTP_PORT', $msg, $defaults->{'SMTP_PORT'}, $valid_values, $install_log_values);
1363
    $config{'SMTP_PORT'} =
1364
        _get_value( 'SMTP_PORT', $msg, $defaults->{'SMTP_PORT'}, $valid_values, $install_log_values );
1305
1365
1306
  $msg = q{
1366
    $msg = q{
1307
SMTP timeout (in seconds)?};
1367
SMTP timeout (in seconds)?};
1308
  $config{'SMTP_TIMEOUT'} = _get_value('SMTP_TIMEOUT', $msg, $defaults->{'SMTP_TIMEOUT'}, $valid_values, $install_log_values);
1368
    $config{'SMTP_TIMEOUT'} =
1369
        _get_value( 'SMTP_TIMEOUT', $msg, $defaults->{'SMTP_TIMEOUT'}, $valid_values, $install_log_values );
1309
1370
1310
  $msg = q{
1371
    $msg = q{
1311
SMTP SSL mode?};
1372
SMTP SSL mode?};
1312
  $msg .= _add_valid_values_disp('SMTP_SSL_MODE', $valid_values);
1373
    $msg .= _add_valid_values_disp( 'SMTP_SSL_MODE', $valid_values );
1313
  $config{'SMTP_SSL_MODE'} = _get_value('SMTP_SSL_MODE', $msg, $defaults->{'SMTP_SSL_MODE'}, $valid_values, $install_log_values);
1374
    $config{'SMTP_SSL_MODE'} =
1375
        _get_value( 'SMTP_SSL_MODE', $msg, $defaults->{'SMTP_SSL_MODE'}, $valid_values, $install_log_values );
1314
1376
1315
  $msg = q{
1377
    $msg = q{
1316
SMTP user name?};
1378
SMTP user name?};
1317
  $config{'SMTP_USER_NAME'} = _get_value('SMTP_USER_NAME', $msg, $defaults->{'SMTP_USER_NAME'}, $valid_values, $install_log_values);
1379
    $config{'SMTP_USER_NAME'} =
1380
        _get_value( 'SMTP_USER_NAME', $msg, $defaults->{'SMTP_USER_NAME'}, $valid_values, $install_log_values );
1318
1381
1319
  $msg = q{
1382
    $msg = q{
1320
SMTP password?};
1383
SMTP password?};
1321
  $config{'SMTP_PASSWORD'} = _get_value('SMTP_PASSWORD', $msg, $defaults->{'SMTP_PASSWORD'}, $valid_values, $install_log_values);
1384
    $config{'SMTP_PASSWORD'} =
1385
        _get_value( 'SMTP_PASSWORD', $msg, $defaults->{'SMTP_PASSWORD'}, $valid_values, $install_log_values );
1322
1386
1323
  $msg = q{
1387
    $msg = q{
1324
SMTP debug mode?};
1388
SMTP debug mode?};
1325
  $msg .= _add_valid_values_disp('SMTP_DEBUG', $valid_values);
1389
    $msg .= _add_valid_values_disp( 'SMTP_DEBUG', $valid_values );
1326
  $config{'SMTP_DEBUG'} = _get_value('SMTP_DEBUG', $msg, $defaults->{'SMTP_DEBUG'}, $valid_values, $install_log_values);
1390
    $config{'SMTP_DEBUG'} =
1391
        _get_value( 'SMTP_DEBUG', $msg, $defaults->{'SMTP_DEBUG'}, $valid_values, $install_log_values );
1327
1392
1328
  $config{'SMTP_DEBUG'} = ( $config{'SMTP_DEBUG'} eq 'yes' ) ? 1 : 0;
1393
    $config{'SMTP_DEBUG'} = ( $config{'SMTP_DEBUG'} eq 'yes' ) ? 1 : 0;
1329
1394
1330
  $msg = q(
1395
    $msg = q(
1331
Would you like to run the database-dependent test suite?);
1396
Would you like to run the database-dependent test suite?);
1332
  $msg .= _add_valid_values_disp( 'RUN_DATABASE_TESTS', $valid_values );
1397
    $msg .= _add_valid_values_disp( 'RUN_DATABASE_TESTS', $valid_values );
1333
    $config{'RUN_DATABASE_TESTS'} = _get_value( 'RUN_DATABASE_TESTS', $msg, $defaults->{'RUN_DATABASE_TESTS'}, $valid_values, $install_log_values );
1398
    $config{'RUN_DATABASE_TESTS'} =
1399
        _get_value( 'RUN_DATABASE_TESTS', $msg, $defaults->{'RUN_DATABASE_TESTS'}, $valid_values, $install_log_values );
1334
1400
1335
  if ( $config{'RUN_DATABASE_TESTS'} eq 'yes' ) {
1401
    if ( $config{'RUN_DATABASE_TESTS'} eq 'yes' ) {
1336
      $config{'TEST_DB_TYPE'} = $config{'DB_TYPE'};
1402
        $config{'TEST_DB_TYPE'} = $config{'DB_TYPE'};
1337
      $config{'TEST_DB_HOST'} = $config{'DB_HOST'};
1403
        $config{'TEST_DB_HOST'} = $config{'DB_HOST'};
1338
      $msg = q(TEST DATABASE
1404
        $msg                    = q(TEST DATABASE
1339
1405
1340
THE DATA IN THIS DATABASE WILL BE DESTROYED during the process of
1406
THE DATA IN THIS DATABASE WILL BE DESTROYED during the process of
1341
testing. Please don't do this on your production database. It is not
1407
testing. Please don't do this on your production database. It is not
Lines 1348-1369 doing it in a database that you don't want to lose. Link Here
1348
Please specify the name of the test database to be
1414
Please specify the name of the test database to be
1349
used by Koha);
1415
used by Koha);
1350
1416
1351
      $config{'TEST_DB_NAME'} = _get_value('TEST_DB_NAME', $msg, $defaults->{'TEST_DB_NAME'}, $valid_values, $install_log_values);
1417
        $config{'TEST_DB_NAME'} =
1352
      while ( $config{'TEST_DB_NAME'} eq $config{'DB_NAME'} ) {
1418
            _get_value( 'TEST_DB_NAME', $msg, $defaults->{'TEST_DB_NAME'}, $valid_values, $install_log_values );
1353
          $msg = q(Please do not use the same database for testing as you do for production. You run the severe risk of data loss.);
1419
        while ( $config{'TEST_DB_NAME'} eq $config{'DB_NAME'} ) {
1354
          $config{'TEST_DB_NAME'} = _get_value('TEST_DB_NAME', $msg, $defaults->{'TEST_DB_NAME'}, $valid_values, $install_log_values);
1420
            $msg =
1355
      }
1421
                q(Please do not use the same database for testing as you do for production. You run the severe risk of data loss.);
1422
            $config{'TEST_DB_NAME'} =
1423
                _get_value( 'TEST_DB_NAME', $msg, $defaults->{'TEST_DB_NAME'}, $valid_values, $install_log_values );
1424
        }
1356
1425
1357
      $msg = q(
1426
        $msg = q(
1358
Please specify the user that owns the database to be
1427
Please specify the user that owns the database to be
1359
used by Koha);
1428
used by Koha);
1360
    $config{'TEST_DB_USER'} = _get_value('TEST_DB_USER', $msg, $defaults->{'TEST_DB_USER'}, $valid_values, $install_log_values);
1429
        $config{'TEST_DB_USER'} =
1430
            _get_value( 'TEST_DB_USER', $msg, $defaults->{'TEST_DB_USER'}, $valid_values, $install_log_values );
1361
1431
1362
      $msg = q(
1432
        $msg = q(
1363
Please specify the password of the user that owns the
1433
Please specify the password of the user that owns the
1364
database to be used by Koha);
1434
database to be used by Koha);
1365
      $config{'TEST_DB_PASS'} = _get_value('TEST_DB_PASS', $msg, $defaults->{'TEST_DB_PASS'}, $valid_values, $install_log_values);
1435
        $config{'TEST_DB_PASS'} =
1366
  }
1436
            _get_value( 'TEST_DB_PASS', $msg, $defaults->{'TEST_DB_PASS'}, $valid_values, $install_log_values );
1437
    }
1367
1438
1368
    print "\n\n";
1439
    print "\n\n";
1369
1440
Lines 1379-1422 database to be used by Koha); Link Here
1379
}
1450
}
1380
1451
1381
sub _add_valid_values_disp {
1452
sub _add_valid_values_disp {
1382
    my $key = shift;
1453
    my $key          = shift;
1383
    my $valid_values = shift;
1454
    my $valid_values = shift;
1384
1455
1385
    my $disp = "";
1456
    my $disp = "";
1386
    if (exists $valid_values->{$key}) {
1457
    if ( exists $valid_values->{$key} ) {
1387
        $disp = " (" . join(", ", sort keys %{ $valid_values->{$key} }) . ")";
1458
        $disp = " (" . join( ", ", sort keys %{ $valid_values->{$key} } ) . ")";
1388
    }
1459
    }
1389
    return $disp;
1460
    return $disp;
1390
}
1461
}
1391
1462
1392
sub _get_value {
1463
sub _get_value {
1393
    my $key = shift;
1464
    my $key                = shift;
1394
    my $msg = shift;
1465
    my $msg                = shift;
1395
    my $default = shift;
1466
    my $default            = shift;
1396
    my $valid_values = shift;
1467
    my $valid_values       = shift;
1397
    my $install_log_values = shift;
1468
    my $install_log_values = shift;
1398
1469
1399
    # take value from install log if present
1470
    # take value from install log if present
1400
    if (exists $install_log_values{$key}) {
1471
    if ( exists $install_log_values{$key} ) {
1401
        $install_log_values{$key} =~ s/\$/\$\$/g;
1472
        $install_log_values{$key} =~ s/\$/\$\$/g;
1402
        return $install_log_values{$key};
1473
        return $install_log_values{$key};
1403
    }
1474
    }
1404
1475
1405
    # override default value from environment
1476
    # override default value from environment
1406
    if (exists $ENV{$key}) {
1477
    if ( exists $ENV{$key} ) {
1407
        $default = $ENV{$key};
1478
        $default = $ENV{$key};
1408
        $msg .= " (default from environment)";
1479
        $msg .= " (default from environment)";
1409
    }
1480
    }
1410
1481
1411
    my $val = prompt($msg, $default);
1482
    my $val = prompt( $msg, $default );
1412
1483
1413
    while (exists $valid_values->{$key} and
1484
    while ( exists $valid_values->{$key}
1414
           $val ne $default and
1485
        and $val ne $default
1415
           not exists $valid_values->{$key}->{$val}) {
1486
        and not exists $valid_values->{$key}->{$val} )
1487
    {
1416
        my $retry_msg = "Value '$val' is not a valid option.\n";
1488
        my $retry_msg = "Value '$val' is not a valid option.\n";
1417
        $retry_msg .= "Please enter a value";
1489
        $retry_msg .= "Please enter a value";
1418
        $retry_msg .= _add_valid_values_disp($key, $valid_values);
1490
        $retry_msg .= _add_valid_values_disp( $key, $valid_values );
1419
        $val = prompt($retry_msg, $default);
1491
        $val = prompt( $retry_msg, $default );
1420
    }
1492
    }
1421
    $val =~ s/\$/\$\$/g;
1493
    $val =~ s/\$/\$\$/g;
1422
    return $val;
1494
    return $val;
Lines 1441-1552 sub get_target_directories { Link Here
1441
1513
1442
    # get last component of install base directory
1514
    # get last component of install base directory
1443
    # to treat as package name
1515
    # to treat as package name
1444
    my ($volume, $directories, $file) = File::Spec->splitpath($base, 1);
1516
    my ( $volume, $directories, $file ) = File::Spec->splitpath( $base, 1 );
1445
1517
1446
    my @basedir = File::Spec->splitdir($directories);
1518
    my @basedir = File::Spec->splitdir($directories);
1447
1519
1448
    if ( $^O eq 'cygwin' ) { shift @basedir; unshift @basedir, 'c:'; }   # in a cygwin environment, $volume is returned empty
1520
    if ( $^O eq 'cygwin' ) {
1521
        shift @basedir;
1522
        unshift @basedir, 'c:';
1523
    }    # in a cygwin environment, $volume is returned empty
1449
1524
1450
    my $package = pop @basedir;
1525
    my $package = pop @basedir;
1451
1526
1452
1527
    my %dirmap   = ();
1453
    my %dirmap = ();
1454
    my %skipdirs = ();
1528
    my %skipdirs = ();
1455
    if ($mode eq 'single') {
1529
    if ( $mode eq 'single' ) {
1456
        $dirmap{'API_CGI_DIR'} = File::Spec->catdir(@basedir, $package, 'api');
1530
        $dirmap{'API_CGI_DIR'}       = File::Spec->catdir( @basedir, $package, 'api' );
1457
        $dirmap{'INTRANET_CGI_DIR'} = File::Spec->catdir(@basedir, $package, 'intranet', 'cgi-bin');
1531
        $dirmap{'INTRANET_CGI_DIR'}  = File::Spec->catdir( @basedir, $package, 'intranet', 'cgi-bin' );
1458
        $dirmap{'INTRANET_TMPL_DIR'} = File::Spec->catdir(@basedir, $package, 'intranet', 'htdocs', 'intranet-tmpl');
1532
        $dirmap{'INTRANET_TMPL_DIR'} = File::Spec->catdir( @basedir, $package, 'intranet', 'htdocs', 'intranet-tmpl' );
1459
        $dirmap{'INTRANET_WWW_DIR'} = File::Spec->catdir(@basedir, $package, 'intranet', 'htdocs');
1533
        $dirmap{'INTRANET_WWW_DIR'}  = File::Spec->catdir( @basedir, $package, 'intranet', 'htdocs' );
1460
        $dirmap{'OPAC_CGI_DIR'} = File::Spec->catdir(@basedir, $package, 'opac', 'cgi-bin');
1534
        $dirmap{'OPAC_CGI_DIR'}      = File::Spec->catdir( @basedir, $package, 'opac',     'cgi-bin' );
1461
        $dirmap{'OPAC_TMPL_DIR'} = File::Spec->catdir(@basedir, $package, 'opac', 'htdocs', 'opac-tmpl');
1535
        $dirmap{'OPAC_TMPL_DIR'}     = File::Spec->catdir( @basedir, $package, 'opac',     'htdocs', 'opac-tmpl' );
1462
        $dirmap{'OPAC_WWW_DIR'} = File::Spec->catdir(@basedir, $package, 'opac', 'htdocs');
1536
        $dirmap{'OPAC_WWW_DIR'}      = File::Spec->catdir( @basedir, $package, 'opac',     'htdocs' );
1463
        $dirmap{'PERL_MODULE_DIR'} = File::Spec->catdir(@basedir, $package, 'lib');
1537
        $dirmap{'PERL_MODULE_DIR'}     = File::Spec->catdir( @basedir, $package, 'lib' );
1464
        $dirmap{'PERL_MODULE_LIB_DIR'} = File::Spec->catdir(@basedir, $package, 'lib');
1538
        $dirmap{'PERL_MODULE_LIB_DIR'} = File::Spec->catdir( @basedir, $package, 'lib' );
1465
        $dirmap{'KOHA_CONF_DIR'} = File::Spec->catdir(@basedir, $package, 'etc');
1539
        $dirmap{'KOHA_CONF_DIR'}       = File::Spec->catdir( @basedir, $package, 'etc' );
1466
        $dirmap{'ZEBRA_CONF_DIR'} = File::Spec->catdir(@basedir, $package, 'etc', 'zebradb');
1540
        $dirmap{'ZEBRA_CONF_DIR'}      = File::Spec->catdir( @basedir, $package, 'etc', 'zebradb' );
1467
        $dirmap{'Z3950_CONF_DIR'} = File::Spec->catdir(@basedir, $package, 'etc', 'z3950');
1541
        $dirmap{'Z3950_CONF_DIR'}      = File::Spec->catdir( @basedir, $package, 'etc', 'z3950' );
1468
        $dirmap{'MISC_DIR'} = File::Spec->catdir(@basedir, $package, 'misc');
1542
        $dirmap{'MISC_DIR'}            = File::Spec->catdir( @basedir, $package, 'misc' );
1469
        $dirmap{'SCRIPT_DIR'} = File::Spec->catdir(@basedir, $package, 'bin');
1543
        $dirmap{'SCRIPT_DIR'}          = File::Spec->catdir( @basedir, $package, 'bin' );
1470
        $dirmap{'SCRIPT_NONDEV_DIR'} = $dirmap{'SCRIPT_DIR'};
1544
        $dirmap{'SCRIPT_NONDEV_DIR'}   = $dirmap{'SCRIPT_DIR'};
1471
        $dirmap{'MAN_DIR'} = File::Spec->catdir(@basedir, $package, 'man');
1545
        $dirmap{'MAN_DIR'}             = File::Spec->catdir( @basedir, $package, 'man' );
1472
        $dirmap{'DOC_DIR'} = File::Spec->catdir(@basedir, $package, 'doc');
1546
        $dirmap{'DOC_DIR'}             = File::Spec->catdir( @basedir, $package, 'doc' );
1473
        $dirmap{'ZEBRA_LOCK_DIR'} = File::Spec->catdir(@basedir, $package, 'var', 'lock', 'zebradb');
1547
        $dirmap{'ZEBRA_LOCK_DIR'}      = File::Spec->catdir( @basedir, $package, 'var', 'lock', 'zebradb' );
1474
        $dirmap{'LOCK_DIR'} =  File::Spec->catdir(@basedir, $package, 'var', 'lock');
1548
        $dirmap{'LOCK_DIR'}            = File::Spec->catdir( @basedir, $package, 'var', 'lock' );
1475
        $dirmap{'LOG_DIR'} =  File::Spec->catdir(@basedir, $package, 'var', 'log');
1549
        $dirmap{'LOG_DIR'}             = File::Spec->catdir( @basedir, $package, 'var', 'log' );
1476
        $dirmap{'BACKUP_DIR'} =  File::Spec->catdir(@basedir, $package, 'var', 'spool');
1550
        $dirmap{'BACKUP_DIR'}          = File::Spec->catdir( @basedir, $package, 'var', 'spool' );
1477
        $dirmap{'PLUGINS_DIR'} =  File::Spec->catdir(@basedir, $package, 'var', 'lib', 'koha', 'plugins');
1551
        $dirmap{'PLUGINS_DIR'}         = File::Spec->catdir( @basedir, $package, 'var', 'lib', 'koha', 'plugins' );
1478
        $dirmap{'ZEBRA_DATA_DIR'} =  File::Spec->catdir(@basedir, $package, 'var', 'lib', 'zebradb');
1552
        $dirmap{'ZEBRA_DATA_DIR'}      = File::Spec->catdir( @basedir, $package, 'var', 'lib', 'zebradb' );
1479
        $dirmap{'ZEBRA_RUN_DIR'} =  File::Spec->catdir(@basedir, $package, 'var', 'run', 'zebradb');
1553
        $dirmap{'ZEBRA_RUN_DIR'}       = File::Spec->catdir( @basedir, $package, 'var', 'run', 'zebradb' );
1480
    } elsif ($mode eq 'dev') {
1554
    } elsif ( $mode eq 'dev' ) {
1481
        my $curdir = File::Spec->rel2abs(File::Spec->curdir());
1555
        my $curdir = File::Spec->rel2abs( File::Spec->curdir() );
1482
        $dirmap{'API_CGI_DIR'} = File::Spec->catdir($curdir, 'api');
1556
        $dirmap{'API_CGI_DIR'}         = File::Spec->catdir( $curdir, 'api' );
1483
        $skipdirs{'API_CGI_DIR'} = 1;
1557
        $skipdirs{'API_CGI_DIR'}       = 1;
1484
        $dirmap{'INTRANET_CGI_DIR'} = File::Spec->catdir($curdir);
1558
        $dirmap{'INTRANET_CGI_DIR'}    = File::Spec->catdir($curdir);
1485
        $skipdirs{'INTRANET_CGI_DIR'} = 1;
1559
        $skipdirs{'INTRANET_CGI_DIR'}  = 1;
1486
        $dirmap{'INTRANET_TMPL_DIR'} = File::Spec->catdir($curdir, 'koha-tmpl', 'intranet-tmpl');
1560
        $dirmap{'INTRANET_TMPL_DIR'}   = File::Spec->catdir( $curdir, 'koha-tmpl', 'intranet-tmpl' );
1487
        $skipdirs{'INTRANET_TMPL_DIR'} = 1;
1561
        $skipdirs{'INTRANET_TMPL_DIR'} = 1;
1488
        $dirmap{'INTRANET_WWW_DIR'} = File::Spec->catdir($curdir, 'koha-tmpl');
1562
        $dirmap{'INTRANET_WWW_DIR'}    = File::Spec->catdir( $curdir, 'koha-tmpl' );
1489
        $skipdirs{'INTRANET_WWW_DIR'} = 1;
1563
        $skipdirs{'INTRANET_WWW_DIR'}  = 1;
1490
        $dirmap{'OPAC_CGI_DIR'} = File::Spec->catdir($curdir);
1564
        $dirmap{'OPAC_CGI_DIR'}        = File::Spec->catdir($curdir);
1491
        $skipdirs{'OPAC_CGI_DIR'} = 1;
1565
        $skipdirs{'OPAC_CGI_DIR'}      = 1;
1492
        $dirmap{'OPAC_TMPL_DIR'} = File::Spec->catdir($curdir, 'koha-tmpl', 'opac-tmpl');
1566
        $dirmap{'OPAC_TMPL_DIR'}       = File::Spec->catdir( $curdir, 'koha-tmpl', 'opac-tmpl' );
1493
        $skipdirs{'OPAC_TMPL_DIR'} = 1;
1567
        $skipdirs{'OPAC_TMPL_DIR'}     = 1;
1494
        $dirmap{'OPAC_WWW_DIR'} = File::Spec->catdir($curdir, 'koha-tmpl');
1568
        $dirmap{'OPAC_WWW_DIR'}        = File::Spec->catdir( $curdir, 'koha-tmpl' );
1495
        $skipdirs{'OPAC_WWW_DIR'} = 1;
1569
        $skipdirs{'OPAC_WWW_DIR'}      = 1;
1570
1496
        #NOTE: We're hacking the dirmap here, so that PERL_MODULE_DIR tokens get rewritten correctly for git installs
1571
        #NOTE: We're hacking the dirmap here, so that PERL_MODULE_DIR tokens get rewritten correctly for git installs
1497
        $dirmap{'PERL_MODULE_DIR'} = File::Spec->catdir($curdir);
1572
        $dirmap{'PERL_MODULE_DIR'}       = File::Spec->catdir($curdir);
1498
        $skipdirs{'PERL_MODULE_DIR'} = 1;
1573
        $skipdirs{'PERL_MODULE_DIR'}     = 1;
1499
        $dirmap{'PERL_MODULE_LIB_DIR'} = File::Spec->catdir($curdir,'lib');
1574
        $dirmap{'PERL_MODULE_LIB_DIR'}   = File::Spec->catdir( $curdir, 'lib' );
1500
        $skipdirs{'PERL_MODULE_LIB_DIR'} = 1;
1575
        $skipdirs{'PERL_MODULE_LIB_DIR'} = 1;
1501
        $dirmap{'KOHA_CONF_DIR'} = File::Spec->catdir(@basedir, $package, 'etc');
1576
        $dirmap{'KOHA_CONF_DIR'}         = File::Spec->catdir( @basedir, $package, 'etc' );
1502
        $dirmap{'ZEBRA_CONF_DIR'} = File::Spec->catdir(@basedir, $package, 'etc', 'zebradb');
1577
        $dirmap{'ZEBRA_CONF_DIR'}        = File::Spec->catdir( @basedir, $package, 'etc', 'zebradb' );
1503
        $dirmap{'Z3950_CONF_DIR'} = File::Spec->catdir(@basedir, $package, 'etc', 'z3950');
1578
        $dirmap{'Z3950_CONF_DIR'}        = File::Spec->catdir( @basedir, $package, 'etc', 'z3950' );
1504
        $dirmap{'MISC_DIR'} = File::Spec->catdir(@basedir, $package, 'misc');
1579
        $dirmap{'MISC_DIR'}              = File::Spec->catdir( @basedir, $package, 'misc' );
1505
        $dirmap{'SCRIPT_DIR'} = File::Spec->catdir(@basedir, $package, 'bin');
1580
        $dirmap{'SCRIPT_DIR'}            = File::Spec->catdir( @basedir, $package, 'bin' );
1581
1506
        #For dev install, point NONDEV_DIR to misc in current dir (not base)
1582
        #For dev install, point NONDEV_DIR to misc in current dir (not base)
1507
        #Used by supportdir in koha-conf.xml (BZ 12031)
1583
        #Used by supportdir in koha-conf.xml (BZ 12031)
1508
        $dirmap{'SCRIPT_NONDEV_DIR'} = File::Spec->catdir($curdir, 'misc');
1584
        $dirmap{'SCRIPT_NONDEV_DIR'}   = File::Spec->catdir( $curdir, 'misc' );
1509
        $skipdirs{'SCRIPT_NONDEV_DIR'} = 1;
1585
        $skipdirs{'SCRIPT_NONDEV_DIR'} = 1;
1510
        $dirmap{'MAN_DIR'} = File::Spec->catdir(@basedir, $package, 'man');
1586
        $dirmap{'MAN_DIR'}             = File::Spec->catdir( @basedir, $package, 'man' );
1511
        $dirmap{'DOC_DIR'} = File::Spec->catdir(@basedir, $package, 'doc');
1587
        $dirmap{'DOC_DIR'}             = File::Spec->catdir( @basedir, $package, 'doc' );
1512
        $dirmap{'ZEBRA_LOCK_DIR'} = File::Spec->catdir(@basedir, $package, 'var', 'lock', 'zebradb');
1588
        $dirmap{'ZEBRA_LOCK_DIR'}      = File::Spec->catdir( @basedir, $package, 'var', 'lock', 'zebradb' );
1513
        $dirmap{'LOCK_DIR'} =  File::Spec->catdir(@basedir, $package, 'var', 'lock');
1589
        $dirmap{'LOCK_DIR'}            = File::Spec->catdir( @basedir, $package, 'var', 'lock' );
1514
        $dirmap{'LOG_DIR'} =  File::Spec->catdir(@basedir, $package, 'var', 'log');
1590
        $dirmap{'LOG_DIR'}             = File::Spec->catdir( @basedir, $package, 'var', 'log' );
1515
        $dirmap{'BACKUP_DIR'} =  File::Spec->catdir(@basedir, $package, 'var', 'spool');
1591
        $dirmap{'BACKUP_DIR'}          = File::Spec->catdir( @basedir, $package, 'var', 'spool' );
1516
        $dirmap{'PLUGINS_DIR'} =  File::Spec->catdir(@basedir, $package, 'var', 'lib', 'plugins');
1592
        $dirmap{'PLUGINS_DIR'}         = File::Spec->catdir( @basedir, $package, 'var', 'lib', 'plugins' );
1517
        $dirmap{'ZEBRA_DATA_DIR'} =  File::Spec->catdir(@basedir, $package, 'var', 'lib', 'zebradb');
1593
        $dirmap{'ZEBRA_DATA_DIR'}      = File::Spec->catdir( @basedir, $package, 'var', 'lib', 'zebradb' );
1518
        $dirmap{'ZEBRA_RUN_DIR'} =  File::Spec->catdir(@basedir, $package, 'var', 'run', 'zebradb');
1594
        $dirmap{'ZEBRA_RUN_DIR'}       = File::Spec->catdir( @basedir, $package, 'var', 'run', 'zebradb' );
1519
    } else {
1595
    } else {
1596
1520
        # mode is standard, i.e., 'fhs'
1597
        # mode is standard, i.e., 'fhs'
1521
        $dirmap{'API_CGI_DIR'} = File::Spec->catdir(@basedir, $package, 'api');
1598
        $dirmap{'API_CGI_DIR'}       = File::Spec->catdir( @basedir, $package, 'api' );
1522
        $dirmap{'INTRANET_CGI_DIR'} = File::Spec->catdir(@basedir, $package, 'intranet', 'cgi-bin');
1599
        $dirmap{'INTRANET_CGI_DIR'}  = File::Spec->catdir( @basedir, $package, 'intranet', 'cgi-bin' );
1523
        $dirmap{'INTRANET_TMPL_DIR'} = File::Spec->catdir(@basedir, $package, 'intranet', 'htdocs', 'intranet-tmpl');
1600
        $dirmap{'INTRANET_TMPL_DIR'} = File::Spec->catdir( @basedir, $package, 'intranet', 'htdocs', 'intranet-tmpl' );
1524
        $dirmap{'INTRANET_WWW_DIR'} = File::Spec->catdir(@basedir, $package, 'intranet', 'htdocs');
1601
        $dirmap{'INTRANET_WWW_DIR'}  = File::Spec->catdir( @basedir, $package, 'intranet', 'htdocs' );
1525
        $dirmap{'OPAC_CGI_DIR'} = File::Spec->catdir(@basedir, $package, 'opac', 'cgi-bin');
1602
        $dirmap{'OPAC_CGI_DIR'}      = File::Spec->catdir( @basedir, $package, 'opac',     'cgi-bin' );
1526
        $dirmap{'OPAC_TMPL_DIR'} = File::Spec->catdir(@basedir, $package, 'opac', 'htdocs', 'opac-tmpl');
1603
        $dirmap{'OPAC_TMPL_DIR'}     = File::Spec->catdir( @basedir, $package, 'opac',     'htdocs', 'opac-tmpl' );
1527
        $dirmap{'OPAC_WWW_DIR'} = File::Spec->catdir(@basedir, $package, 'opac', 'htdocs');
1604
        $dirmap{'OPAC_WWW_DIR'}      = File::Spec->catdir( @basedir, $package, 'opac',     'htdocs' );
1528
        $dirmap{'PERL_MODULE_DIR'} = File::Spec->catdir(@basedir, $package, 'lib');
1605
        $dirmap{'PERL_MODULE_DIR'}     = File::Spec->catdir( @basedir,              $package, 'lib' );
1529
        $dirmap{'PERL_MODULE_LIB_DIR'} = File::Spec->catdir(@basedir, $package, 'lib');
1606
        $dirmap{'PERL_MODULE_LIB_DIR'} = File::Spec->catdir( @basedir,              $package, 'lib' );
1530
        $dirmap{'KOHA_CONF_DIR'} = File::Spec->catdir(File::Spec->rootdir(), 'etc', $package);
1607
        $dirmap{'KOHA_CONF_DIR'}       = File::Spec->catdir( File::Spec->rootdir(), 'etc',    $package );
1531
        $dirmap{'ZEBRA_CONF_DIR'} = File::Spec->catdir(File::Spec->rootdir(), 'etc', $package, 'zebradb');
1608
        $dirmap{'ZEBRA_CONF_DIR'}      = File::Spec->catdir( File::Spec->rootdir(), 'etc',    $package, 'zebradb' );
1532
        $dirmap{'Z3950_CONF_DIR'} = File::Spec->catdir(File::Spec->rootdir(), 'etc', $package, 'z3950');
1609
        $dirmap{'Z3950_CONF_DIR'}      = File::Spec->catdir( File::Spec->rootdir(), 'etc',    $package, 'z3950' );
1533
        $dirmap{'MISC_DIR'} = File::Spec->catdir(@basedir, $package, 'misc');
1610
        $dirmap{'MISC_DIR'}            = File::Spec->catdir( @basedir,              $package, 'misc' );
1534
        $dirmap{'SCRIPT_DIR'} = File::Spec->catdir(@basedir, $package, 'bin');
1611
        $dirmap{'SCRIPT_DIR'}          = File::Spec->catdir( @basedir,              $package, 'bin' );
1535
        $dirmap{'SCRIPT_NONDEV_DIR'} = $dirmap{'SCRIPT_DIR'};
1612
        $dirmap{'SCRIPT_NONDEV_DIR'}   = $dirmap{'SCRIPT_DIR'};
1536
        $dirmap{'MAN_DIR'} = File::Spec->catdir(@basedir, $package, 'man');
1613
        $dirmap{'MAN_DIR'}             = File::Spec->catdir( @basedir, $package, 'man' );
1537
        $dirmap{'DOC_DIR'} = File::Spec->catdir(@basedir, $package, 'doc');
1614
        $dirmap{'DOC_DIR'}             = File::Spec->catdir( @basedir, $package, 'doc' );
1538
        $dirmap{'ZEBRA_LOCK_DIR'} = File::Spec->catdir(File::Spec->rootdir(), 'var', 'lock', $package, 'zebradb');
1615
        $dirmap{'ZEBRA_LOCK_DIR'} = File::Spec->catdir( File::Spec->rootdir(), 'var', 'lock',  $package, 'zebradb' );
1539
        $dirmap{'LOCK_DIR'} =  File::Spec->catdir(File::Spec->rootdir(), 'var', 'lock', $package);
1616
        $dirmap{'LOCK_DIR'}       = File::Spec->catdir( File::Spec->rootdir(), 'var', 'lock',  $package );
1540
        $dirmap{'LOG_DIR'} =  File::Spec->catdir(File::Spec->rootdir(), 'var', 'log', $package);
1617
        $dirmap{'LOG_DIR'}        = File::Spec->catdir( File::Spec->rootdir(), 'var', 'log',   $package );
1541
        $dirmap{'BACKUP_DIR'} =  File::Spec->catdir(File::Spec->rootdir(), 'var', 'spool', $package);
1618
        $dirmap{'BACKUP_DIR'}     = File::Spec->catdir( File::Spec->rootdir(), 'var', 'spool', $package );
1542
        $dirmap{'PLUGINS_DIR'} =  File::Spec->catdir(File::Spec->rootdir(), 'var', 'lib', $package, 'plugins');
1619
        $dirmap{'PLUGINS_DIR'}    = File::Spec->catdir( File::Spec->rootdir(), 'var', 'lib',   $package, 'plugins' );
1543
        $dirmap{'ZEBRA_DATA_DIR'} =  File::Spec->catdir(File::Spec->rootdir(), 'var', 'lib', $package, 'zebradb');
1620
        $dirmap{'ZEBRA_DATA_DIR'} = File::Spec->catdir( File::Spec->rootdir(), 'var', 'lib',   $package, 'zebradb' );
1544
        $dirmap{'ZEBRA_RUN_DIR'} =  File::Spec->catdir(File::Spec->rootdir(), 'var', 'run', $package, 'zebradb');
1621
        $dirmap{'ZEBRA_RUN_DIR'}  = File::Spec->catdir( File::Spec->rootdir(), 'var', 'run',   $package, 'zebradb' );
1545
    }
1622
    }
1546
1623
1547
    _get_env_overrides(\%dirmap);
1624
    _get_env_overrides( \%dirmap );
1548
    _get_argv_overrides(\%dirmap);
1625
    _get_argv_overrides( \%dirmap );
1549
    _add_destdir(\%dirmap);
1626
    _add_destdir( \%dirmap );
1550
1627
1551
    return \%dirmap, \%skipdirs;
1628
    return \%dirmap, \%skipdirs;
1552
}
1629
}
Lines 1561-1569 the test suite. Link Here
1561
sub get_test_dir {
1638
sub get_test_dir {
1562
    my ($dirname) = @_;
1639
    my ($dirname) = @_;
1563
1640
1564
    my @basedir = (File::Spec->rel2abs(File::Spec->curdir()), 't', 'run');
1641
    my @basedir = ( File::Spec->rel2abs( File::Spec->curdir() ), 't', 'run' );
1565
    if (exists $test_suite_override_dirs{$dirname}) {
1642
    if ( exists $test_suite_override_dirs{$dirname} ) {
1566
        return File::Spec->catdir(@basedir, @{ $test_suite_override_dirs{$dirname} });
1643
        return File::Spec->catdir( @basedir, @{ $test_suite_override_dirs{$dirname} } );
1567
    } else {
1644
    } else {
1568
        return;
1645
        return;
1569
    }
1646
    }
Lines 1573-1580 sub get_test_dir { Link Here
1573
sub _get_env_overrides {
1650
sub _get_env_overrides {
1574
    my $dirmap = shift;
1651
    my $dirmap = shift;
1575
1652
1576
    foreach my $key (keys %$dirmap) {
1653
    foreach my $key ( keys %$dirmap ) {
1577
        if (exists $ENV{$key}) {
1654
        if ( exists $ENV{$key} ) {
1578
            $dirmap->{$key} = $ENV{$key};
1655
            $dirmap->{$key} = $ENV{$key};
1579
            print "Setting $key from environment\n";
1656
            print "Setting $key from environment\n";
1580
        }
1657
        }
Lines 1585-1592 sub _get_argv_overrides { Link Here
1585
    my $dirmap = shift;
1662
    my $dirmap = shift;
1586
1663
1587
    my @new_argv = ();
1664
    my @new_argv = ();
1588
    for (my $i = 0; $i <= $#ARGV; $i++) {
1665
    for ( my $i = 0 ; $i <= $#ARGV ; $i++ ) {
1589
        if ($ARGV[$i] =~ /^([^=]+)=([^=]+)$/ and exists $dirmap->{$1}) {
1666
        if ( $ARGV[$i] =~ /^([^=]+)=([^=]+)$/ and exists $dirmap->{$1} ) {
1590
            $dirmap->{$1} = $2;
1667
            $dirmap->{$1} = $2;
1591
        } else {
1668
        } else {
1592
            push @new_argv, $ARGV[$i];
1669
            push @new_argv, $ARGV[$i];
Lines 1604-1627 sub _strip_destdir { Link Here
1604
sub _add_destdir {
1681
sub _add_destdir {
1605
    my $dirmap = shift;
1682
    my $dirmap = shift;
1606
1683
1607
    foreach my $key (keys %$dirmap) {
1684
    foreach my $key ( keys %$dirmap ) {
1608
        $dirmap->{$key} = '$(DESTDIR)'.$dirmap->{$key};
1685
        $dirmap->{$key} = '$(DESTDIR)' . $dirmap->{$key};
1609
    }
1686
    }
1610
}
1687
}
1611
1688
1612
sub display_configuration {
1689
sub display_configuration {
1613
    my $config = shift;
1690
    my $config  = shift;
1614
    my $dirmap = shift;
1691
    my $dirmap  = shift;
1615
    my @version = grep /\/usr\/share\/perl\//, @INC;
1692
    my @version = grep /\/usr\/share\/perl\//, @INC;
1616
    push @version, ('/usr/share/perl/5.10') if !$version[0];
1693
    push @version, ('/usr/share/perl/5.10') if !$version[0];
1617
    print "\n\nKoha will be installed with the following configuration parameters:\n\n";
1694
    print "\n\nKoha will be installed with the following configuration parameters:\n\n";
1618
    foreach my $key (sort keys %$config) {
1695
    foreach my $key ( sort keys %$config ) {
1619
        print sprintf("%-25.25s%s\n", $key, $config->{$key});
1696
        print sprintf( "%-25.25s%s\n", $key, $config->{$key} );
1620
    }
1697
    }
1621
1698
1622
    print "\nand in the following directories:\n\n";
1699
    print "\nand in the following directories:\n\n";
1623
    foreach my $key (sort keys %$dirmap) {
1700
    foreach my $key ( sort keys %$dirmap ) {
1624
        print sprintf("%-25.25s%s\n", $key, $dirmap->{$key});
1701
        print sprintf( "%-25.25s%s\n", $key, $dirmap->{$key} );
1625
    }
1702
    }
1626
    print "\n\nTo change any configuration setting, please run\n";
1703
    print "\n\nTo change any configuration setting, please run\n";
1627
    print "perl Makefile.PL again.  To override one of the target\n";
1704
    print "perl Makefile.PL again.  To override one of the target\n";
Lines 1645-1661 a few other directories for zebrasrv and zebraidx. Link Here
1645
1722
1646
sub find_zebra {
1723
sub find_zebra {
1647
    my @search_dirs = map {
1724
    my @search_dirs = map {
1648
                            my $abs = File::Spec->rel2abs($_);
1725
        my $abs = File::Spec->rel2abs($_);
1649
                            my ($toss, $directories);
1726
        my ( $toss, $directories );
1650
                            ($toss, $directories, $toss) = File::Spec->splitpath($abs, 1);
1727
        ( $toss, $directories, $toss ) = File::Spec->splitpath( $abs, 1 );
1651
                            $directories;
1728
        $directories;
1652
                        }  split /:/, $ENV{PATH};
1729
    } split /:/, $ENV{PATH};
1653
    push @search_dirs, qw(/usr/local/bin /opt/local/bin /usr/bin);
1730
    push @search_dirs, qw(/usr/local/bin /opt/local/bin /usr/bin);
1654
    my @zebrasrv_dirs = grep { -x File::Spec->catpath('', $_, 'zebrasrv') } @search_dirs;
1731
    my @zebrasrv_dirs = grep { -x File::Spec->catpath( '', $_, 'zebrasrv' ) } @search_dirs;
1655
    return unless @zebrasrv_dirs;
1732
    return unless @zebrasrv_dirs;
1733
1656
    # verify that directory that contains zebrasrv also contains zebraidx
1734
    # verify that directory that contains zebrasrv also contains zebraidx
1657
    foreach my $dir (@zebrasrv_dirs) {
1735
    foreach my $dir (@zebrasrv_dirs) {
1658
        return $dir if -x File::Spec->catpath('', $dir, 'zebraidx');
1736
        return $dir if -x File::Spec->catpath( '', $dir, 'zebraidx' );
1659
    }
1737
    }
1660
    return;
1738
    return;
1661
}
1739
}
Lines 1673-1731 sub test { Link Here
1673
}
1751
}
1674
1752
1675
sub install {
1753
sub install {
1676
    my $self = shift;
1754
    my $self    = shift;
1677
    my $install = "";
1755
    my $install = "";
1756
1678
    # NOTE: we're *not* doing this: my $install = $self->SUPER::install(@_);
1757
    # NOTE: we're *not* doing this: my $install = $self->SUPER::install(@_);
1679
    # This means that we're completely overriding EU::MM's default
1758
    # This means that we're completely overriding EU::MM's default
1680
    # installation and uninstallation targets.
1759
    # installation and uninstallation targets.
1681
1760
1682
    my $perl5lib_dirs = _build_perl5lib_string({ target_dirs => $target_directories });
1761
    my $perl5lib_dirs = _build_perl5lib_string( { target_dirs => $target_directories } );
1683
1762
1684
# If installation is on Win32, we need to do permissions different from *nix
1763
    # If installation is on Win32, we need to do permissions different from *nix
1685
    if ( $^O =~ /darwin|linux|cygwin|freebsd|solaris/ ) { # this value needs to be verified for each platform and modified accordingly
1764
    if ( $^O =~ /darwin|linux|cygwin|freebsd|solaris/ )
1686
	    foreach my $key (sort keys %$target_directories) {
1765
    {    # this value needs to be verified for each platform and modified accordingly
1687
		    $install .= qq(
1766
        foreach my $key ( sort keys %$target_directories ) {
1767
            $install .= qq(
1688
KOHA_INST_$key = blib/$key
1768
KOHA_INST_$key = blib/$key
1689
KOHA_DEST_$key = $target_directories->{$key}
1769
KOHA_DEST_$key = $target_directories->{$key}
1690
) unless exists $skip_directories->{$key};
1770
) unless exists $skip_directories->{$key};
1691
		}
1771
        }
1692
		$install .= qq(
1772
        $install .= qq(
1693
install :: all install_koha set_koha_ownership set_koha_permissions warn_koha_env_vars
1773
install :: all install_koha set_koha_ownership set_koha_permissions warn_koha_env_vars
1694
\t\$(NOECHO) \$(NOOP)
1774
\t\$(NOECHO) \$(NOOP)
1695
);
1775
);
1696
			$install .= "install_koha ::\n";
1776
        $install .= "install_koha ::\n";
1697
			$install .= "\t\$(NOECHO) umask 022; \$(MOD_INSTALL) \\\n";
1777
        $install .= "\t\$(NOECHO) umask 022; \$(MOD_INSTALL) \\\n";
1698
			foreach my $key (sort keys %$target_directories) {
1778
        foreach my $key ( sort keys %$target_directories ) {
1699
				$install .= "\t\t\$(KOHA_INST_$key) \$(KOHA_DEST_$key) \\\n"
1779
            $install .= "\t\t\$(KOHA_INST_$key) \$(KOHA_DEST_$key) \\\n"
1700
          unless exists $skip_directories->{$key};
1780
                unless exists $skip_directories->{$key};
1701
			}
1781
        }
1702
			$install .= "\t\t\$(INST_MAN1DIR) \$(DESTINSTALLMAN1DIR) \\\n";
1782
        $install .= "\t\t\$(INST_MAN1DIR) \$(DESTINSTALLMAN1DIR) \\\n";
1703
			$install .= "\t\t\$(INST_MAN3DIR) \$(DESTINSTALLMAN3DIR)\n";
1783
        $install .= "\t\t\$(INST_MAN3DIR) \$(DESTINSTALLMAN3DIR)\n";
1704
1784
1705
			$install .= "\n";
1785
        $install .= "\n";
1706
			$install .= "set_koha_ownership ::\n";
1786
        $install .= "set_koha_ownership ::\n";
1707
# Do not try to change ownership if DESTDIR is set
1787
1708
			if ($config{'INSTALL_MODE'} eq 'standard' and $config{'KOHA_USER'} ne "root") {
1788
        # Do not try to change ownership if DESTDIR is set
1709
				foreach my $key (sort keys %$target_directories) {
1789
        if ( $config{'INSTALL_MODE'} eq 'standard' and $config{'KOHA_USER'} ne "root" ) {
1710
            $install .= "\t\$(NOECHO) if test -z \"\$(DESTDIR)\"; then chown -R $config{'KOHA_USER'}:$config{'KOHA_GROUP'} \$(KOHA_DEST_$key); fi\n"
1790
            foreach my $key ( sort keys %$target_directories ) {
1711
            unless exists $skip_directories->{$key};
1791
                $install .=
1712
				}
1792
                    "\t\$(NOECHO) if test -z \"\$(DESTDIR)\"; then chown -R $config{'KOHA_USER'}:$config{'KOHA_GROUP'} \$(KOHA_DEST_$key); fi\n"
1713
			} else {
1793
                    unless exists $skip_directories->{$key};
1714
				$install .= "\t\t\$(NOECHO) \$(NOOP)\n\n";
1794
            }
1715
			}
1795
        } else {
1716
1796
            $install .= "\t\t\$(NOECHO) \$(NOOP)\n\n";
1717
			$install .= "\n";
1797
        }
1718
			$install .= "set_koha_permissions ::\n";
1798
1719
			# This is necessary because EU::MM installs files
1799
        $install .= "\n";
1720
			# as either 0444 or 0555, and we want the owner
1800
        $install .= "set_koha_permissions ::\n";
1721
			# of Koha's files to have write permission by default.
1801
1722
			foreach my $key (sort keys %$target_directories) {
1802
        # This is necessary because EU::MM installs files
1723
				$install .= "\t\$(NOECHO) chmod -R u+w \$(KOHA_DEST_$key)\n"
1803
        # as either 0444 or 0555, and we want the owner
1724
          unless exists $skip_directories->{$key};
1804
        # of Koha's files to have write permission by default.
1725
			}
1805
        foreach my $key ( sort keys %$target_directories ) {
1726
	}
1806
            $install .= "\t\$(NOECHO) chmod -R u+w \$(KOHA_DEST_$key)\n"
1727
1807
                unless exists $skip_directories->{$key};
1728
	$install .= "\n";
1808
        }
1809
    }
1810
1811
    $install .= "\n";
1729
1812
1730
    $install .= "warn_koha_env_vars ::\n";
1813
    $install .= "warn_koha_env_vars ::\n";
1731
    $install .= "\t\$(NOECHO) \$(ECHO)\n";
1814
    $install .= "\t\$(NOECHO) \$(ECHO)\n";
Lines 1769-1775 sub upgrade { Link Here
1769
    my $upgrade = "";
1852
    my $upgrade = "";
1770
1853
1771
    my $backup_suffix;
1854
    my $backup_suffix;
1772
    if (exists $install_log_values{'KOHA_INSTALLED_VERSION'}) {
1855
    if ( exists $install_log_values{'KOHA_INSTALLED_VERSION'} ) {
1773
        my $version = $install_log_values{'KOHA_INSTALLED_VERSION'};
1856
        my $version = $install_log_values{'KOHA_INSTALLED_VERSION'};
1774
        $version =~ s/\./_/g;
1857
        $version =~ s/\./_/g;
1775
        $backup_suffix = "_koha_$version";
1858
        $backup_suffix = "_koha_$version";
Lines 1785-1801 upgrade :: make_upgrade_backup install Link Here
1785
make_upgrade_backup ::
1868
make_upgrade_backup ::
1786
\t\$(NOECHO) umask 022; \$(MOD_BACKUP) \\
1869
\t\$(NOECHO) umask 022; \$(MOD_BACKUP) \\
1787
/;
1870
/;
1788
    foreach my $key (qw/KOHA_CONF_DIR INTRANET_TMPL_DIR INTRANET_WWW_DIR OPAC_TMPL_DIR OPAC_WWW_DIR
1871
    foreach my $key (
1789
                     ZEBRA_CONF_DIR PLUGINS_DIR/) {
1872
        qw/KOHA_CONF_DIR INTRANET_TMPL_DIR INTRANET_WWW_DIR OPAC_TMPL_DIR OPAC_WWW_DIR
1790
    	$upgrade .= "\t\t\$(KOHA_INST_$key) \$(KOHA_DEST_$key) \\\n"
1873
        ZEBRA_CONF_DIR PLUGINS_DIR/
1791
            unless exists $skip_directories->{$key} or
1874
        )
1792
                   not exists $target_directories->{$key};
1875
    {
1876
        $upgrade .= "\t\t\$(KOHA_INST_$key) \$(KOHA_DEST_$key) \\\n"
1877
            unless exists $skip_directories->{$key}
1878
            or not exists $target_directories->{$key};
1793
    }
1879
    }
1794
    $upgrade =~ s/\\\n$/\n/;
1880
    $upgrade =~ s/\\\n$/\n/;
1795
1881
1796
    return $upgrade;
1882
    return $upgrade;
1797
}
1883
}
1884
1798
sub postamble {
1885
sub postamble {
1886
1799
    # put directory mappings into Makefile
1887
    # put directory mappings into Makefile
1800
    # so that Make will export as environment
1888
    # so that Make will export as environment
1801
    # variables -- this is for the use of
1889
    # variables -- this is for the use of
Lines 1804-1820 sub postamble { Link Here
1804
    my $env;
1892
    my $env;
1805
1893
1806
    #NOTE: Build __PERL5LIB_DIRS__ for rewrite-config.PL
1894
    #NOTE: Build __PERL5LIB_DIRS__ for rewrite-config.PL
1807
    my $perl5lib_dirs = _build_perl5lib_string({ target_dirs => $target_directories });
1895
    my $perl5lib_dirs = _build_perl5lib_string( { target_dirs => $target_directories } );
1808
    if ($perl5lib_dirs){
1896
    if ($perl5lib_dirs) {
1809
        $env .= "export __PERL5LIB_DIRS__ := $perl5lib_dirs\n"
1897
        $env .= "export __PERL5LIB_DIRS__ := $perl5lib_dirs\n";
1810
    }
1898
    }
1811
1899
1812
	# Hereagain, we must alter syntax per platform...
1900
    # Hereagain, we must alter syntax per platform...
1813
        {
1901
    {
1814
		$env .= join("\n", map { "export __${_}__ := $target_directories->{$_}" } keys %$target_directories);
1902
        $env .= join( "\n", map { "export __${_}__ := $target_directories->{$_}" } keys %$target_directories );
1815
		$env .= "\n\n";
1903
        $env .= "\n\n";
1816
		$env .= join("\n", map { "export __${_}__ := $config{$_}" } keys %config);
1904
        $env .= join( "\n", map { "export __${_}__ := $config{$_}" } keys %config );
1817
	}
1905
    }
1818
1906
1819
    return "$env\n";
1907
    return "$env\n";
1820
}
1908
}
Lines 1836-1852 sub _build_perl5lib_string { Link Here
1836
    my %unique_map = ();
1924
    my %unique_map = ();
1837
    my $perl5lib_str;
1925
    my $perl5lib_str;
1838
    my $target_dirs = $args->{target_dirs};
1926
    my $target_dirs = $args->{target_dirs};
1839
    my @dir_codes = ("PERL_MODULE_DIR","PERL_MODULE_LIB_DIR");
1927
    my @dir_codes   = ( "PERL_MODULE_DIR", "PERL_MODULE_LIB_DIR" );
1840
    if ($target_dirs){
1928
    if ($target_dirs) {
1841
        foreach my $code (@dir_codes){
1929
        foreach my $code (@dir_codes) {
1842
            my $path = $target_dirs->{ $code };
1930
            my $path = $target_dirs->{$code};
1843
            if ($path){
1931
            if ($path) {
1844
                $unique_map{$path} = 1 unless $unique_map{$path};
1932
                $unique_map{$path} = 1 unless $unique_map{$path};
1845
            }
1933
            }
1846
        }
1934
        }
1847
        my @paths = sort keys %unique_map;
1935
        my @paths = sort keys %unique_map;
1848
        if (@paths){
1936
        if (@paths) {
1849
            $perl5lib_str = join(':',@paths);
1937
            $perl5lib_str = join( ':', @paths );
1850
        }
1938
        }
1851
    }
1939
    }
1852
    return $perl5lib_str;
1940
    return $perl5lib_str;
(-)a/fix-perl-path.PL (-31 / +31 lines)
Lines 20-34 use ExtUtils::MakeMaker::Config; Link Here
20
use Tie::File;
20
use Tie::File;
21
21
22
my $basedir = (shift);
22
my $basedir = (shift);
23
my $DEBUG = 0;
23
my $DEBUG   = 0;
24
24
25
$DEBUG = 1 if $basedir eq 'test';
25
$DEBUG = 1 if $basedir eq 'test';
26
26
27
my $bindir = $Config{installbin};
27
my $bindir = $Config{installbin};
28
$bindir =~ s!\\!/!g;	# make all directory separators uniform since Win32 does not care and *nix does...
28
$bindir =~ s!\\!/!g;    # make all directory separators uniform since Win32 does not care and *nix does...
29
my $shebang = "#!$bindir\/perl";
29
my $shebang = "#!$bindir\/perl";
30
30
31
warn "Perl binary located in $bindir on this system.\n" if $DEBUG;
31
warn "Perl binary located in $bindir on this system.\n"        if $DEBUG;
32
warn "The shebang line for this sytems should be $shebang\n\n" if $DEBUG;
32
warn "The shebang line for this sytems should be $shebang\n\n" if $DEBUG;
33
33
34
die if $basedir eq 'test';
34
die if $basedir eq 'test';
Lines 59-83 in a manner similar to 'fixshebang (foodir)' but may be supplied with any direct Link Here
59
59
60
=cut
60
=cut
61
61
62
sub fixshebang{
62
sub fixshebang {
63
	my $dir = shift;
63
    my $dir = shift;
64
    opendir my $dh, $dir or die $!;
64
    opendir my $dh, $dir or die $!;
65
	warn "Reading $dir contents.\n" if $DEBUG;
65
    warn "Reading $dir contents.\n" if $DEBUG;
66
    while( my $file = readdir($dh) ) {
66
    while ( my $file = readdir($dh) ) {
67
		# this may be used to exclude any desired files from the scan
67
68
        # this may be used to exclude any desired files from the scan
68
        # if ( $file =~ /foo/ ) { next; }
69
        # if ( $file =~ /foo/ ) { next; }
69
		# handle files... other extensions could be substituted/added if needed
70
        # handle files... other extensions could be substituted/added if needed
70
		if ( $file =~ /\.pl$/ ) {
71
        if ( $file =~ /\.pl$/ ) {
71
            my @filearray;
72
            my @filearray;
72
			my $pathfile =$dir . '/' . $file;
73
            my $pathfile = $dir . '/' . $file;
73
			warn "Found a perl script named $pathfile\n" if $DEBUG;
74
            warn "Found a perl script named $pathfile\n" if $DEBUG;
74
75
75
            # At this point, file is in 'blib' and by default
76
            # At this point, file is in 'blib' and by default
76
            # has mode a-w.  Therefore, must change permission
77
            # has mode a-w.  Therefore, must change permission
77
            # to make it writable.  Note that stat and chmod
78
            # to make it writable.  Note that stat and chmod
78
            # (the Perl functions) should work on Win32
79
            # (the Perl functions) should work on Win32
79
            my $old_perm;
80
            my $old_perm;
80
            $old_perm = (stat $pathfile)[2] & oct(7777);
81
            $old_perm = ( stat $pathfile )[2] & oct(7777);
81
            my $new_perm = $old_perm | oct(200);
82
            my $new_perm = $old_perm | oct(200);
82
            chmod $new_perm, $pathfile;
83
            chmod $new_perm, $pathfile;
83
84
Lines 88-117 sub fixshebang{ Link Here
88
            tie @filearray, 'Tie::File', $pathfile, recsep => "\x0a" or die $!;
89
            tie @filearray, 'Tie::File', $pathfile, recsep => "\x0a" or die $!;
89
90
90
            warn "First line of $file is $filearray[0]\n\n" if $DEBUG;
91
            warn "First line of $file is $filearray[0]\n\n" if $DEBUG;
91
			if ( ( $filearray[0] =~ /#!.*perl/ ) && ( $filearray[0] !~ /$shebang|"$shebang -w"/ ) ) {
92
            if ( ( $filearray[0] =~ /#!.*perl/ ) && ( $filearray[0] !~ /$shebang|"$shebang -w"/ ) ) {
92
				warn "\n\tRe-writing shebang line for $pathfile\n" if $DEBUG;
93
                warn "\n\tRe-writing shebang line for $pathfile\n" if $DEBUG;
93
                warn "\tOriginal shebang line: $filearray[0]\n" if $DEBUG;
94
                warn "\tOriginal shebang line: $filearray[0]\n"    if $DEBUG;
94
                $filearray[0] =~ /-w$/ ? $filearray[0] = "$shebang -w" : $filearray[0] = $shebang;
95
                $filearray[0] =~ /-w$/ ? $filearray[0] = "$shebang -w" : $filearray[0] = $shebang;
95
                warn "\tNew shebang line is: $filearray[0]\n\n" if $DEBUG;
96
                warn "\tNew shebang line is: $filearray[0]\n\n" if $DEBUG;
96
			}
97
            } elsif ( $filearray[0] =~ /$shebang|"$shebang -w"/ ) {
97
            elsif ( $filearray[0] =~ /$shebang|"$shebang -w"/ ) {
98
                warn "\n\tShebang line is correct.\n\n" if $DEBUG;
98
                warn "\n\tShebang line is correct.\n\n" if $DEBUG;
99
            }
99
            } else {
100
			else {
101
                warn "\n\tNo shebang line found in $pathfile\n\n" if $DEBUG;
100
                warn "\n\tNo shebang line found in $pathfile\n\n" if $DEBUG;
102
			}
101
            }
103
            untie @filearray;
102
            untie @filearray;
104
            chmod $old_perm, $pathfile;
103
            chmod $old_perm, $pathfile;
105
		}
104
        }
106
		# handle directories
105
107
		elsif ( -d ($dir . '/' . $file) && $file !~ /^\.{1,2}/ ) {
106
        # handle directories
108
			my $dirpath = $dir . '/' . $file;
107
        elsif ( -d ( $dir . '/' . $file ) && $file !~ /^\.{1,2}/ ) {
109
			warn "Found a subdir named $dirpath\n" if $DEBUG;
108
            my $dirpath = $dir . '/' . $file;
110
			fixshebang ($dirpath);
109
            warn "Found a subdir named $dirpath\n" if $DEBUG;
111
		}
110
            fixshebang($dirpath);
112
	}
111
        }
113
	closedir $dh;
112
    }
113
    closedir $dh;
114
}
114
}
115
115
116
fixshebang ($basedir);
116
fixshebang($basedir);
117
117
(-)a/rewrite-config.PL (-95 / +94 lines)
Lines 16-22 Link Here
16
# along with Koha; if not, see <http://www.gnu.org/licenses>.
16
# along with Koha; if not, see <http://www.gnu.org/licenses>.
17
#
17
#
18
# Current maintainer MJR http://mjr.towers.org.uk/
18
# Current maintainer MJR http://mjr.towers.org.uk/
19
# 
19
#
20
# 2007/11/12	Added DB_PORT and changed other keywords to reflect multi-dbms support.	-fbcit
20
# 2007/11/12	Added DB_PORT and changed other keywords to reflect multi-dbms support.	-fbcit
21
21
22
use Modern::Perl;
22
use Modern::Perl;
Lines 71-177 if ( $myhost = $ENV{WEBSERVER_HOST} || hostname ) { Link Here
71
71
72
my $myip;
72
my $myip;
73
unless ( $myip = $ENV{WEBSERVER_IP} ) {
73
unless ( $myip = $ENV{WEBSERVER_IP} ) {
74
    my $byname = gethostbyname( $myhost )
74
    my $byname = gethostbyname($myhost)
75
	or die "Could not get the IP address of $myhost, DNS fault? ($!)";
75
        or die "Could not get the IP address of $myhost, DNS fault? ($!)";
76
    $myip = inet_ntoa $byname
76
    $myip = inet_ntoa $byname
77
	or die "can't inet_ntoa ($!)";
77
        or die "can't inet_ntoa ($!)";
78
}
78
}
79
79
80
81
my $prefix = $ENV{'INSTALL_BASE'} || "/usr";
80
my $prefix = $ENV{'INSTALL_BASE'} || "/usr";
82
81
83
# These are our configuration guesses
82
# These are our configuration guesses
84
# Keys were extracted by
83
# Keys were extracted by
85
# <grep -o '__.*__' etc/* | cut -f2 -d: | sort -u | sed -e 's/^/  "/;s/$/" => "",/'
84
# <grep -o '__.*__' etc/* | cut -f2 -d: | sort -u | sed -e 's/^/  "/;s/$/" => "",/'
86
my %configuration = (
85
my %configuration = (
87
  "__KOHA_INSTALLED_VERSION__" => "no_version_found",
86
    "__KOHA_INSTALLED_VERSION__"     => "no_version_found",
88
  "__LOG_DIR__" => "/var/log",
87
    "__LOG_DIR__"                    => "/var/log",
89
  "__PLUGINS_DIR__" => "/var/lib/koha/plugins",
88
    "__PLUGINS_DIR__"                => "/var/lib/koha/plugins",
90
  "__DB_TYPE__" => "mysql",
89
    "__DB_TYPE__"                    => "mysql",
91
  "__DB_NAME__" => "koha",
90
    "__DB_NAME__"                    => "koha",
92
  "__DB_HOST__" => $myhost,
91
    "__DB_HOST__"                    => $myhost,
93
  "__DB_PORT__" => "3306",
92
    "__DB_PORT__"                    => "3306",
94
  "__DB_USER__" => "kohaadmin",
93
    "__DB_USER__"                    => "kohaadmin",
95
  "__DB_PASS__" => "katikoan",
94
    "__DB_PASS__"                    => "katikoan",
96
  "__DB_USE_TLS__" => "no",
95
    "__DB_USE_TLS__"                 => "no",
97
  "__DB_TLS_CA_CERTIFICATE__" => "",
96
    "__DB_TLS_CA_CERTIFICATE__"      => "",
98
  "__DB_TLS_CLIENT_CERTIFICATE__" => "",
97
    "__DB_TLS_CLIENT_CERTIFICATE__"  => "",
99
  "__DB_TLS_CLIENT_KEY__"=>"",
98
    "__DB_TLS_CLIENT_KEY__"          => "",
100
  "__WEBMASTER_EMAIL__" => 'webmaster@'.$mydomain,
99
    "__WEBMASTER_EMAIL__"            => 'webmaster@' . $mydomain,
101
  "__WEBSERVER_DOMAIN__" => $mydomain,
100
    "__WEBSERVER_DOMAIN__"           => $mydomain,
102
  "__WEBSERVER_HOST__" => $myhost,
101
    "__WEBSERVER_HOST__"             => $myhost,
103
  "__WEBSERVER_IP__" => $myip,
102
    "__WEBSERVER_IP__"               => $myip,
104
  "__WEBSERVER_PORT__" => "80",
103
    "__WEBSERVER_PORT__"             => "80",
105
  "__WEBSERVER_PORT_LIBRARIAN__" => "8080",
104
    "__WEBSERVER_PORT_LIBRARIAN__"   => "8080",
106
  "__ZEBRA_SRU_HOST__" => $myhost,
105
    "__ZEBRA_SRU_HOST__"             => $myhost,
107
  "__ZEBRA_SRU_BIBLIOS_PORT__" => "9998",
106
    "__ZEBRA_SRU_BIBLIOS_PORT__"     => "9998",
108
  "__ZEBRA_SRU_AUTHORITIES_PORT__" => "9999",
107
    "__ZEBRA_SRU_AUTHORITIES_PORT__" => "9999",
109
  "__KOHA_USER__" => "koha",
108
    "__KOHA_USER__"                  => "koha",
110
  "__KOHA_GROUP__" => "koha",
109
    "__KOHA_GROUP__"                 => "koha",
111
  "__ZEBRA_PASS__" => "zebrastripes",
110
    "__ZEBRA_PASS__"                 => "zebrastripes",
112
  "__ZEBRA_USER__" => "kohauser",
111
    "__ZEBRA_USER__"                 => "kohauser",
113
  '__BACKUP_DIR__' => "$prefix/var/spool",
112
    '__BACKUP_DIR__'                 => "$prefix/var/spool",
114
  '__API_CGI_DIR__' => "$prefix/api",
113
    '__API_CGI_DIR__'                => "$prefix/api",
115
  '__INTRANET_CGI_DIR__' => "$prefix/intranet/cgi-bin",
114
    '__INTRANET_CGI_DIR__'           => "$prefix/intranet/cgi-bin",
116
  '__INTRANET_TMPL_DIR__' => "$prefix/intranet/templates",
115
    '__INTRANET_TMPL_DIR__'          => "$prefix/intranet/templates",
117
  '__INTRANET_WWW_DIR__' => "$prefix/intranet/www",
116
    '__INTRANET_WWW_DIR__'           => "$prefix/intranet/www",
118
  '__OPAC_CGI_DIR__' => "$prefix/opac/cgi-bin",
117
    '__OPAC_CGI_DIR__'               => "$prefix/opac/cgi-bin",
119
  '__OPAC_TMPL_DIR__' => "$prefix/opac/templates",
118
    '__OPAC_TMPL_DIR__'              => "$prefix/opac/templates",
120
  '__OPAC_WWW_DIR__' => "$prefix/opac/www",
119
    '__OPAC_WWW_DIR__'               => "$prefix/opac/www",
121
  '__PERL_MODULE_DIR__' =>  ($ENV{'INSTALLSITELIB'} || sprintf($prefix."/lib/perl5/site_perl/%vd",$^V))."/koha",
120
    '__PERL_MODULE_DIR__' => ( $ENV{'INSTALLSITELIB'} || sprintf( $prefix . "/lib/perl5/site_perl/%vd", $^V ) )
122
  '__KOHA_CONF_DIR__' => "$prefix/etc/koha",
121
        . "/koha",
123
  '__ZEBRA_CONF_DIR__' => "$prefix/etc/koha/zebradb",
122
    '__KOHA_CONF_DIR__'         => "$prefix/etc/koha",
124
  '__MISC_DIR__' => "$prefix/misc",
123
    '__ZEBRA_CONF_DIR__'        => "$prefix/etc/koha/zebradb",
125
  '__SCRIPT_DIR__' => "$prefix/bin",
124
    '__MISC_DIR__'              => "$prefix/misc",
126
  '__SCRIPT_NONDEV_DIR__' => "$prefix/bin",
125
    '__SCRIPT_DIR__'            => "$prefix/bin",
127
  '__MAN_DIR__' => "$prefix/man",
126
    '__SCRIPT_NONDEV_DIR__'     => "$prefix/bin",
128
  '__DOC_DIR__' => "$prefix/doc",
127
    '__MAN_DIR__'               => "$prefix/man",
129
  '__ZEBRA_LOCK_DIR__' => "$prefix/var/lock/zebradb",
128
    '__DOC_DIR__'               => "$prefix/doc",
130
  '__ZEBRA_DATA_DIR__' => "$prefix/var/lib/zebradb",
129
    '__ZEBRA_LOCK_DIR__'        => "$prefix/var/lock/zebradb",
131
  '__ZEBRA_RUN_DIR__' => "$prefix/var/run/zebradb",
130
    '__ZEBRA_DATA_DIR__'        => "$prefix/var/lib/zebradb",
132
  '__ZEBRA_MARC_FORMAT__' => 'marc21',
131
    '__ZEBRA_RUN_DIR__'         => "$prefix/var/run/zebradb",
133
  '__ZEBRA_LANGUAGE__' => 'en',
132
    '__ZEBRA_MARC_FORMAT__'     => 'marc21',
134
  '__ZEBRA_TOKENIZER__' => 'chr',
133
    '__ZEBRA_LANGUAGE__'        => 'en',
135
  '__ZEBRA_TOKENIZER_STMT__' => 'charmap word-phrase-utf.chr',
134
    '__ZEBRA_TOKENIZER__'       => 'chr',
136
  '__ZEBRA_PTOKENIZER_STMT__' => 'charmap word-phrase-utf.chr',
135
    '__ZEBRA_TOKENIZER_STMT__'  => 'charmap word-phrase-utf.chr',
137
  '__AUTH_RETRIEVAL_CFG__' => 'retrieval-info-auth-dom.xml',
136
    '__ZEBRA_PTOKENIZER_STMT__' => 'charmap word-phrase-utf.chr',
138
  '__BIB_RETRIEVAL_CFG__' => 'retrieval-info-bib-dom.xml',
137
    '__AUTH_RETRIEVAL_CFG__'    => 'retrieval-info-auth-dom.xml',
139
  '__ZEBRA_AUTH_CFG__' => 'zebra-authorities-dom.cfg',
138
    '__BIB_RETRIEVAL_CFG__'     => 'retrieval-info-bib-dom.xml',
140
  '__ZEBRA_BIB_CFG__' => 'zebra-biblios-dom.cfg',
139
    '__ZEBRA_AUTH_CFG__'        => 'zebra-authorities-dom.cfg',
141
  "__MERGE_SERVER_HOST__" => $myhost,
140
    '__ZEBRA_BIB_CFG__'         => 'zebra-biblios-dom.cfg',
142
  "__INSTALL_MODE__" => 'standard',
141
    "__MERGE_SERVER_HOST__"     => $myhost,
143
  "__INSTALL_BASE__" => '/usr/share/koha',
142
    "__INSTALL_MODE__"          => 'standard',
144
  "__INSTALL_SRU__" => 'yes',
143
    "__INSTALL_BASE__"          => '/usr/share/koha',
145
  "__RUN_DATABASE_TESTS__" => 'no',
144
    "__INSTALL_SRU__"           => 'yes',
146
  "__PATH_TO_ZEBRA__" => "",
145
    "__RUN_DATABASE_TESTS__"    => 'no',
147
  "__USE_MEMCACHED__" => 'yes',
146
    "__PATH_TO_ZEBRA__"         => "",
148
  "__MEMCACHED_SERVERS__" => "",
147
    "__USE_MEMCACHED__"         => 'yes',
149
  "__MEMCACHED_NAMESPACE__" => "",
148
    "__MEMCACHED_SERVERS__"     => "",
150
  "__USE_ELASTICSEARCH__" => 'no',
149
    "__MEMCACHED_NAMESPACE__"   => "",
151
  "__ELASTICSEARCH_SERVERS__" => "localhost:9200",
150
    "__USE_ELASTICSEARCH__"     => 'no',
152
  "__ELASTICSEARCH_INDEX__" => "koha",
151
    "__ELASTICSEARCH_SERVERS__" => "localhost:9200",
153
  "__FONT_DIR__" => "/usr/share/fonts/truetype/dejavu",
152
    "__ELASTICSEARCH_INDEX__"   => "koha",
154
  "__TEMPLATE_CACHE_DIR__" => "/tmp/koha",
153
    "__FONT_DIR__"              => "/usr/share/fonts/truetype/dejavu",
155
  '__SMTP_HOST__'      => 'localhost',
154
    "__TEMPLATE_CACHE_DIR__"    => "/tmp/koha",
156
  '__SMTP_PORT__'      => '25',
155
    '__SMTP_HOST__'             => 'localhost',
157
  '__SMTP_TIMEOUT__'   => '120',
156
    '__SMTP_PORT__'             => '25',
158
  '__SMTP_SSL_MODE__'  => 'disabled',
157
    '__SMTP_TIMEOUT__'          => '120',
159
  '__SMTP_USER_NAME__' => '',
158
    '__SMTP_SSL_MODE__'         => 'disabled',
160
  '__SMTP_PASSWORD__'  => '',
159
    '__SMTP_USER_NAME__'        => '',
161
  '__SMTP_DEBUG__'     => '0',
160
    '__SMTP_PASSWORD__'         => '',
162
  '__PERL_MODULE_LIB_DIR__'  => "$prefix/lib",
161
    '__SMTP_DEBUG__'            => '0',
163
  '__PERL5LIB_DIRS__'  => "$prefix/lib",
162
    '__PERL_MODULE_LIB_DIR__'   => "$prefix/lib",
163
    '__PERL5LIB_DIRS__'         => "$prefix/lib",
164
);
164
);
165
165
166
# Override configuration from the environment
166
# Override configuration from the environment
167
foreach my $key (keys %configuration) {
167
foreach my $key ( keys %configuration ) {
168
  if (defined($ENV{$key})) {
168
    if ( defined( $ENV{$key} ) ) {
169
    $configuration{$key} = $ENV{$key};
169
        $configuration{$key} = $ENV{$key};
170
  }
170
    }
171
}
171
}
172
172
173
my $fname = $ARGV[0];
173
my $fname = $ARGV[0];
174
my $file = &read_file($fname);
174
my $file  = &read_file($fname);
175
$file =~ s/__.*?__/exists $configuration{$&} ? $configuration{$&} : $&/seg;
175
$file =~ s/__.*?__/exists $configuration{$&} ? $configuration{$&} : $&/seg;
176
176
177
# At this point, file is in 'blib' and by default
177
# At this point, file is in 'blib' and by default
Lines 179-189 $file =~ s/__.*?__/exists $configuration{$&} ? $configuration{$&} : $&/seg; Link Here
179
# to make it writable.  Note that stat and chmod
179
# to make it writable.  Note that stat and chmod
180
# (the Perl functions) should work on Win32
180
# (the Perl functions) should work on Win32
181
my $old_perm;
181
my $old_perm;
182
$old_perm = (stat $fname)[2] & oct(7777);
182
$old_perm = ( stat $fname )[2] & oct(7777);
183
my $new_perm = $old_perm | oct(200);
183
my $new_perm = $old_perm | oct(200);
184
chmod $new_perm, $fname;
184
chmod $new_perm, $fname;
185
185
186
open(my $output, ">", $fname) || die "Can't open $fname for write: $!";
186
open( my $output, ">", $fname ) || die "Can't open $fname for write: $!";
187
print $output $file;
187
print $output $file;
188
close($output);
188
close($output);
189
189
Lines 191-201 chmod $old_perm, $fname; Link Here
191
191
192
# Idea taken from perlfaq5
192
# Idea taken from perlfaq5
193
sub read_file {
193
sub read_file {
194
  local $/;
194
    local $/;
195
  open(my $fh , '<', $_[0]) || die "Can't open $_[0] for read";
195
    open( my $fh, '<', $_[0] ) || die "Can't open $_[0] for read";
196
  my $file = <$fh>;
196
    my $file = <$fh>;
197
  close $fh;
197
    close $fh;
198
  return $file;
198
    return $file;
199
}
199
}
200
200
201
__END__
201
__END__
202
- 

Return to bug 39149