Browse Source

Add configuration file helper to the installer

Signed-off-by: Chris Cormack <crc@liblime.com>
3.0.x
MJ Ray 15 years ago
committed by Chris Cormack
parent
commit
e449c139ff
  1. 3
      C4/Context.pm
  2. 28
      Makefile.PL
  3. 20
      etc/README.txt
  4. 0
      etc/ccl.properties
  5. 45
      etc/cql.properties
  6. 50
      etc/koha-conf.xml
  7. 59
      etc/koha-httpd.conf
  8. 0
      etc/pqf.properties
  9. 46
      etc/zebra-authorities.cfg
  10. 42
      etc/zebra-biblios.cfg
  11. 105
      rewrite-config.PL

3
C4/Context.pm

@ -28,8 +28,7 @@ use vars qw($VERSION $AUTOLOAD),
qw($context),
qw(@context_stack);
$VERSION = do { my @v = '$Revision$' =~ /\d+/g;
shift(@v) . "." . join("_", map {sprintf "%03d", $_ } @v); };
$VERSION = '3.00.00.002';
=head1 NAME

28
Makefile.PL

@ -47,7 +47,7 @@ and generate configuration files.
=head1 VARIABLES
=head2 NAME, VERSION, ABSTRACT, AUTHOR
=head2 NAME, VERSION_FROM, ABSTRACT, AUTHOR
Basic metadata about this software.
@ -79,7 +79,8 @@ to generate initial configuration files.
WriteMakefile(
NAME => 'koha',
VERSION => strftime('2.9.%Y%m%d%H',gmtime),
#VERSION => strftime('2.9.%Y%m%d%H',gmtime),
VERSION_FROM => 'C4/Context.pm',
ABSTRACT => 'Award-winning integrated library system (ILS) and Web OPAC',
AUTHOR => 'Koha Developers <koha-devel@nongnu.org>',
NO_META => 1,
@ -150,7 +151,14 @@ WriteMakefile(
# return { macro => { 'export TEST' => '755' } }
# },
# PL_FILES => { # generator => target
PL_FILES => { # generator => target(s)
'rewrite-config.PL' => [
'$(INST_LIBDIR)/koha/etc/koha-conf.xml',
'$(INST_LIBDIR)/koha/etc/koha-httpd.conf',
'$(INST_LIBDIR)/koha/etc/zebra-biblios.cfg',
'$(INST_LIBDIR)/koha/etc/zebra-authorities.cfg'
]
}
# 'opac/getfromintranet.PL' => ['$(INST_LIBDIR)/opac/cgi-bin/detail.pl','$(INST_LIBDIR)/opac/cgi-bin/moredetail.pl','$(INST_LIBDIR)/opac/cgi-bin/search.pl','$(INST_LIBDIR)/opac/cgi-bin/subjectsearch.pl','$(INST_LIBDIR)/opac/cgi-bin/logout.pl'],
# 'misc/koha.conf.PL' => '$(INST_LIBDIR)/../etc/koha.conf',
# 'misc/apache-koha.conf.PL' => '$(INST_LIBDIR)/../etc/apache-koha.conf',
@ -217,6 +225,16 @@ excluding non-files, CVS files and whitespace in filenames.
$result{$src} = '$(INST_LIBDIR)/koha/templates/'.$src;
}
}
=pod
etc files are copied to koha/etc
=cut
# Misc etc to koha/etc
foreach my $src (glob("etc/*")) {
$result{$src} = '$(INST_LIBDIR)/koha/'.$src;
}
return \%result;
}
@ -228,5 +246,9 @@ __END__
ExtUtils::MakeMaker(3)
=head1 AUTHOR
MJ Ray mjr at phonecoop.coop
=cut

20
etc/README.txt

@ -0,0 +1,20 @@
Koha Configuration Files:
The following files specify the base configuration for Koha ZOOM:
* koha-httpd.conf
In a debian system, this apache configuration file will be symlinked
from /etc/apache2/sites-enabled
Specify Koha's IP address with NameVirtualHost
Set ServerName, etc
* koha-production.xml
* koha-testing.xml
These are the production and testing configurations for zebrasrv and for Koha.
The first part of each file specifies Zebra server names, indexing configuration files,
and query language configurations. Koha configuration directives follow.
* zebra-authorities.cfg
* zebra-biblios.cfg

0
misc/zebra/ccl.properties → etc/ccl.properties

45
etc/cql.properties

