Check the hostname setting in koha-conf.xml.
Some database servers require 127.0.0.1 rather than localhost.
Please correct these errors and start the installer again.
diff --git a/members/member-password.pl b/members/member-password.pl
index 62adb79aa5..183d2d3484 100755
--- a/members/member-password.pl
+++ b/members/member-password.pl
@@ -40,7 +40,7 @@ my $errormsg;
my ($bor)=GetMember($member);
if(( $member ne $loggedinuser ) && ($bor->{'category_type'} eq 'S' ) ) {
$errormsg = 'NOPERMISSION' unless($staffflags->{'superlibrarian'} || $staffflags->{'staffaccess'} );
- # need superlibrarian for koha.xml fakeuser.
+ # need superlibrarian for koha-conf.xml fakeuser.
}
my $newpassword = $input->param('newpassword');
my $minpw = C4::Context->preference('minPasswordLength');
diff --git a/misc/cronjobs/build_browser_and_cloud.pl b/misc/cronjobs/build_browser_and_cloud.pl
index 02ddcb0e9b..d8045d6b28 100755
--- a/misc/cronjobs/build_browser_and_cloud.pl
+++ b/misc/cronjobs/build_browser_and_cloud.pl
@@ -34,7 +34,7 @@ if ($version || (!$confirm)) {
-t TTT to define the MARC fields/subfield to use to fill the tag cloud. If not defined, the cloud table won't be filled.
example :
- export PERL5LIB=/path/to/koha;export KOHA_CONF=/etc/koha.xml;./build_browser_and_cloud.pl -b -f 676a -t 606 -c
+ export PERL5LIB=/path/to/koha;export KOHA_CONF=/etc/koha/koha-conf.xml;./build_browser_and_cloud.pl -b -f 676a -t 606 -c
EOF
;
exit;
From dd7b1da0cf8c6cfb74a9a50b58e8e9932aeaefbb Mon Sep 17 00:00:00 2001
From: Galen Charlton
Date: Thu, 13 Dec 2007 16:46:33 -0600
Subject: [PATCH 39/57] installer: made kohaversion.pl source for package
version number
Version now taken from kohaversion.pl instead of
C4/Context.pm, aligning installer with the rest
of Koha's internal version checks.
---
Makefile.PL | 2 +-
kohaversion.pl | 8 +++++++-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/Makefile.PL b/Makefile.PL
index c529ad0cab..bcc5b85a53 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -418,7 +418,7 @@ if ($config{'INSTALL_MODE'} ne "dev") {
WriteMakefile(
NAME => 'koha',
#VERSION => strftime('2.9.%Y%m%d%H',gmtime),
- VERSION_FROM => 'C4/Context.pm',
+ VERSION_FROM => 'kohaversion.pl',
ABSTRACT => 'Award-winning integrated library system (ILS) and Web OPAC',
AUTHOR => 'Koha Developers ',
NO_META => 1,
diff --git a/kohaversion.pl b/kohaversion.pl
index a6c2654e93..c96a9da1e2 100644
--- a/kohaversion.pl
+++ b/kohaversion.pl
@@ -7,8 +7,14 @@
# used by developers when the database changes. updatedatabase take care of the changes itself
# and is automatically called by Auth.pm when needed.
+use strict;
+
sub kohaversion {
- return "3.00.00.035";
+ our $VERSION = "3.00.00.35";
+ # version needs to be set this way
+ # so that it can be picked up by Makefile.PL
+ # during install
+ return $VERSION;
}
1;
From d6eba778699c2432b11d994130011d5ad071f316 Mon Sep 17 00:00:00 2001
From: Galen Charlton
Date: Thu, 13 Dec 2007 17:37:22 -0600
Subject: [PATCH 40/57] installer: now can use env vars to set installation
variables
* Set default value for named parameters, e.g., DB_USER
* Override directory targets, e.g., KOHA_CONF_DIR
---
Makefile.PL | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/Makefile.PL b/Makefile.PL
index bcc5b85a53..43cc8675eb 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -820,6 +820,8 @@ Please specify the Zebra database password);
$config{'ZEBRA_PASS'} = _get_value('ZEBRA_PASS', $msg, $defaults->{'ZEBRA_PASS'}, $valid_values);
}
+
+ print "\n\n";
return %config;
}
@@ -840,6 +842,12 @@ sub _get_value {
my $default = shift;
my $valid_values = shift;
+ # override default value from environment
+ if (exists $ENV{$key}) {
+ $default = $ENV{$key};
+ $msg .= " (default from environment)";
+ }
+
my $val = prompt($msg, $default);
while (exists $valid_values->{$key} and not exists $valid_values->{$key}->{$val}) {
my $retry_msg = "Value '$val' is not a valid option.\n";
@@ -941,11 +949,23 @@ sub get_target_directories {
$dirmap{'ZEBRA_RUN_DIR'} = File::Spec->catdir(File::Spec->rootdir(), 'var', 'run', $package, 'zebradb');
}
+ _get_env_overrides(\%dirmap);
_get_argv_overrides(\%dirmap);
return \%dirmap, \%skipdirs;
}
+sub _get_env_overrides {
+ my $dirmap = shift;
+
+ foreach my $key (keys %$dirmap) {
+ if (exists $ENV{$key}) {
+ $dirmap->{$key} = $ENV{$key};
+ print "Setting $key from environment\n";
+ }
+ }
+}
+
sub _get_argv_overrides {
my $dirmap = shift;
@@ -976,6 +996,13 @@ sub display_configuration {
print "perl Makefile.PL again. To override one of the target\n";
print "directories, you can do so on the command line like this:\n";
print "\nperl Makefile.PL PERL_MODULE_DIR=/usr/share/perl/5.8\n\n";
+ print "You can also set different default values for parameters\n";
+ print "or override directory locations by using environment variables.\n";
+ print "\nFor example:\n\n";
+ print "export DB_USER=my_koha\n";
+ print "perl Makefile.PL\n";
+ print "\nor\n\n";
+ print "DB_USER=my_koha DOC_DIR=/usr/local/info perl Makefile.PL\n\n";
}
package MY;
From c1004a7b484e857fe1dae977e75ee5050c5d1e9f Mon Sep 17 00:00:00 2001
From: Galen Charlton
Date: Fri, 14 Dec 2007 10:07:51 -0600
Subject: [PATCH 41/57] installer: fix MARC::Crosswalk::DublinCore version
---
Makefile.PL | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile.PL b/Makefile.PL
index 43cc8675eb..b3b5002aa7 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -447,7 +447,7 @@ WriteMakefile(
'List::Util' => 1.18,
'Locale::Language' => 2.07,
'MARC::Charset' => 0.98,
-'MARC::Crosswalk::DublinCore' => 0.03,
+'MARC::Crosswalk::DublinCore' => 0.02,
'MARC::File::XML' => 0.88,
'MARC::Record' => 2.00,
'MIME::Base64' => 3.07,
From b8a58c493493f8c9aa16a9ce621609c6dcb4a5f6 Mon Sep 17 00:00:00 2001
From: Galen Charlton
Date: Fri, 14 Dec 2007 14:24:19 -0600
Subject: [PATCH 42/57] installer: command-line scripts improve finding C4
modules
Command-line scripts now use a new SCRIPT_DIR/kohalib.pl
to put installed location of Koha's Perl modules
into @INC.
---
Makefile.PL | 3 +-
misc/benchmark.pl | 8 ++-
misc/bulkauthimport.pl | 6 +++
misc/bulkupdate.pl | 8 ++-
misc/cleanmarcdb.pl | 6 +++
misc/commit_biblios_file.pl | 6 +++
misc/compare_iso_and_marc_parameters.pl | 6 +++
misc/cronjobs/build_browser_and_cloud.pl | 6 +++
misc/cronjobs/j2a.pl | 7 +++
misc/cronjobs/longoverdue.pl | 8 ++-
misc/cronjobs/notifyMailsOp.pl | 6 +++
misc/cronjobs/overduenotices-30.pl | 6 +++
misc/cronjobs/overduenotices.pl | 6 +++
misc/cronjobs/reservefix.pl | 8 ++-
misc/cronjobs/services_throttle.pl | 6 +++
misc/cronjobs/smsoverdues.pl | 7 +++
misc/cronjobs/update_items.pl | 6 +++
misc/cronjobs/zebraqueue_start.pl | 7 ++-
misc/dumpmarc.pl | 6 +++
misc/exportauth.pl | 6 +++
misc/fines-sanop.pl | 8 ++-
misc/fines2.pl | 9 +++-
misc/kohalib.pl | 51 +++++++++++++++++++
misc/marcimport_to_biblioitems.pl | 6 +++
misc/merge_authority.pl | 6 +++
.../22_to_30/convert_to_utf8.pl | 8 ++-
.../22_to_30/export_Authorities.pl | 6 +++
.../22_to_30/export_Authorities_xml.pl | 6 +++
.../22_to_30/missing090field.pl | 6 +++
.../22_to_30/move_marc_to_authheader.pl | 7 ++-
.../22_to_30/move_marc_to_biblioitems.pl | 9 +++-
.../22_to_30/rebuild_leader.pl | 6 +++
.../22_to_30/rebuild_unimarc_100.pl | 6 +++
misc/migration_tools/bulkmarcimport.pl | 6 +++
misc/missing090field.pl | 6 +++
misc/rebuild_marc_newframework.pl | 6 +++
misc/rebuildnonmarc.pl | 6 +++
.../make_spellcheck_suggest.pl | 8 ++-
misc/stage_biblios_file.pl | 6 +++
misc/sync_koha_plugin.pl | 6 +++
misc/xmlintobiblioitems.pl | 8 ++-
misc/zebraqueue_daemon.pl | 6 +++
42 files changed, 303 insertions(+), 17 deletions(-)
create mode 100644 misc/kohalib.pl
diff --git a/Makefile.PL b/Makefile.PL
index b3b5002aa7..9898c846e5 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -411,7 +411,8 @@ if ($config{'INSTALL_ZEBRA'} eq "yes") {
if ($config{'INSTALL_MODE'} ne "dev") {
push @{ $pl_files->{'rewrite-config.PL'} }, (
- 'blib/PERL_MODULE_DIR/C4/Context.pm'
+ 'blib/PERL_MODULE_DIR/C4/Context.pm',
+ 'blib/SCRIPT_DIR/kohalib.pl'
);
}
diff --git a/misc/benchmark.pl b/misc/benchmark.pl
index b3f5458a14..5d7608446d 100755
--- a/misc/benchmark.pl
+++ b/misc/benchmark.pl
@@ -1,8 +1,14 @@
#!/usr/bin/perl
+use strict;
+BEGIN {
+ # find Koha's Perl modules
+ # test carefully before changing this
+ use FindBin;
+ eval { require "$FindBin::Bin/kohalib.pl" };
+}
use HTTPD::Bench::ApacheBench;
use C4::Context;
-use strict;
# 1st, find some maximal values
my $dbh=C4::Context->dbh();
diff --git a/misc/bulkauthimport.pl b/misc/bulkauthimport.pl
index 285903e0d9..cd80aba024 100755
--- a/misc/bulkauthimport.pl
+++ b/misc/bulkauthimport.pl
@@ -2,6 +2,12 @@
# small script that import an iso2709 file into koha 2.0
use strict;
+BEGIN {
+ # find Koha's Perl modules
+ # test carefully before changing this
+ use FindBin;
+ eval { require "$FindBin::Bin/kohalib.pl" };
+}
# Koha modules used
use MARC::File::USMARC;
diff --git a/misc/bulkupdate.pl b/misc/bulkupdate.pl
index 385f6f2165..66ccc0a52a 100755
--- a/misc/bulkupdate.pl
+++ b/misc/bulkupdate.pl
@@ -23,7 +23,13 @@
=cut
-
+use strict;
+BEGIN {
+ # find Koha's Perl modules
+ # test carefully before changing this
+ use FindBin;
+ eval { require "$FindBin::Bin/kohalib.pl" };
+}
use C4::Context;
use MARC::File::XML;
use MARC::Record;
diff --git a/misc/cleanmarcdb.pl b/misc/cleanmarcdb.pl
index 682e473ec1..04c071ad5a 100755
--- a/misc/cleanmarcdb.pl
+++ b/misc/cleanmarcdb.pl
@@ -2,6 +2,12 @@
# small script that rebuilds the non-MARC DB
use strict;
+BEGIN {
+ # find Koha's Perl modules
+ # test carefully before changing this
+ use FindBin;
+ eval { require "$FindBin::Bin/kohalib.pl" };
+}
# Koha modules used
# use MARC::File::USMARC;
diff --git a/misc/commit_biblios_file.pl b/misc/commit_biblios_file.pl
index f0cbd06d3e..4c8d8ac3d1 100755
--- a/misc/commit_biblios_file.pl
+++ b/misc/commit_biblios_file.pl
@@ -1,6 +1,12 @@
#!/usr/bin/perl
use strict;
+BEGIN {
+ # find Koha's Perl modules
+ # test carefully before changing this
+ use FindBin;
+ eval { require "$FindBin::Bin/kohalib.pl" };
+}
use C4::Context;
use C4::ImportBatch;
diff --git a/misc/compare_iso_and_marc_parameters.pl b/misc/compare_iso_and_marc_parameters.pl
index 46a12a1f16..e3f86b6173 100755
--- a/misc/compare_iso_and_marc_parameters.pl
+++ b/misc/compare_iso_and_marc_parameters.pl
@@ -3,6 +3,12 @@
use strict;
+BEGIN {
+ # find Koha's Perl modules
+ # test carefully before changing this
+ use FindBin;
+ eval { require "$FindBin::Bin/kohalib.pl" };
+}
# Koha modules used
use C4::Context;
diff --git a/misc/cronjobs/build_browser_and_cloud.pl b/misc/cronjobs/build_browser_and_cloud.pl
index d8045d6b28..f4546e928c 100755
--- a/misc/cronjobs/build_browser_and_cloud.pl
+++ b/misc/cronjobs/build_browser_and_cloud.pl
@@ -2,6 +2,12 @@
# small script that builds the tag cloud
use strict;
+BEGIN {
+ # find Koha's Perl modules
+ # test carefully before changing this
+ use FindBin;
+ eval { require "$FindBin::Bin/../kohalib.pl" };
+}
use C4::Koha;
use C4::Context;
diff --git a/misc/cronjobs/j2a.pl b/misc/cronjobs/j2a.pl
index d83ec4bd4b..de648ca290 100755
--- a/misc/cronjobs/j2a.pl
+++ b/misc/cronjobs/j2a.pl
@@ -1,6 +1,13 @@
#!/usr/bin/perl
#run nightly -- changes J to A on someone's 18th birthday
use strict;
+BEGIN {
+ # find Koha's Perl modules
+ # test carefully before changing this
+ use FindBin;
+ eval { require "$FindBin::Bin/../kohalib.pl" };
+}
+
use C4::Context;
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)
= localtime(time);
diff --git a/misc/cronjobs/longoverdue.pl b/misc/cronjobs/longoverdue.pl
index 000d662a47..256cd856fe 100755
--- a/misc/cronjobs/longoverdue.pl
+++ b/misc/cronjobs/longoverdue.pl
@@ -12,9 +12,13 @@
# 1.0.0 2004/04/01: original version
#-----------------------------------
-use lib '/usr/local/koha/intranet/modules/';
-
use strict;
+BEGIN {
+ # find Koha's Perl modules
+ # test carefully before changing this
+ use FindBin;
+ eval { require "$FindBin::Bin/../kohalib.pl" };
+}
use C4::Context;
my $dbh = C4::Context->dbh;
diff --git a/misc/cronjobs/notifyMailsOp.pl b/misc/cronjobs/notifyMailsOp.pl
index 54811a0d7c..720ffbc077 100755
--- a/misc/cronjobs/notifyMailsOp.pl
+++ b/misc/cronjobs/notifyMailsOp.pl
@@ -1,4 +1,10 @@
use strict;
+BEGIN {
+ # find Koha's Perl modules
+ # test carefully before changing this
+ use FindBin;
+ eval { require "$FindBin::Bin/../kohalib.pl" };
+}
use C4::Context;
use C4::Dates qw/format_date/;
use Mail::Sendmail; # comment out if not doing e-mail notices
diff --git a/misc/cronjobs/overduenotices-30.pl b/misc/cronjobs/overduenotices-30.pl
index 6ffe7b435a..b493f989b7 100755
--- a/misc/cronjobs/overduenotices-30.pl
+++ b/misc/cronjobs/overduenotices-30.pl
@@ -30,6 +30,12 @@
# Suite 330, Boston, MA 02111-1307 USA
use strict;
+BEGIN {
+ # find Koha's Perl modules
+ # test carefully before changing this
+ use FindBin;
+ eval { require "$FindBin::Bin/../kohalib.pl" };
+}
use C4::Context;
use C4::Dates qw/format_date/;
use Mail::Sendmail; # comment out if not doing e-mail notices
diff --git a/misc/cronjobs/overduenotices.pl b/misc/cronjobs/overduenotices.pl
index 0366cfa26f..9bfdecb32e 100755
--- a/misc/cronjobs/overduenotices.pl
+++ b/misc/cronjobs/overduenotices.pl
@@ -35,6 +35,12 @@
# Suite 330, Boston, MA 02111-1307 USA
use strict;
+BEGIN {
+ # find Koha's Perl modules
+ # test carefully before changing this
+ use FindBin;
+ eval { require "$FindBin::Bin/../kohalib.pl" };
+}
use C4::Context;
use C4::Dates;
use Mail::Sendmail; # comment out if not doing e-mail notices
diff --git a/misc/cronjobs/reservefix.pl b/misc/cronjobs/reservefix.pl
index 61b9956a26..aac1cfd365 100755
--- a/misc/cronjobs/reservefix.pl
+++ b/misc/cronjobs/reservefix.pl
@@ -12,9 +12,13 @@
# 1.0.0 2004/02/22: original version
#-----------------------------------
-use lib '/usr/local/koha/intranet/modules/';
-
use strict;
+BEGIN {
+ # find Koha's Perl modules
+ # test carefully before changing this
+ use FindBin;
+ eval { require "$FindBin::Bin/../kohalib.pl" };
+}
use C4::Context;
use Date::Manip;
use Mail::Sendmail;
diff --git a/misc/cronjobs/services_throttle.pl b/misc/cronjobs/services_throttle.pl
index 39bf2696bc..0d0d6be446 100755
--- a/misc/cronjobs/services_throttle.pl
+++ b/misc/cronjobs/services_throttle.pl
@@ -2,6 +2,12 @@
#run nightly -- resets the services throttle
use strict; use warnings;
+BEGIN {
+ # find Koha's Perl modules
+ # test carefully before changing this
+ use FindBin;
+ eval { require "$FindBin::Bin/../kohalib.pl" };
+}
use C4::Context;
my $dbh=C4::Context->dbh;
diff --git a/misc/cronjobs/smsoverdues.pl b/misc/cronjobs/smsoverdues.pl
index 52a131909a..3e5b2944b3 100755
--- a/misc/cronjobs/smsoverdues.pl
+++ b/misc/cronjobs/smsoverdues.pl
@@ -27,6 +27,13 @@
# $Id: sendoverdues.pl,v 1.1.2.1 2007/03/26 22:38:09 tgarip1957 Exp $
+BEGIN {
+ # find Koha's Perl modules
+ # test carefully before changing this
+ use FindBin;
+ eval { require "$FindBin::Bin/../kohalib.pl" };
+}
+
use C4::Context;
use C4::Search;
use C4::Circulation;
diff --git a/misc/cronjobs/update_items.pl b/misc/cronjobs/update_items.pl
index 97afefcbcd..15b8249a23 100755
--- a/misc/cronjobs/update_items.pl
+++ b/misc/cronjobs/update_items.pl
@@ -1,6 +1,12 @@
#!/usr/bin/perl
use strict;
use warnings;
+BEGIN {
+ # find Koha's Perl modules
+ # test carefully before changing this
+ use FindBin;
+ eval { require "$FindBin::Bin/../kohalib.pl" };
+}
use C4::Context;
use C4::Biblio;
use MARC::Record;
diff --git a/misc/cronjobs/zebraqueue_start.pl b/misc/cronjobs/zebraqueue_start.pl
index b79aeaaa45..52c8fe0ef7 100755
--- a/misc/cronjobs/zebraqueue_start.pl
+++ b/misc/cronjobs/zebraqueue_start.pl
@@ -2,7 +2,12 @@
# script that starts the zebraquee
# Written by TG on 01/08/2006
use strict;
-
+BEGIN {
+ # find Koha's Perl modules
+ # test carefully before changing this
+ use FindBin;
+ eval { require "$FindBin::Bin/../kohalib.pl" };
+}
use C4::Context;
use C4::Biblio;
diff --git a/misc/dumpmarc.pl b/misc/dumpmarc.pl
index dd4b44a972..b8fba0c68d 100755
--- a/misc/dumpmarc.pl
+++ b/misc/dumpmarc.pl
@@ -3,6 +3,12 @@
use strict;
+BEGIN {
+ # find Koha's Perl modules
+ # test carefully before changing this
+ use FindBin;
+ eval { require "$FindBin::Bin/kohalib.pl" };
+}
# Koha modules used
use MARC::File::USMARC;
diff --git a/misc/exportauth.pl b/misc/exportauth.pl
index b1dad03a71..109713fd82 100755
--- a/misc/exportauth.pl
+++ b/misc/exportauth.pl
@@ -4,6 +4,12 @@
#
use strict;
+BEGIN {
+ # find Koha's Perl modules
+ # test carefully before changing this
+ use FindBin;
+ eval { require "$FindBin::Bin/kohalib.pl" };
+}
require Exporter;
use C4::Auth;
diff --git a/misc/fines-sanop.pl b/misc/fines-sanop.pl
index f1d0a770ba..02cca26940 100755
--- a/misc/fines-sanop.pl
+++ b/misc/fines-sanop.pl
@@ -26,12 +26,18 @@
# Suite 330, Boston, MA 02111-1307 USA
+use strict;
+BEGIN {
+ # find Koha's Perl modules
+ # test carefully before changing this
+ use FindBin;
+ eval { require "$FindBin::Bin/kohalib.pl" };
+}
use C4::Context;
use C4::Circulation;
use C4::Overdues;
use Date::Manip qw/Date_DaysSince1BC/;
use C4::Biblio;
-use strict;
open (FILE,'>/tmp/fines') || die;
# FIXME
diff --git a/misc/fines2.pl b/misc/fines2.pl
index 554a65c738..596e664a40 100755
--- a/misc/fines2.pl
+++ b/misc/fines2.pl
@@ -26,12 +26,19 @@
# Suite 330, Boston, MA 02111-1307 USA
+use strict;
+BEGIN {
+ # find Koha's Perl modules
+ # test carefully before changing this
+ use FindBin;
+ eval { require "$FindBin::Bin/kohalib.pl" };
+}
+
use C4::Context;
use C4::Circulation;
use C4::Overdues;
use Date::Manip;
use C4::Biblio;
-use strict;
open (FILE,'>/tmp/fines') || die;
# FIXME
diff --git a/misc/kohalib.pl b/misc/kohalib.pl
new file mode 100644
index 0000000000..c6f2710e85
--- /dev/null
+++ b/misc/kohalib.pl
@@ -0,0 +1,51 @@
+#!/usr/bin/perl
+
+# Copyright (C) 2007 LibLime
+#
+# This file is part of Koha.
+#
+# Koha is free software; you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or (at your option) any later
+# version.
+#
+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
+# Suite 330, Boston, MA 02111-1307 USA
+
+# This script is used by command-line utilities to set
+# @INC properly -- specifically, to point to the directory
+# containing the installed version of the C4 modules.
+#
+# This depends on the installer replacing the \_\_PERL_MODULE_DIR\_\_
+# string with the path to the Koha modules directory. This is done
+# only during a 'standard' or 'single' mode installation. If Koha
+# is being run from a git checkout (and thus installed in 'dev' mode),
+# this is a no-op.
+#
+# To use this script, a command-line utility should do the following before
+# 'use'ing any C4 modules.
+#
+# BEGIN {
+# use FindBin;
+# eval { require "$FindBin::Bin/kohalib.pl" };
+# # adjust path to point to kohalib.pl relative
+# # to location of script
+# }
+#
+
+use strict;
+
+my $module_dir;
+BEGIN {
+ $module_dir = '__PERL_MODULE_DIR__';
+ die if $module_dir =~ /^[_]{2}PERL_MODULE_DIR[_]{2}$/;
+}
+
+use lib $module_dir;
+
+1;
diff --git a/misc/marcimport_to_biblioitems.pl b/misc/marcimport_to_biblioitems.pl
index f56f72dc3a..95ccde52b6 100755
--- a/misc/marcimport_to_biblioitems.pl
+++ b/misc/marcimport_to_biblioitems.pl
@@ -2,6 +2,12 @@
# script that correct the marcxml from in biblioitems
# Written by TG on 10/04/2006
use strict;
+BEGIN {
+ # find Koha's Perl modules
+ # test carefully before changing this
+ use FindBin;
+ eval { require "$FindBin::Bin/kohalib.pl" };
+}
# Koha modules used
diff --git a/misc/merge_authority.pl b/misc/merge_authority.pl
index 5f6a7ae739..a423ddc192 100755
--- a/misc/merge_authority.pl
+++ b/misc/merge_authority.pl
@@ -2,6 +2,12 @@
# script that rebuild thesaurus from biblio table.
use strict;
+BEGIN {
+ # find Koha's Perl modules
+ # test carefully before changing this
+ use FindBin;
+ eval { require "$FindBin::Bin/kohalib.pl" };
+}
# Koha modules used
use MARC::File::USMARC;
diff --git a/misc/migration_tools/22_to_30/convert_to_utf8.pl b/misc/migration_tools/22_to_30/convert_to_utf8.pl
index 204364f2c1..bad4b96902 100755
--- a/misc/migration_tools/22_to_30/convert_to_utf8.pl
+++ b/misc/migration_tools/22_to_30/convert_to_utf8.pl
@@ -2,8 +2,14 @@
# small script to convert mysql tables to utf-8
-use C4::Context;
use strict;
+BEGIN {
+ # find Koha's Perl modules
+ # test carefully before changing this
+ use FindBin;
+ eval { require "$FindBin::Bin/../../kohalib.pl" };
+}
+use C4::Context;
my $dbh=C4::Context->dbh();
diff --git a/misc/migration_tools/22_to_30/export_Authorities.pl b/misc/migration_tools/22_to_30/export_Authorities.pl
index 2b0925f273..8327cf7805 100755
--- a/misc/migration_tools/22_to_30/export_Authorities.pl
+++ b/misc/migration_tools/22_to_30/export_Authorities.pl
@@ -1,4 +1,10 @@
#!/usr/bin/perl
+BEGIN {
+ # find Koha's Perl modules
+ # test carefully before changing this
+ use FindBin;
+ eval { require "$FindBin::Bin/../../kohalib.pl" };
+}
use C4::Context;
#use MARC::File::XML(BinaryEncoding=>"utf8");
#use MARC::File::USMARC;
diff --git a/misc/migration_tools/22_to_30/export_Authorities_xml.pl b/misc/migration_tools/22_to_30/export_Authorities_xml.pl
index 24dacad5ae..635a4145f8 100755
--- a/misc/migration_tools/22_to_30/export_Authorities_xml.pl
+++ b/misc/migration_tools/22_to_30/export_Authorities_xml.pl
@@ -1,4 +1,10 @@
#!/usr/bin/perl
+BEGIN {
+ # find Koha's Perl modules
+ # test carefully before changing this
+ use FindBin;
+ eval { require "$FindBin::Bin/../../kohalib.pl" };
+}
use C4::Context;
use MARC::File::XML(BinaryEncoding=>"utf8");
use MARC::Record;
diff --git a/misc/migration_tools/22_to_30/missing090field.pl b/misc/migration_tools/22_to_30/missing090field.pl
index 5c8cb21247..218ce8b5fe 100755
--- a/misc/migration_tools/22_to_30/missing090field.pl
+++ b/misc/migration_tools/22_to_30/missing090field.pl
@@ -3,6 +3,12 @@
# Written by TG on 01/10/2005
# Revised by Joshua Ferraro on 03/31/2006
use strict;
+BEGIN {
+ # find Koha's Perl modules
+ # test carefully before changing this
+ use FindBin;
+ eval { require "$FindBin::Bin/../../kohalib.pl" };
+}
# Koha modules used
diff --git a/misc/migration_tools/22_to_30/move_marc_to_authheader.pl b/misc/migration_tools/22_to_30/move_marc_to_authheader.pl
index 6ecaf2730a..deffc7090d 100755
--- a/misc/migration_tools/22_to_30/move_marc_to_authheader.pl
+++ b/misc/migration_tools/22_to_30/move_marc_to_authheader.pl
@@ -2,7 +2,12 @@
# script to shift marc to biblioitems
# scraped from updatedatabase for dev week by chris@katipo.co.nz
-
+BEGIN {
+ # find Koha's Perl modules
+ # test carefully before changing this
+ use FindBin;
+ eval { require "$FindBin::Bin/../../kohalib.pl" };
+}
use C4::Context;
use C4::AuthoritiesMarc;
use MARC::Record;
diff --git a/misc/migration_tools/22_to_30/move_marc_to_biblioitems.pl b/misc/migration_tools/22_to_30/move_marc_to_biblioitems.pl
index db1665f9da..2cca920631 100755
--- a/misc/migration_tools/22_to_30/move_marc_to_biblioitems.pl
+++ b/misc/migration_tools/22_to_30/move_marc_to_biblioitems.pl
@@ -2,7 +2,12 @@
# script to shift marc to biblioitems
# scraped from updatedatabase for dev week by chris@katipo.co.nz
-
+BEGIN {
+ # find Koha's Perl modules
+ # test carefully before changing this
+ use FindBin;
+ eval { require "$FindBin::Bin/../../kohalib.pl" };
+}
use C4::Context;
use C4::Biblio;
use MARC::Record;
@@ -137,4 +142,4 @@ sub LocalMARCgetbiblio {
}
}
return $record;
-}
\ No newline at end of file
+}
diff --git a/misc/migration_tools/22_to_30/rebuild_leader.pl b/misc/migration_tools/22_to_30/rebuild_leader.pl
index 7a0b7896ab..0ab0f07cf6 100755
--- a/misc/migration_tools/22_to_30/rebuild_leader.pl
+++ b/misc/migration_tools/22_to_30/rebuild_leader.pl
@@ -3,6 +3,12 @@
# Written by TG on 01/10/2005
# Revised by Joshua Ferraro on 03/31/2006
use strict;
+BEGIN {
+ # find Koha's Perl modules
+ # test carefully before changing this
+ use FindBin;
+ eval { require "$FindBin::Bin/../../kohalib.pl" };
+}
# Koha modules used
diff --git a/misc/migration_tools/22_to_30/rebuild_unimarc_100.pl b/misc/migration_tools/22_to_30/rebuild_unimarc_100.pl
index e428d6107a..60b1b878fe 100755
--- a/misc/migration_tools/22_to_30/rebuild_unimarc_100.pl
+++ b/misc/migration_tools/22_to_30/rebuild_unimarc_100.pl
@@ -3,6 +3,12 @@
# Written by TG on 01/10/2005
# Revised by Joshua Ferraro on 03/31/2006
use strict;
+BEGIN {
+ # find Koha's Perl modules
+ # test carefully before changing this
+ use FindBin;
+ eval { require "$FindBin::Bin/../../kohalib.pl" };
+}
# Koha modules used
diff --git a/misc/migration_tools/bulkmarcimport.pl b/misc/migration_tools/bulkmarcimport.pl
index 254dca0e50..e22e7aeab4 100755
--- a/misc/migration_tools/bulkmarcimport.pl
+++ b/misc/migration_tools/bulkmarcimport.pl
@@ -3,6 +3,12 @@
use strict;
# use warnings;
+BEGIN {
+ # find Koha's Perl modules
+ # test carefully before changing this
+ use FindBin;
+ eval { require "$FindBin::Bin/../kohalib.pl" };
+}
# Koha modules used
use MARC::File::USMARC;
diff --git a/misc/missing090field.pl b/misc/missing090field.pl
index e0552e3e0b..dfeb0aa89a 100755
--- a/misc/missing090field.pl
+++ b/misc/missing090field.pl
@@ -3,6 +3,12 @@
# Written by TG on 01/10/2005
# Revised by Joshua Ferraro on 03/31/2006
use strict;
+BEGIN {
+ # find Koha's Perl modules
+ # test carefully before changing this
+ use FindBin;
+ eval { require "$FindBin::Bin/kohalib.pl" };
+}
# Koha modules used
diff --git a/misc/rebuild_marc_newframework.pl b/misc/rebuild_marc_newframework.pl
index d8dcdc01aa..dcb797d721 100755
--- a/misc/rebuild_marc_newframework.pl
+++ b/misc/rebuild_marc_newframework.pl
@@ -11,6 +11,12 @@
use strict;
+BEGIN {
+ # find Koha's Perl modules
+ # test carefully before changing this
+ use FindBin;
+ eval { require "$FindBin::Bin/kohalib.pl" };
+}
use C4::Context;
use C4::Biblio;
diff --git a/misc/rebuildnonmarc.pl b/misc/rebuildnonmarc.pl
index 714cfddffb..16fbb68c85 100755
--- a/misc/rebuildnonmarc.pl
+++ b/misc/rebuildnonmarc.pl
@@ -2,6 +2,12 @@
# small script that rebuilds the non-MARC DB
use strict;
+BEGIN {
+ # find Koha's Perl modules
+ # test carefully before changing this
+ use FindBin;
+ eval { require "$FindBin::Bin/kohalib.pl" };
+}
# Koha modules used
# use MARC::File::USMARC;
diff --git a/misc/spellcheck_suggest/make_spellcheck_suggest.pl b/misc/spellcheck_suggest/make_spellcheck_suggest.pl
index b828e81181..96ffea8ff3 100755
--- a/misc/spellcheck_suggest/make_spellcheck_suggest.pl
+++ b/misc/spellcheck_suggest/make_spellcheck_suggest.pl
@@ -16,8 +16,6 @@
## CONFIGURABLE VARIABLES ####################
##
- # Change this to where your Koha modules are (C4 directory)
-use lib '/usr/local/koha/intranet/modules/';
# These are the tags that have meaningful data
# for the databases I've worked with (MARC21 only)
# you may need to change them depending on your data
@@ -71,6 +69,12 @@ my @tags=(
);
## Leave this next bit alone
use strict;
+BEGIN {
+ # find Koha's Perl modules
+ # test carefully before changing this
+ use FindBin;
+ eval { require "$FindBin::Bin/../kohalib.pl" };
+}
use C4::Context;
##
# SUGGEST DATABASE INFO
diff --git a/misc/stage_biblios_file.pl b/misc/stage_biblios_file.pl
index a741990ce9..bfe26ce972 100755
--- a/misc/stage_biblios_file.pl
+++ b/misc/stage_biblios_file.pl
@@ -1,6 +1,12 @@
#!/usr/bin/perl
use strict;
+BEGIN {
+ # find Koha's Perl modules
+ # test carefully before changing this
+ use FindBin;
+ eval { require "$FindBin::Bin/kohalib.pl" };
+}
use C4::Context;
use C4::ImportBatch;
diff --git a/misc/sync_koha_plugin.pl b/misc/sync_koha_plugin.pl
index b683533b22..3aaaada437 100755
--- a/misc/sync_koha_plugin.pl
+++ b/misc/sync_koha_plugin.pl
@@ -1,6 +1,12 @@
#!/usr/bin/perl -w
use strict;
+BEGIN {
+ # find Koha's Perl modules
+ # test carefully before changing this
+ use FindBin;
+ eval { require "$FindBin::Bin/kohalib.pl" };
+}
use C4::Context;
use Getopt::Long;
diff --git a/misc/xmlintobiblioitems.pl b/misc/xmlintobiblioitems.pl
index d302fd3a09..0ec2e202b4 100755
--- a/misc/xmlintobiblioitems.pl
+++ b/misc/xmlintobiblioitems.pl
@@ -2,6 +2,12 @@
# script that correct the marcxml from in biblioitems
# Written by TG on 10/04/2006
use strict;
+BEGIN {
+ # find Koha's Perl modules
+ # test carefully before changing this
+ use FindBin;
+ eval { require "$FindBin::Bin/kohalib.pl" };
+}
# Koha modules used
@@ -37,4 +43,4 @@ $dbh->do("UNLOCK TABLES ");
$timeneeded = gettimeofday - $starttime ;
print "$i records in $timeneeded s\n" ;
-END;
\ No newline at end of file
+END;
diff --git a/misc/zebraqueue_daemon.pl b/misc/zebraqueue_daemon.pl
index 7a9c8d5a44..88b6a6d6b5 100755
--- a/misc/zebraqueue_daemon.pl
+++ b/misc/zebraqueue_daemon.pl
@@ -3,6 +3,12 @@
# daemon to watch the zebraqueue and update zebra as needed
use strict;
+BEGIN {
+ # find Koha's Perl modules
+ # test carefully before changing this
+ use FindBin;
+ eval { require "$FindBin::Bin/kohalib.pl" };
+}
use POE qw(Wheel::SocketFactory Wheel::ReadWrite Filter::Stream Driver::SysRW);
use Unix::Syslog qw(:macros);
From 3f5c71daa5972ab6d74921dff632984b62bebdac Mon Sep 17 00:00:00 2001
From: Galen Charlton
Date: Fri, 14 Dec 2007 15:45:41 -0600
Subject: [PATCH 43/57] installer: always accept default value as valid
---
Makefile.PL | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/Makefile.PL b/Makefile.PL
index 9898c846e5..09d39b355b 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -850,7 +850,10 @@ sub _get_value {
}
my $val = prompt($msg, $default);
- while (exists $valid_values->{$key} and not exists $valid_values->{$key}->{$val}) {
+
+ while (exists $valid_values->{$key} and
+ $val ne $default and
+ not exists $valid_values->{$key}->{$val}) {
my $retry_msg = "Value '$val' is not a valid option.\n";
$retry_msg .= "Please enter a value";
$retry_msg .= _add_valid_values_disp($key, $valid_values);
From 17e4626dff23bbdaffae081e59ca2010618900d6 Mon Sep 17 00:00:00 2001
From: Galen Charlton
Date: Fri, 14 Dec 2007 16:32:43 -0600
Subject: [PATCH 44/57] web installer: improve DB permissions check
MySQL-only: improve regex to make sure we are
checking permission on the correct database, not
on another database (when the DB name is a
subset of the DB user's name)
---
installer/install.pl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/installer/install.pl b/installer/install.pl
index 3cb698c983..98762545c9 100755
--- a/installer/install.pl
+++ b/installer/install.pl
@@ -188,7 +188,7 @@ elsif ( $step && $step == 2 ) {
my $grantaccess;
while ( my ($line) = $rq->fetchrow ) {
my $dbname = $info{dbname};
- if ( $line =~ m/$dbname/ || index( $line, '*.*' ) > 0 ) {
+ if ( $line =~ m/^GRANT (.*?) ON `$dbname`\.\*/ || index( $line, '*.*' ) > 0 ) {
$grantaccess = 1
if (
index( $line, 'ALL PRIVILEGES' ) > 0
From 395f4d49ec306c8d0c540d503acff097efc750b7 Mon Sep 17 00:00:00 2001
From: Galen Charlton
Date: Fri, 14 Dec 2007 16:44:13 -0600
Subject: [PATCH 45/57] installer: fixed typo in version number
---
kohaversion.pl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kohaversion.pl b/kohaversion.pl
index c96a9da1e2..3a74cd6a70 100644
--- a/kohaversion.pl
+++ b/kohaversion.pl
@@ -10,7 +10,7 @@
use strict;
sub kohaversion {
- our $VERSION = "3.00.00.35";
+ our $VERSION = "3.00.00.035";
# version needs to be set this way
# so that it can be picked up by Makefile.PL
# during install
From ce25501ed019db3e052661873877401ff191ab5b Mon Sep 17 00:00:00 2001
From: Galen Charlton
Date: Fri, 14 Dec 2007 16:51:30 -0600
Subject: [PATCH 46/57] installer: fixed default location of koha-conf.xml in
README
---
README.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.txt b/README.txt
index 0a91ba6f43..018b73de33 100644
--- a/README.txt
+++ b/README.txt
@@ -57,7 +57,7 @@ Default installation instructions:
5. ln -s /etc/koha/koha-httpd.conf /etc/apache2/sites-available/koha
6. a2enmod rewrite
7. a2ensite koha && /etc/init.d/apache2 reload
-8. zebrasrv -f /usr/share/koha/etc/koha-conf.xml
+8. zebrasrv -f /etc/koha/koha-conf.xml
9. Browse to http://servername:8080/ and answer the questions
OR if you want to install all dependencies from CPAN and are root, you can
From 2305d2d7683101ee131235b14b16478a431975f2 Mon Sep 17 00:00:00 2001
From: Galen Charlton
Date: Tue, 18 Dec 2007 11:11:36 -0600
Subject: [PATCH 47/57] installer: added (in some cases back) module deps
---
Makefile.PL | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/Makefile.PL b/Makefile.PL
index 09d39b355b..594508122c 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -424,6 +424,8 @@ WriteMakefile(
AUTHOR => 'Koha Developers ',
NO_META => 1,
PREREQ_PM => {
+'Algorithm::CheckDigits' => 0.48,
+'Biblio::EndnoteStyle' => 0.05,
'CGI' => 3.15,
'CGI::Carp' => 1.29,
'CGI::Session' => '4.10',
@@ -431,8 +433,10 @@ WriteMakefile(
'Class::Accessor' => 0.30,
'DBD::mysql' => 3.0008,
'DBI' => 1.53,
+'Data::ICal' => 0.13,
'Data::Dumper' => 2.121_08,
'Date::Calc' => 5.4,
+'Date::ICal' => 1.72,
'Date::Manip' => 5.44,
'Digest::MD5' => 2.36,
'File::Temp' => 0.16,
@@ -446,6 +450,7 @@ WriteMakefile(
'LWP::UserAgent' => 2.033,
'Lingua::Stem' => 0.82,
'List::Util' => 1.18,
+'List::MoreUtils' => 0.22,
'Locale::Language' => 2.07,
'MARC::Charset' => 0.98,
'MARC::Crosswalk::DublinCore' => 0.02,
@@ -454,12 +459,15 @@ WriteMakefile(
'MIME::Base64' => 3.07,
'MIME::QuotedPrint' => 3.07,
'Mail::Sendmail' => 0.79,
+'Net::LDAP' => 0.34,
+'Net::LDAP::Filter' => 0.34,
'Net::Z3950::ZOOM' => 1.16,
'PDF::API2' => 2.000,
'PDF::API2::Page' => 2.000,
'PDF::API2::Util' => 2.000,
'PDF::Reuse' => 0.33,
'PDF::Reuse::Barcode' => 0.05,
+'POE' => 0.9999,
'POSIX' => 1.09,
'Schedule::At' => 1.06,
'Term::ANSIColor' => 1.10,
@@ -474,6 +482,7 @@ WriteMakefile(
'Unicode::Normalize' => 0.32,
'XML::Dumper' => 0.81,
'XML::LibXML' => 1.59,
+'XML::LibXSLT' => 1.63,
'XML::SAX::ParserFactory' => 1.01,
'XML::Simple' => 2.14,
'XML::RSS' => 1.31,
From 32c72c495e3bd1f2458008e09a8952630e57bf0e Mon Sep 17 00:00:00 2001
From: Galen Charlton
Date: Tue, 18 Dec 2007 11:31:11 -0600
Subject: [PATCH 48/57] installer: bug 1640: deal with '$' in passwords
---
Makefile.PL | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/Makefile.PL b/Makefile.PL
index 594508122c..2c619f440c 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -1096,9 +1096,14 @@ sub postamble {
# so that Make will export as environment
# variables -- this is for the use of
# rewrite-confg.PL
- my $env = join("\n", map { "export __${_}__ = $target_directories->{$_}" } keys %$target_directories);
+ my $env = join("\n", map { "export __${_}__ := $target_directories->{$_}" } keys %$target_directories);
$env .= "\n\n";
- $env .= join("\n", map { "export __${_}__ = $config{$_}" } keys %config);
+
+ # quote '$' in the two password parameters
+ my %config = %config;
+ $config{'DB_PASS'} =~ s/\$/\$\$/g;
+ $config{'ZEBRA_PASS'} =~ s/\$/\$\$/g;
+ $env .= join("\n", map { "export __${_}__ := $config{$_}" } keys %config);
return "$env\n";
}
From 118283b71f8eed44c41dd99074ed45f19a16363f Mon Sep 17 00:00:00 2001
From: Chris Nighswonger
Date: Mon, 17 Dec 2007 12:44:14 -0500
Subject: [PATCH 49/57] Initial work on adding Win32 support to installer.
Signed-off-by: Galen Charlton
---
Makefile.PL | 220 ++++++++++++++++++++++++++++++++++++++++++----------
1 file changed, 177 insertions(+), 43 deletions(-)
diff --git a/Makefile.PL b/Makefile.PL
index 2c619f440c..d9bee637b1 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -24,6 +24,7 @@ use warnings;
use ExtUtils::MakeMaker;
use POSIX;
use File::Spec;
+use Cwd;
my $DEBUG = 0;
die "perl 5.6.1 or later required" unless ($] >= 5.006001);
@@ -363,8 +364,6 @@ System group that will own Koha's files.
# default configuration options
my %config_defaults = (
- 'INSTALL_MODE' => 'standard',
- 'INSTALL_BASE' => '/usr/share/koha',
'DB_TYPE' => 'mysql',
'DB_HOST' => 'localhost',
'DB_NAME' => 'koha',
@@ -379,6 +378,30 @@ my %config_defaults = (
'KOHA_GROUP' => 'koha',
);
+# set some default configuratio options based on OS
+# more conditions need to be added for other OS's
+# this should probably also incorporate usage of Win32::GetOSName() and/or Win32::GetOSVersion()
+# to allow for more granular decisions based on which Win32 platform
+
+warn "Your platform appears to be $^O.\n" if $DEBUG;
+
+if ( $^O eq 'MSWin32' ) {
+ # Most Unix2Win32 ports seem to poke everything into the Program Files directory
+ # this could be changed to put some files (ie. libraries) into system32, etc.
+ $config_defaults{'INSTALL_MODE'} = 'single';
+ $config_defaults{'INSTALL_BASE'} = 'c:/progra~1/koha'; # Use 8.3 names to be safe...
+}
+elsif ( $^O eq 'cygwin' ) {
+ # Most Unix2Win32 ports seem to poke everything into the Program Files directory
+ # this could be changed to put some files (ie. libraries) into system32, etc.
+ $config_defaults{'INSTALL_MODE'} = 'single';
+ $config_defaults{'INSTALL_BASE'} = 'c:/progra~1/koha'; # Use 8.3 names to be safe...
+}
+else {
+ $config_defaults{'INSTALL_MODE'} = 'standard';
+ $config_defaults{'INSTALL_BASE'} = '/usr/share/koha';
+}
+
# valid values for certain configuration options
my %valid_config_values = (
'INSTALL_MODE' => { 'standard' => 1, 'single' => 1, 'dev' => 1 },
@@ -688,7 +711,7 @@ be run from the current directory.
Configuration directory:);
# FIXME - home directory portability consideration apply
- $install_base_default = (exists $ENV{'HOME'}) ? "$ENV{'HOME'}/koha-dev" : "/usr/share/koha-dev";
+ $install_base_default = (exists $ENV{'HOME'}) ? "$ENV{'HOME'}/koha-dev" : "$defaults->{'INSTALL_BASE'}-dev";
} elsif ($config{'INSTALL_MODE'} eq 'single') {
$msg = "\nPlease specify the directory in which to install Koha";
# FIXME -- we're assuming under a 'single' mode install
@@ -697,7 +720,8 @@ Configuration directory:);
# use File::HomeDir to locate the home directory portably.
# This is deferred for now because File::HomeDir is not yet
# core.
- $install_base_default = (exists $ENV{'HOME'}) ? "$ENV{'HOME'}/koha" : "/usr/share/koha";
+ # --we must also keep this portable to the major OS's -fbcit
+ $install_base_default = (exists $ENV{'HOME'}) ? "$ENV{'HOME'}/koha" : $defaults->{'INSTALL_BASE'};
} else {
# must be standard
$msg = q(
@@ -712,8 +736,9 @@ as the package name in the FHS layout.
Base installation directory);
}
$config{'INSTALL_BASE'} = _get_value('INSTALL_BASE', $msg, $install_base_default, $valid_values);
- $config{'INSTALL_BASE'} = File::Spec->rel2abs($config{'INSTALL_BASE'});
+ $config{'INSTALL_BASE'} = File::Spec->rel2abs($config{'INSTALL_BASE'});
+ print "INSTALL_BASE=$config{'INSTALL_BASE'}\r\n" if $DEBUG;
if ($config{'INSTALL_MODE'} eq "standard") {
$msg = q(
Since you are using the 'standard' install
@@ -891,9 +916,16 @@ sub get_target_directories {
# get last component of install base directory
# to treat as package name
my ($volume, $directories, $file) = File::Spec->splitpath($base, 1);
+
my @basedir = File::Spec->splitdir($directories);
+
+ # for Win32 we need to prepend the volume to the directory path
+ if ( $^O eq 'MSWin32' ) { shift @basedir; unshift @basedir, $volume; }
+ elsif ( $^O eq 'cygwin' ) { shift @basedir; unshift @basedir, 'c:'; } # in a cygwin environment, $volume is returned empty
+
my $package = pop @basedir;
+
my %dirmap = ();
my %skipdirs = ();
if ($mode eq 'single') {
@@ -1018,8 +1050,70 @@ sub display_configuration {
print "DB_USER=my_koha DOC_DIR=/usr/local/info perl Makefile.PL\n\n";
}
+=head2 fixshebang
+
+This sub will recurse through a given directory and its subdirectories checking for the existence of a shebang
+line in .pl files and replacing it with the correct line for the current OS if needed. It should be called
+in a manner similar to 'fixshebang (getcwd())' but may be supplied with any directory in absolute path form.
+
+=cut
+
+sub fixshebang{
+ # NOTE: this might be dressed up a bit with File::Spec since we're using it here already.
+ my $dir = shift;
+ opendir my $dh, $dir or die $!;
+ while( my $file = readdir($dh) ) {
+ print "Reading $dir contents.\r\n" if $DEBUG;
+ print "Current item = $file\r\n" if $DEBUG;
+ # this may be used to exclude any desired files from the scan
+ if ( $file =~ /shebang|wixgen/ ) { next; }
+ # handle files... other extensions could be substituted/added if needed
+ if ( $file =~ /\.pl$/ ) {
+ my $pathfile =$dir . '/' . $file;
+ print "Found a perl script named $pathfile\r\n" if $DEBUG;
+ open FH, '+<', "$pathfile";
+ my @file = ;
+ seek( FH, 0, 0 );
+ truncate( FH, 0 );
+ my $line = shift @file;
+ print "Found shebang line: $line\r\n" if $DEBUG;
+ # FIXME: these conditionals need to be modified to select shebang line based on OS ($^O)
+ if ( $line =~ /#!c:\\strawberry-perl\\perl\\bin\\perl -w/ ) {
+ # FIXME: This can probably be done with less of a hack. -fbcit
+ print FH $line;
+ print FH @file;
+ close (FH);
+ next;
+ }
+ elsif ( $line =~ /#!\/usr\/bin\/perl/ ) {
+ print "Re-writing shebang line for $pathfile\r\n";
+ print FH "#!c:\\strawberry-perl\\perl\\bin\\perl -w\n";
+ print FH @file;
+ close(FH);
+ }
+ else {
+ # FIXME: This can probably be done with less of a hack. -fbcit
+ print FH $line;
+ print FH @file;
+ close (FH);
+ next;
+ }
+ }
+ # handle directories
+ elsif ( -d ($dir . '/' . $file) && $file !~ /^\.{1,2}/ ) {
+ my $pathfile = $dir . '/' . $file;
+ print "Found a subdir named $pathfile\r\n" if $DEBUG;
+ &fixshebang ($pathfile);
+# closedir $dh; # I'm not really sure if this is necessary
+ }
+ }
+ closedir $dh;
+}
+
package MY;
+# This will have to be reworked in order to accommodate Win32...
+
sub test {
my $self = shift;
my $test = $self->SUPER::test(@_);
@@ -1033,47 +1127,73 @@ sub install {
# NOTE: we're *not* doing this: my $install = $self->SUPER::install(@_);
# This means that we're completely overriding EU::MM's default
# installation and uninstallation targets.
- foreach my $key (sort keys %$target_directories) {
- $install .= qq(
+
+# If installation is on Win32, we need to do permissions different from *nix
+ if ( $^O =~ /linux|cygwin/ ) { # this value needs to be verified for each platform and modified accordingly
+ foreach my $key (sort keys %$target_directories) {
+ $install .= qq(
KOHA_INST_$key = blib/$key
KOHA_DEST_$key = $target_directories->{$key}
-) unless ($config{'INSTALL_ZEBRA'} ne "yes" and $key =~ /ZEBRA/) or exists $skip_directories->{$key};
- }
-
- $install .= qq(
+) unless ($config{'INSTALL_ZEBRA'} ne "yes" and $key =~ /ZEBRA/) or exists $skip_directories->{$key};
+ }
+ $install .= qq(
install :: all install_koha set_koha_ownership set_koha_permissions warn_koha_env_vars
\t\$(NOECHO) \$(NOOP)
);
- $install .= "install_koha ::\n";
- $install .= "\t\$(NOECHO) umask 022; \$(MOD_INSTALL) \\\n";
- foreach my $key (sort keys %$target_directories) {
- $install .= "\t\t\$(KOHA_INST_$key) \$(KOHA_DEST_$key) \\\n"
- unless ($config{'INSTALL_ZEBRA'} ne "yes" and $key =~ /ZEBRA/) or exists $skip_directories->{$key};
- }
- $install .= "\t\t\$(INST_MAN1DIR) \$(DESTINSTALLMAN1DIR) \\\n";
- $install .= "\t\t\$(INST_MAN3DIR) \$(DESTINSTALLMAN3DIR)\n";
+ $install .= "install_koha ::\n";
+ $install .= "\t\$(NOECHO) umask 022; \$(MOD_INSTALL) \\\n";
+ foreach my $key (sort keys %$target_directories) {
+ $install .= "\t\t\$(KOHA_INST_$key) \$(KOHA_DEST_$key) \\\n"
+ unless ($config{'INSTALL_ZEBRA'} ne "yes" and $key =~ /ZEBRA/) or exists $skip_directories->{$key};
+ }
+ $install .= "\t\t\$(INST_MAN1DIR) \$(DESTINSTALLMAN1DIR) \\\n";
+ $install .= "\t\t\$(INST_MAN3DIR) \$(DESTINSTALLMAN3DIR)\n";
- $install .= "\n";
- $install .= "set_koha_ownership ::\n";
- if ($config{'INSTALL_MODE'} eq 'standard' and $config{'KOHA_USER'} ne "root") {
- foreach my $key (sort keys %$target_directories) {
- $install .= "\t\$(NOECHO) chown -R $config{'KOHA_USER'}:$config{'KOHA_GROUP'} \$(KOHA_DEST_$key)\n"
- unless ($config{'INSTALL_ZEBRA'} ne "yes" and $key =~ /ZEBRA/) or exists $skip_directories->{$key};
- }
- } else {
- $install .= "\t\t\$(NOECHO) \$(NOOP)\n\n";
- }
+ $install .= "\n";
+ $install .= "set_koha_ownership ::\n";
+ if ($config{'INSTALL_MODE'} eq 'standard' and $config{'KOHA_USER'} ne "root") {
+ foreach my $key (sort keys %$target_directories) {
+ $install .= "\t\$(NOECHO) chown -R $config{'KOHA_USER'}:$config{'KOHA_GROUP'} \$(KOHA_DEST_$key)\n"
+ unless ($config{'INSTALL_ZEBRA'} ne "yes" and $key =~ /ZEBRA/) or exists $skip_directories->{$key};
+ }
+ } else {
+ $install .= "\t\t\$(NOECHO) \$(NOOP)\n\n";
+ }
- $install .= "\n";
- $install .= "set_koha_permissions ::\n";
- # This is necessary because EU::MM installs files
- # as either 0444 or 0555, and we want the owner
- # of Koha's files to have write permission by default.
- foreach my $key (sort keys %$target_directories) {
- $install .= "\t\$(NOECHO) chmod -R u+w \$(KOHA_DEST_$key)\n"
- unless ($config{'INSTALL_ZEBRA'} ne "yes" and $key =~ /ZEBRA/) or exists $skip_directories->{$key};
- }
- $install .= "\n";
+ $install .= "\n";
+ $install .= "set_koha_permissions ::\n";
+ # This is necessary because EU::MM installs files
+ # as either 0444 or 0555, and we want the owner
+ # of Koha's files to have write permission by default.
+ foreach my $key (sort keys %$target_directories) {
+ $install .= "\t\$(NOECHO) chmod -R u+w \$(KOHA_DEST_$key)\n"
+ unless ($config{'INSTALL_ZEBRA'} ne "yes" and $key =~ /ZEBRA/) or exists $skip_directories->{$key};
+ }
+ }
+ elsif ($^O eq 'MSWin32' ) { # On Win32, the install probably needs to be done under the user account koha will be running as...
+ # We can attempt some creative things with command line utils such as CACLS which allows permission
+ # management from Win32 cmd.exe, but permissions really only apply to NTFS.
+ foreach my $key (sort keys %$target_directories) {
+ $install .= qq(
+KOHA_INST_$key = blib/$key
+KOHA_DEST_$key = $target_directories->{$key}
+) unless ($config{'INSTALL_ZEBRA'} ne "yes" and $key =~ /ZEBRA/) or exists $skip_directories->{$key};
+ }
+ $install .= qq(
+install :: all install_koha warn_koha_env_vars
+\t\$(NOECHO) \$(NOOP)
+);
+ $install .= "install_koha ::\n";
+ $install .= "\t\$(MOD_INSTALL) \\\n";
+ foreach my $key (sort keys %$target_directories) {
+ $install .= "\t\t\$(KOHA_INST_$key) \$(KOHA_DEST_$key) \\\n"
+ unless ($config{'INSTALL_ZEBRA'} ne "yes" and $key =~ /ZEBRA/) or exists $skip_directories->{$key};
+ }
+ }
+ $install .= "\t\t\$(INST_MAN1DIR) \$(DESTINSTALLMAN1DIR) \\\n";
+ $install .= "\t\t\$(INST_MAN3DIR) \$(DESTINSTALLMAN3DIR)\n";
+
+ $install .= "\n";
$install .= "warn_koha_env_vars ::\n";
$install .= "\t\$(NOECHO) \$(ECHO)\n";
@@ -1085,6 +1205,9 @@ install :: all install_koha set_koha_ownership set_koha_permissions warn_koha_en
$install .= "\t\$(NOECHO) \$(ECHO) export KOHA_CONF=\$(KOHA_DEST_KOHA_CONF_DIR)/koha-conf.xml\n";
$install .= "\t\$(NOECHO) \$(ECHO) export PERL5LIB=$target_directories->{'PERL_MODULE_DIR'}\n";
$install .= "\t\$(NOECHO) \$(ECHO)\n";
+ $install .= "\t\$(NOECHO) \$(ECHO) If installing on a Win32 platform, be sure to use:\n";
+ $install .= "\t\$(NOECHO) \$(ECHO) 'dmake -x MAXLINELENGTH=300000'\n";
+ $install .= "\t\$(NOECHO) \$(ECHO)\n";
$install .= "\t\$(NOECHO) \$(ECHO) For other post-installation tasks, please consult the README.\n";
$install .= "\t\$(NOECHO) \$(ECHO)\n";
@@ -1096,15 +1219,26 @@ sub postamble {
# so that Make will export as environment
# variables -- this is for the use of
# rewrite-confg.PL
- my $env = join("\n", map { "export __${_}__ := $target_directories->{$_}" } keys %$target_directories);
- $env .= "\n\n";
# quote '$' in the two password parameters
my %config = %config;
$config{'DB_PASS'} =~ s/\$/\$\$/g;
$config{'ZEBRA_PASS'} =~ s/\$/\$\$/g;
- $env .= join("\n", map { "export __${_}__ := $config{$_}" } keys %config);
- return "$env\n";
+
+ # Hereagain, we must alter syntax per platform...
+ if ( $^O =~ /linux|cygwin/ ) {
+ my $env = join("\n", map { "export __${_}__ := $target_directories->{$_}" } keys %$target_directories);
+ $env .= "\n\n";
+ $env .= join("\n", map { "export __${_}__ := $config{$_}" } keys %config);
+ return "$env\n";
+ }
+ elsif ( $^O eq 'MSWin32' ) {
+ # NOTE: it is imperative that there be no whitespaces in ENV=value...
+ my $env = join("\n", map { "__${_}__=$target_directories->{$_}" } keys %$target_directories);
+ $env .= "\n\n";
+ $env .= join("\n", map { "__${_}__=$config{$_}" } keys %config);
+ return "$env\n";
+ }
}
__END__
From 4c991a42e9d0a5337ee11449f24a438120a17e8b Mon Sep 17 00:00:00 2001
From: Chris Nighswonger
Date: Tue, 18 Dec 2007 13:59:08 -0500
Subject: [PATCH 50/57] Win32 support: Moved shebang sub to separate script to
be called in pl_files
Signed-off-by: Galen Charlton
---
Makefile.PL | 71 ++++++-----------------------------------------------
1 file changed, 7 insertions(+), 64 deletions(-)
diff --git a/Makefile.PL b/Makefile.PL
index d9bee637b1..7dec2763e9 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -24,7 +24,6 @@ use warnings;
use ExtUtils::MakeMaker;
use POSIX;
use File::Spec;
-use Cwd;
my $DEBUG = 0;
die "perl 5.6.1 or later required" unless ($] >= 5.006001);
@@ -420,8 +419,11 @@ get_file_map($target_map, $dirtree, $file_map, $config{'INSTALL_ZEBRA'} eq "yes"
my $pl_files = {
'rewrite-config.PL' => [
'blib/KOHA_CONF_DIR/koha-conf.xml',
- 'blib/KOHA_CONF_DIR/koha-httpd.conf',
- ]
+ 'blib/KOHA_CONF_DIR/koha-httpd.conf'
+ ],
+ 'fix-perl-path.PL' => [ # this script ensures the correct shebang line for the platform installed on...
+ 'blib'
+ ]
};
if ($config{'INSTALL_ZEBRA'} eq "yes") {
@@ -518,7 +520,7 @@ WriteMakefile(
INSTALLMAN1DIR => File::Spec->catdir($target_directories->{'MAN_DIR'}, 'man1'),
INSTALLMAN3DIR => File::Spec->catdir($target_directories->{'MAN_DIR'}, 'man3'),
- PL_FILES => $pl_files,
+ PL_FILES => $pl_files,
);
@@ -1050,66 +1052,6 @@ sub display_configuration {
print "DB_USER=my_koha DOC_DIR=/usr/local/info perl Makefile.PL\n\n";
}
-=head2 fixshebang
-
-This sub will recurse through a given directory and its subdirectories checking for the existence of a shebang
-line in .pl files and replacing it with the correct line for the current OS if needed. It should be called
-in a manner similar to 'fixshebang (getcwd())' but may be supplied with any directory in absolute path form.
-
-=cut
-
-sub fixshebang{
- # NOTE: this might be dressed up a bit with File::Spec since we're using it here already.
- my $dir = shift;
- opendir my $dh, $dir or die $!;
- while( my $file = readdir($dh) ) {
- print "Reading $dir contents.\r\n" if $DEBUG;
- print "Current item = $file\r\n" if $DEBUG;
- # this may be used to exclude any desired files from the scan
- if ( $file =~ /shebang|wixgen/ ) { next; }
- # handle files... other extensions could be substituted/added if needed
- if ( $file =~ /\.pl$/ ) {
- my $pathfile =$dir . '/' . $file;
- print "Found a perl script named $pathfile\r\n" if $DEBUG;
- open FH, '+<', "$pathfile";
- my @file = ;
- seek( FH, 0, 0 );
- truncate( FH, 0 );
- my $line = shift @file;
- print "Found shebang line: $line\r\n" if $DEBUG;
- # FIXME: these conditionals need to be modified to select shebang line based on OS ($^O)
- if ( $line =~ /#!c:\\strawberry-perl\\perl\\bin\\perl -w/ ) {
- # FIXME: This can probably be done with less of a hack. -fbcit
- print FH $line;
- print FH @file;
- close (FH);
- next;
- }
- elsif ( $line =~ /#!\/usr\/bin\/perl/ ) {
- print "Re-writing shebang line for $pathfile\r\n";
- print FH "#!c:\\strawberry-perl\\perl\\bin\\perl -w\n";
- print FH @file;
- close(FH);
- }
- else {
- # FIXME: This can probably be done with less of a hack. -fbcit
- print FH $line;
- print FH @file;
- close (FH);
- next;
- }
- }
- # handle directories
- elsif ( -d ($dir . '/' . $file) && $file !~ /^\.{1,2}/ ) {
- my $pathfile = $dir . '/' . $file;
- print "Found a subdir named $pathfile\r\n" if $DEBUG;
- &fixshebang ($pathfile);
-# closedir $dh; # I'm not really sure if this is necessary
- }
- }
- closedir $dh;
-}
-
package MY;
# This will have to be reworked in order to accommodate Win32...
@@ -1241,6 +1183,7 @@ sub postamble {
}
}
+
__END__
From b310be2bab507630cbb4ea5d48fb9c6f0963fd64 Mon Sep 17 00:00:00 2001
From: Chris Nighswonger
Date: Tue, 18 Dec 2007 13:59:09 -0500
Subject: [PATCH 51/57] Win32 support: Adding a script to modify shebang lines
per installation platfom.
Signed-off-by: Galen Charlton
---
fix-perl-path.PL | 109 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 109 insertions(+)
create mode 100644 fix-perl-path.PL
diff --git a/fix-perl-path.PL b/fix-perl-path.PL
new file mode 100644
index 0000000000..222ff8d34f
--- /dev/null
+++ b/fix-perl-path.PL
@@ -0,0 +1,109 @@
+#!c:\strawberry-perl\perl\bin\perl
+# This file is part of Koha.
+#
+# Koha is free software; you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or (at your option) any later
+# version.
+#
+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
+# Suite 330, Boston, MA 02111-1307 USA
+#
+
+use strict;
+use ExtUtils::MakeMaker::Config;
+use Tie::File;
+
+my $basedir = (shift);
+my $DEBUG = 1;
+
+$DEBUG = 1 if $basedir eq 'test';
+
+my $bindir = $Config{installbin};
+$bindir =~ s!\\!/!g; # make all directory separators uniform...
+my $shebang = "#!$bindir\/perl -w";
+
+warn "Perl binary located in $bindir on this system.\n" if $DEBUG;
+warn "The shebang line for this sytems should be $shebang\n\n" if $DEBUG;
+
+die if $basedir eq 'test';
+
+=head1 NAME
+
+fix-perl-path.PL - A script to correct the shebang line to match the current platform
+
+=head1 SYNOPSIS
+
+=head2 BASIC USAGE
+
+ perl fix-perl-path.PL /absolute/path/to/foo
+
+=head1 DESCRIPTION
+
+This script should be run from the base of the directory
+structure which contains the file(s) that need the
+shebang line corrected. It will recurse through all
+directories below the one called from and modify all
+.pl files.
+
+=head2 fixshebang
+
+This sub will recurse through a given directory and its subdirectories checking for the existence of a shebang
+line in .pl files and replacing it with the correct line for the current OS if needed. It should be called
+in a manner similar to 'fixshebang (foodir)' but may be supplied with any directory.
+
+=cut
+
+sub fixshebang{
+ # NOTE: this might be dressed up a bit with File::Spec since we're using it here already.
+ my $dir = shift;
+ opendir my $dh, $dir or die $!;
+ warn "Reading $dir contents.\n" if $DEBUG;
+ while( my $file = readdir($dh) ) {
+ # this may be used to exclude any desired files from the scan
+ if ( $file =~ /shebang|wixgen/ ) { next; }
+ # handle files... other extensions could be substituted/added if needed
+ if ( $file =~ /\.pl$/ ) {
+ my @filearray;
+ my $pathfile =$dir . '/' . $file;
+ warn "Found a perl script named $pathfile\n" if $DEBUG;
+ tie @filearray, 'Tie::File', $pathfile or die $!;
+ print "First line of $file is $filearray[0]\n\n";
+ if ( ( $filearray[0] =~ /#!.*perl/ ) && ( $filearray[0] !~ /$shebang/ ) ) {
+ warn "\n\tRe-writing shebang line for $pathfile\n" if $DEBUG;
+ warn "\tOriginal shebang line: $filearray[0]\n" if $DEBUG;
+ $filearray[0] = $shebang;
+ warn "\tNew shebang line is: $filearray[0]\n\n" if $DEBUG;
+ untie @filearray;
+ next;
+ }
+ elsif ( $filearray[0] =~ /$shebang/ ) {
+ warn "\n\tShebang line is correct.\n\n" if $DEBUG;
+ untie @filearray;
+ next;
+ }
+ else {
+ warn "\n\tNo shebang line found in $pathfile\n\n" if $DEBUG;
+ untie @filearray;
+ next;
+ }
+ }
+ # handle directories
+ elsif ( -d ($dir . '/' . $file) && $file !~ /^\.{1,2}/ ) {
+ my $dirpath = $dir . '/' . $file;
+ warn "Found a subdir named $dirpath\n" if $DEBUG;
+ fixshebang ($dirpath);
+# closedir $dh; # I'm not really sure if this is necessary
+ }
+ }
+ closedir $dh;
+}
+
+fixshebang ($basedir);
+
+
From 7fcfc09669cb326b71f7faa2e1d012ff6690b640 Mon Sep 17 00:00:00 2001
From: Chris Nighswonger
Date: Tue, 18 Dec 2007 13:59:10 -0500
Subject: [PATCH 52/57] Win32 support: Stripped ^M line endings and various
other housekeeping.
Signed-off-by: Galen Charlton
---
fix-perl-path.PL | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/fix-perl-path.PL b/fix-perl-path.PL
index 222ff8d34f..dbe7403717 100644
--- a/fix-perl-path.PL
+++ b/fix-perl-path.PL
@@ -1,4 +1,4 @@
-#!c:\strawberry-perl\perl\bin\perl
+#!/usr/bin/perl
# This file is part of Koha.
#
# Koha is free software; you can redistribute it and/or modify it under the
@@ -25,7 +25,7 @@ my $DEBUG = 1;
$DEBUG = 1 if $basedir eq 'test';
my $bindir = $Config{installbin};
-$bindir =~ s!\\!/!g; # make all directory separators uniform...
+$bindir =~ s!\\!/!g; # make all directory separators uniform since Win32 does not care and *nix does...
my $shebang = "#!$bindir\/perl -w";
warn "Perl binary located in $bindir on this system.\n" if $DEBUG;
@@ -60,7 +60,6 @@ in a manner similar to 'fixshebang (foodir)' but may be supplied with any direct
=cut
sub fixshebang{
- # NOTE: this might be dressed up a bit with File::Spec since we're using it here already.
my $dir = shift;
opendir my $dh, $dir or die $!;
warn "Reading $dir contents.\n" if $DEBUG;
@@ -106,4 +105,3 @@ sub fixshebang{
fixshebang ($basedir);
-
From 42c94234084d58c24522192a056cc801d10ee8c5 Mon Sep 17 00:00:00 2001
From: Chris Nighswonger
Date: Tue, 18 Dec 2007 14:16:27 -0500
Subject: [PATCH 53/57] Win32 support: Switch DEBUG off and corrected warning
bug.
Signed-off-by: Galen Charlton
---
fix-perl-path.PL | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fix-perl-path.PL b/fix-perl-path.PL
index dbe7403717..600241f0a3 100644
--- a/fix-perl-path.PL
+++ b/fix-perl-path.PL
@@ -20,7 +20,7 @@ use ExtUtils::MakeMaker::Config;
use Tie::File;
my $basedir = (shift);
-my $DEBUG = 1;
+my $DEBUG = 0;
$DEBUG = 1 if $basedir eq 'test';
@@ -72,7 +72,7 @@ sub fixshebang{
my $pathfile =$dir . '/' . $file;
warn "Found a perl script named $pathfile\n" if $DEBUG;
tie @filearray, 'Tie::File', $pathfile or die $!;
- print "First line of $file is $filearray[0]\n\n";
+ warn "First line of $file is $filearray[0]\n\n" if $DEBUG;
if ( ( $filearray[0] =~ /#!.*perl/ ) && ( $filearray[0] !~ /$shebang/ ) ) {
warn "\n\tRe-writing shebang line for $pathfile\n" if $DEBUG;
warn "\tOriginal shebang line: $filearray[0]\n" if $DEBUG;
From ffea1e08321d0e09e4d6fcafc9f21cd0e0f4bccb Mon Sep 17 00:00:00 2001
From: Chris Nighswonger
Date: Tue, 18 Dec 2007 14:41:29 -0500
Subject: [PATCH 54/57] Win32 support: Added differentiation between -w perl
switch in shebang line.
Signed-off-by: Galen Charlton
---
fix-perl-path.PL | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/fix-perl-path.PL b/fix-perl-path.PL
index 600241f0a3..7e23b0be23 100644
--- a/fix-perl-path.PL
+++ b/fix-perl-path.PL
@@ -20,13 +20,13 @@ use ExtUtils::MakeMaker::Config;
use Tie::File;
my $basedir = (shift);
-my $DEBUG = 0;
+my $DEBUG = 1;
$DEBUG = 1 if $basedir eq 'test';
my $bindir = $Config{installbin};
$bindir =~ s!\\!/!g; # make all directory separators uniform since Win32 does not care and *nix does...
-my $shebang = "#!$bindir\/perl -w";
+my $shebang = "#!$bindir\/perl";
warn "Perl binary located in $bindir on this system.\n" if $DEBUG;
warn "The shebang line for this sytems should be $shebang\n\n" if $DEBUG;
@@ -65,7 +65,7 @@ sub fixshebang{
warn "Reading $dir contents.\n" if $DEBUG;
while( my $file = readdir($dh) ) {
# this may be used to exclude any desired files from the scan
- if ( $file =~ /shebang|wixgen/ ) { next; }
+ # if ( $file =~ /foo/ ) { next; }
# handle files... other extensions could be substituted/added if needed
if ( $file =~ /\.pl$/ ) {
my @filearray;
@@ -73,15 +73,15 @@ sub fixshebang{
warn "Found a perl script named $pathfile\n" if $DEBUG;
tie @filearray, 'Tie::File', $pathfile or die $!;
warn "First line of $file is $filearray[0]\n\n" if $DEBUG;
- if ( ( $filearray[0] =~ /#!.*perl/ ) && ( $filearray[0] !~ /$shebang/ ) ) {
+ if ( ( $filearray[0] =~ /#!.*perl/ ) && ( $filearray[0] !~ /$shebang|"$shebang -w"/ ) ) {
warn "\n\tRe-writing shebang line for $pathfile\n" if $DEBUG;
warn "\tOriginal shebang line: $filearray[0]\n" if $DEBUG;
- $filearray[0] = $shebang;
+ $filearray[0] =~ /-w$/ ? $filearray[0] = "$shebang -w" : $filearray[0] = $shebang;
warn "\tNew shebang line is: $filearray[0]\n\n" if $DEBUG;
untie @filearray;
next;
}
- elsif ( $filearray[0] =~ /$shebang/ ) {
+ elsif ( $filearray[0] =~ /$shebang|"$shebang -w"/ ) {
warn "\n\tShebang line is correct.\n\n" if $DEBUG;
untie @filearray;
next;
@@ -97,7 +97,6 @@ sub fixshebang{
my $dirpath = $dir . '/' . $file;
warn "Found a subdir named $dirpath\n" if $DEBUG;
fixshebang ($dirpath);
-# closedir $dh; # I'm not really sure if this is necessary
}
}
closedir $dh;
From d18a80820a22ab6af41df35468ee09aebd1933e1 Mon Sep 17 00:00:00 2001
From: Galen Charlton
Date: Tue, 18 Dec 2007 14:53:47 -0600
Subject: [PATCH 55/57] installer: adjusted conditional for setting exported
variables
Now checks for win32, and assumes (for now) a default
for all other platforms.
---
Makefile.PL | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/Makefile.PL b/Makefile.PL
index 7dec2763e9..114bf3f93f 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -1168,19 +1168,19 @@ sub postamble {
$config{'ZEBRA_PASS'} =~ s/\$/\$\$/g;
# Hereagain, we must alter syntax per platform...
- if ( $^O =~ /linux|cygwin/ ) {
- my $env = join("\n", map { "export __${_}__ := $target_directories->{$_}" } keys %$target_directories);
- $env .= "\n\n";
- $env .= join("\n", map { "export __${_}__ := $config{$_}" } keys %config);
- return "$env\n";
- }
- elsif ( $^O eq 'MSWin32' ) {
+ if ( $^O eq 'MSWin32' ) {
# NOTE: it is imperative that there be no whitespaces in ENV=value...
my $env = join("\n", map { "__${_}__=$target_directories->{$_}" } keys %$target_directories);
$env .= "\n\n";
$env .= join("\n", map { "__${_}__=$config{$_}" } keys %config);
return "$env\n";
}
+ else {
+ my $env = join("\n", map { "export __${_}__ := $target_directories->{$_}" } keys %$target_directories);
+ $env .= "\n\n";
+ $env .= join("\n", map { "export __${_}__ := $config{$_}" } keys %config);
+ return "$env\n";
+ }
}
From 06fb84f56632e976b1a97a98413c4064af935c0e Mon Sep 17 00:00:00 2001
From: Galen Charlton
Date: Tue, 18 Dec 2007 14:54:51 -0600
Subject: [PATCH 56/57] installer: made $DEBUG in fix-perl-path.pl contigent on
DEBUG env var
---
fix-perl-path.PL | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fix-perl-path.PL b/fix-perl-path.PL
index 7e23b0be23..aa37161ce4 100644
--- a/fix-perl-path.PL
+++ b/fix-perl-path.PL
@@ -20,7 +20,7 @@ use ExtUtils::MakeMaker::Config;
use Tie::File;
my $basedir = (shift);
-my $DEBUG = 1;
+my $DEBUG = exists $ENV{'DEBUG'} ? $ENV{'DEBUG'} : 0;
$DEBUG = 1 if $basedir eq 'test';
From 5b98031b6089ca98cf8ebd2552b66ad9efb34908 Mon Sep 17 00:00:00 2001
From: Galen Charlton
Date: Tue, 18 Dec 2007 15:11:28 -0600
Subject: [PATCH 57/57] installer: deal with permissions in fix-perl-path.PL
Files in blib generally are a-w on Unix platforms.
Modified fix-perl-path.PL to temporarily set them
o+w while file is being checked.
---
fix-perl-path.PL | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/fix-perl-path.PL b/fix-perl-path.PL
index aa37161ce4..07bff66a37 100644
--- a/fix-perl-path.PL
+++ b/fix-perl-path.PL
@@ -71,6 +71,16 @@ sub fixshebang{
my @filearray;
my $pathfile =$dir . '/' . $file;
warn "Found a perl script named $pathfile\n" if $DEBUG;
+
+ # At this point, file is in 'blib' and by default
+ # has mode a-w. Therefore, must change permission
+ # to make it writable.
+ my $old_perm;
+ if ($^O ne 'MSWin32') {
+ $old_perm = (stat $pathfile)[2] & 07777;
+ my $new_perm = $old_perm | 0200;
+ chmod $new_perm, $pathfile;
+ }
tie @filearray, 'Tie::File', $pathfile or die $!;
warn "First line of $file is $filearray[0]\n\n" if $DEBUG;
if ( ( $filearray[0] =~ /#!.*perl/ ) && ( $filearray[0] !~ /$shebang|"$shebang -w"/ ) ) {
@@ -78,19 +88,17 @@ sub fixshebang{
warn "\tOriginal shebang line: $filearray[0]\n" if $DEBUG;
$filearray[0] =~ /-w$/ ? $filearray[0] = "$shebang -w" : $filearray[0] = $shebang;
warn "\tNew shebang line is: $filearray[0]\n\n" if $DEBUG;
- untie @filearray;
- next;
}
elsif ( $filearray[0] =~ /$shebang|"$shebang -w"/ ) {
warn "\n\tShebang line is correct.\n\n" if $DEBUG;
- untie @filearray;
- next;
}
else {
warn "\n\tNo shebang line found in $pathfile\n\n" if $DEBUG;
- untie @filearray;
- next;
}
+ untie @filearray;
+ if ($^O ne 'MSWin32') {
+ chmod $old_perm, $pathfile;
+ }
}
# handle directories
elsif ( -d ($dir . '/' . $file) && $file !~ /^\.{1,2}/ ) {