@ -0,0 +1,45 @@
# CCL field mappings
# $Id: default.bib,v 1.1 2006/06/13 16:44:21 mike Exp $
#
# The rule below is used when no fields are specified
term t=l,r s=al
#
# Simple rule for a field called "clean"
clean t=l,r
#
# Rules for some BIB-1 fields
au u=1003 s=pw
ti u=4 s=pw
isbn u=7
issn u=8
cc u=20
su u=21 s=pw
date u=30 r=r
dp u=31 r=r
da u=32 r=r
la u=54 s=pw
ab u=62 s=pw
note u=63 s=pw
af u=1006 s=pw
#
# Rules for a few GILS fields
north gils-attset,u=2040 r=o
south gils-attset,u=2041 r=o
east gils-attset,u=2038 r=o
west gils-attest,u=2039 r=o
distributor gils-attset,u=2000 s=pw
distributorname gils-attset,u=2001 s=pw
# Explain fields
ExplainCategory exp1,1=1
HumanStringLanguage exp1,1=2
DatabaseName exp1,1=3
TargetName exp1,1=4
AttributeSetOID exp1,1=5
RecordSyntaxOID exp1,1=6
TagSetOID exp1,1=7
ExtededServiceOID exp1,1=8
DateAdded exp1,1=9
DateChanged exp1,1=10
DateExpires exp1,1=11
ElementSetName exp1,1=12

50
etc/koha-conf.xml

@ -0,0 +1,50 @@
<yazgfs>
<!-- [scheme:]host[:port][/databaseName] -->
<!-- scheme: tcp, ssl, unix, http, sru -->
<!-- can run all servers on tcp, but the unix socket is faster -->
<listen id="biblioserver" >unix:__BASE_DIR__/tmp/bibliosocket</listen>
<listen id="authorityserver" >unix:__BASE_DIR__/tmp/authoritysocket</listen>
<!-- public server runs on tcp -->
<!-- <listen id="publicserver" >tcp:@:9999</listen> -->
<!-- BIBLIOGRAPHIC RECORDS -->
<server id="biblioserver" listenref="biblioserver">
<directory>__BASE_DIR__/zebradb/biblios</directory>
<config>__BASE_DIR__/etc/zebra-biblios.cfg</config>
<cql2rpn>__BASE_DIR__/etc/pqf.properties</cql2rpn>
</server>
<serverinfo id="biblioserver">
<ccl2rpn>__BASE_DIR__/ccl.properties</ccl2rpn>
<user>__ZEBRA_USER__</user>
<password>__ZEBRA_PASS__</password>
</serverinfo>
<!-- AUTHORITY RECORDS -->
<server id="authorityserver" listenref="authorityserver" >
<directory>__BASE_DIR__/zebradb/authorities</directory>
<config>__BASE_DIR__/etc/zebra-authorities.cfg</config>
</server>
<serverinfo id="authorityserver">
<ccl2rpn>__BASE_DIR__/etc/ccl.properties</ccl2rpn>
<user>__ZEBRA_USER__</user>
<password>__ZEBRA_PASS__</password>
</serverinfo>
<!-- ADDITIONAL KOHA CONFIGURATION DIRECTIVE -->
<config>
<database>__MYSQL_DB__</database>
<hostname>__MYSQL_HOST__</hostname>
<user>__MYSQL_USER__</user>
<pass>__MYSQL_PASS__</pass>
<biblioserver>biblios</biblioserver>
<biblioservershadow>1</biblioservershadow>
<authorityserver>authorities</authorityserver>
<authorityservershadow>1</authorityservershadow>
<intranetdir>__BASE_DIR__/intranet/cgi-bin</intranetdir>
<opacdir>__BASE_DIR__/opac/cgi-bin</opacdir>
<opachtdocs>__BASE_DIR__/opac/htdocs/opac-tmpl</opachtdocs>
<intrahtdocs>__BASE_DIR__/intranet/htdocs/intranet-tmpl</intrahtdocs>
<includes>__BASE_DIR__/intranet/htdocs/intranet-tmpl/default/en/includes/</includes>
</config>
</yazgfs>

59
etc/koha-httpd.conf

@ -0,0 +1,59 @@
# Koha Apache Configuration Directives
#NameVirtualHost *
## OPAC
<VirtualHost __WEBSERVER_IP__:80>
ServerAdmin webmaster@__WEBSERVER_DOMAIN__
DocumentRoot __BASE_DIR__/opac/htdocs
ServerName __WEBSERVER_HOST__
# ServerAlias opac.mydomain.com
ScriptAlias /cgi-bin/koha/ "__BASE_DIR__/opac/cgi-bin/"
ScriptAlias /index.html "__BASE_DIR__/opac/cgi-bin/opac-main.pl"
ScriptAlias /opac-search.pl "__BASE_DIR__/opac/cgi-bin/search"
ScriptAlias /search "__BASE_DIR__/opac/cgi-bin/search"
ErrorLog __BASE_DIR__/log/opac-error_log
# TransferLog __BASE_DIR__/log/opac-access_log
SetEnv PERL5LIB "__BASE_DIR__/intranet/modules"
SetEnv KOHA_CONF "__BASE_DIR__/etc/koha-conf.xml"
Options +FollowSymLinks
# Rewrite Rules
RewriteEngine On
# Uncomment to turn on rewrite logging
# RewriteLog __BASE_DIR__/log/opac-rewrite.log
# RewriteLogLevel 1
RewriteCond %{QUERY_STRING} (.*?)(?:[A-Za-z0-9_-]+)=&(.*)
RewriteRule (.+) $1?%1%2 [N,R,NE]
RewriteRule ^/bib/([^\/]*)/?$ /cgi-bin/koha/opac-detail\.pl?bib=$1 [PT]
RewriteRule ^/isbn/([^\/]*)/?$ /search?q=isbn:$1 [PT]
RewriteRule ^/issn/([^\/]*)/?$ /search?q=issn:$1 [PT]
</VirtualHost>
## Intranet
<VirtualHost __WEBSERVER_IP__:8080>
ServerAdmin webmaster@__WEBSERVER_DOMAIN__
DocumentRoot __BASE_DIR__/intranet/htdocs
ServerName __WEBSERVER_HOST__:8080
# ServerAlias intranet.mydomain.com
ScriptAlias /cgi-bin/koha/ "__BASE_DIR__/intranet/cgi-bin/"
ScriptAlias /index.html "__BASE_DIR__/intranet/cgi-bin/mainpage.pl"
ScriptAlias /search "__BASE_DIR__/intranet/cgi-bin/search.pl"
ErrorLog __BASE_DIR__/log/error_log
# TransferLog __BASE_DIR__/log/access_log
SetEnv PERL5LIB "__BASE_DIR__/intranet/modules"
SetEnv KOHA_CONF "__BASE_DIR__/etc/koha-conf.xml"
Options +FollowSymLinks
RewriteEngine On
# Uncomment to turn on rewrite logging
# RewriteLog __BASE_DIR__/log/intranet-rewrite.log
# RewriteLogLevel 1
RewriteCond %{QUERY_STRING} (.*?)(?:[A-Za-z0-9_-]+)=&(.*)
RewriteRule (.+) $1?%1%2 [N,R,NE]
RewriteRule ^/bib/([^\/]*)/?$ /cgi-bin/koha/detail\.pl?bib=$1 [PT]
RewriteRule ^/isbn/([^\/]*)/?$ /search?q=isbn:$1 [PT]
RewriteRule ^/issn/([^\/]*)/?$ /search?q=issn:$1 [PT]
</VirtualHost>

0
misc/zebra/pqf.properties → etc/pqf.properties

46
etc/zebra-authorities.cfg

@ -0,0 +1,46 @@
# Simple Zebra configuration file that defines
# a database with MARCXML records.
# $Id: zebra.cfg,v 1.1.2.2 2006/05/09 12:03:16 rangi Exp $
#
# Where are the config files located?
profilePath:__BASE_DIR__/zebradb/authorities/tab:__BASE_DIR__/zebradb/tab
encoding: UTF-8
# modulePath - where to look for loadable zebra modules
modulePath: /usr/lib/idzebra-2.0/modules
# Files that describe the attribute sets supported.
attset: bib1.att
attset: explain.att
attset:gils.att
#systag sysno rank
# Specify record type
iso2709.recordType:grs.marcxml.record
recordType:grs.xml
recordId: (bib1,Local-Number)
# was auth1
storeKeys:1
storeData:1
# Lock File Area
lockDir: __BASE_DIR__/zebradb/authorities/lock
perm.anonymous:r
perm.kohaadmin:rw
passw.kohalis
shadow
register: __BASE_DIR__/zebradb/authorities/register:4G
shadow: __BASE_DIR__/zebradb/authorities/shadow:1G
# Temp File area for result sets
setTmpDir: __BASE_DIR__/zebradb/authorities/tmp
# Temp File area for index program
keyTmpDir: __BASE_DIR__/zebradb/authorities/key
# Approx. Memory usage during indexing
memMax: 200M
rank:rank-1

42
etc/zebra-biblios.cfg

@ -0,0 +1,42 @@
# Simple Zebra configuration file that defines
# a database with MARCXML records.
# $Id: zebra.cfg,v 1.1.2.2 2006/05/09 12:03:16 rangi Exp $
#
# Where are the config files located?
profilePath:__BASE_DIR__/zebradb/biblios/tab:__BASE_DIR__/zebradb/tab
# modulePath - where to look for loadable zebra modules
modulePath: /usr/lib/idzebra-2.0/modules
encoding: UTF-8
# Files that describe the attribute sets supported.
attset: bib1.att
attset: explain.att
attset:gils.att
# systag sysno rank
# Specify record type
iso2709.recordType:grs.marcxml.record
recordType:grs.xml
recordId: (bib1,Local-number)
storeKeys:1
storeData:1
# Lock File Area
lockDir: __BASE_DIR__/zebradb/biblios/lock
perm.anonymous:r
perm.kohaadmin:rw
passw.kohalis
shadow
register: __BASE_DIR__/zebradb/biblios/register:4G
shadow: __BASE_DIR__/zebradb/biblios/shadow:4G
# Temp File area for result sets
setTmpDir: __BASE_DIR__/zebradb/biblios/tmp
# Temp File area for index program
keyTmpDir: __BASE_DIR__/zebradb/biblios/key
# Approx. Memory usage during indexing
memMax: 500M
rank:rank-1

105
rewrite-config.PL

@ -0,0 +1,105 @@
# Copyright 2007 MJ Ray
#
# 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
#
# Current maintainer MJR http://mjr.towers.org.uk/
# See http://www.koha.org/wiki/?page=KohaInstaller
use Sys::Hostname;
use Socket;
=head1 NAME
rewrite-config.PL - helper for the Koha packager and installer
=head1 SYNOPSIS
perl rewrite-config.PL configurationfile
=head1 DESCRIPTION
This helper script replaces placeholders in the
configuration files with value either supplied through
the environment (with export, or by putting them on
the start of the make command linke) or with reasonable
guesses worked out by the script.
=head2 KEYS
The following configuration keys are available:
BASE_DIR, MYSQL_DB, MYSQL_HOST, MYSQL_PASS, MYSQL_USER, WEBSERVER_DOMAIN,
WEBSERVER_HOST, WEBSERVER_IP, ZEBRA_PASS, ZEBRA_USER
=cut
$myhost = hostname();
$mydomain = $myhost;
$mydomain =~ s/^.*?\.//;
# These are our configuration guesses
# Keys were extracted by
# <grep -o '__.*__' etc/* | cut -f2 -d: | sort -u | sed -e 's/^/ "/;s/$/" => "",/'
%configuration = (
"__BASE_DIR__" => sprintf("/usr/lib/perl5/site-perl/%vd/koha",$^V),
"__MYSQL_DB__" => "koha",
"__MYSQL_HOST__" => $myhost,
"__MYSQL_PASS__" => "katikoan",
"__MYSQL_USER__" => "kohaadmin",
"__WEBSERVER_DOMAIN__" => $mydomain,
"__WEBSERVER_HOST__" => $myhost,
# This is set like this to rescue systems with broken DNS
"__WEBSERVER_IP__" => $ENV{'WEBSERVER_IP'} || inet_ntoa(scalar gethostbyname($myhost||'localhost')) || die "Cannot get our own IP address: DNS fault?",
"__ZEBRA_PASS__" => "zebrastripes",
"__ZEBRA_USER__" => "kohauser",
);
# Override configuration from the environment
foreach $key (keys %configuration) {
if (defined($ENV{$key})) {
$configuration{$key} = $ENV{$key};
}
}
$fname = $ARGV[0];
$file = read_file($fname);
$file =~ s/__.*?__/$configuration{$&}/seg;
chmod 0644, $fname;
open(OUTPUT,">$fname") || die "Can't open $fname for write: $!";
print OUTPUT $file;
close(OUTPUT);
# Idea taken from perlfaq5
sub read_file($) {
local(*INPUT,$/);
open(INPUT,$_[0]) || die "Can't open $_[0] for read";
my $file = <INPUT>;
return $file;
}
__END__
=head1 SEE ALSO
Makefile.PL, ExtUtils::MakeMaker(3)
=head1 AUTHOR
MJ Ray mjr at phonecoop.coop
=cut
Loading…
Cancel
Save