diff --git a/debian/control b/debian/control
index 567ae57029..7050d7dfce 100644
--- a/debian/control
+++ b/debian/control
@@ -5,23 +5,40 @@ Priority: optional
Standards-Version: 3.8.4
Build-Depends: koha-dev-env, debhelper (>= 7.0.50), gettext
-Package: koha
+Package: koha-common
Architecture: all
Depends: ${shlib:Depends}, ${misc:Depends},
- dbconfig-common,
koha-dev-env,
apache2,
- mysql-server,
- daemon,
at,
+ daemon,
idzebra-2.0,
- yaz,
libjs-jquery,
+ libjs-yui,
+ mysql-client,
+ mysql-server,
tinymce2,
- libjs-yui
-Recommends: mysql-client
+ yaz
Homepage: http://koha-community.org/
Description: integrated (physical) library management system
Koha is an Integrated Library Managment system for real-world libraries
(the kinds with books).
+ .
+ This package contains everything needed to run Koha, except the site
+ specific configuration files. See the package koha for the rest.
+Package: koha
+Architecture: all
+Depends: ${shlib:Depends}, ${misc:Depends},
+ koha-common,
+ dbconfig-common,
+ mysql-server
+Homepage: http://koha-community.org/
+Description: integrated (physical) library management system
+ Koha is an Integrated Library Managment system for real-world libraries
+ (the kinds with books).
+ .
+ This package contains site-specific configuration files and sets up
+ the MySQL database for Koha. For simplicity, the database server is
+ assumed to run on the same host as Koha. This package also does some
+ Apache reconfiguration.
diff --git a/debian/koha-common.README.Debian b/debian/koha-common.README.Debian
new file mode 100644
index 0000000000..221e1a399b
--- /dev/null
+++ b/debian/koha-common.README.Debian
@@ -0,0 +1,19 @@
+Koha filesystem layout on Debian
+================================
+
+The Debian packaging of Koha puts files in the following places:
+
+* /etc/koha -- system configuration files
+* /etc/cron.hourly/koha-common -- cron job
+* /usr/share/koha -- shared files (HTML templates, Perl code, etc)
+
+Each Koha instance has files in the following places:
+
+* /etc/koha/sites/$name -- confguration files
+* /etc/apache2/sites-available/$name -- Apache config file
+* /var/lib/koha/$name -- Zebra databases
+* /var/log/koha/$name -- log files (Apache, Zebra)
+* /var/lock/koha/$name -- run-time lock files
+* /var/run/koha/$name -- run-time sockets etc
+* /var/spool/koha/$name -- database dumps
+
diff --git a/debian/koha-common.dirs b/debian/koha-common.dirs
new file mode 100644
index 0000000000..93a60417cb
--- /dev/null
+++ b/debian/koha-common.dirs
@@ -0,0 +1,5 @@
+etc/koha/sites
+var/lib/koha
+var/log/koha
+var/lock/koha
+var/spool/koha
diff --git a/debian/koha-common.install b/debian/koha-common.install
new file mode 100644
index 0000000000..148ed6c4f8
--- /dev/null
+++ b/debian/koha-common.install
@@ -0,0 +1,5 @@
+misc/release_notes/release_notes_3*.txt usr/share/doc/koha-common
+debian/tmp/usr/* usr
+debian/tmp/etc/koha/pazpar2
+debian/tmp/etc/koha/zebradb/[!z]*
+debian/templates/* etc/koha
diff --git a/debian/koha-common.logrotate b/debian/koha-common.logrotate
new file mode 100644
index 0000000000..37024d3b6d
--- /dev/null
+++ b/debian/koha-common.logrotate
@@ -0,0 +1,14 @@
+# Rotate log files for all Koha instances.
+
+/var/log/koha/*/*.log {
+ rotate 5
+ weekly
+ missingok
+ compress
+ delaycompress
+ notifempty
+ sharedscripts
+ postrotate
+ /etc/init.d/apache2 reload > /dev/null
+ endscript
+}
diff --git a/debian/koha.install b/debian/koha.install
index 2f036b4cc9..831de78d8f 100644
--- a/debian/koha.install
+++ b/debian/koha.install
@@ -1 +1,6 @@
-misc/release_notes/release_notes_3*.txt usr/share/doc/koha
+debian/tmp/etc/apache2
+debian/tmp/etc/koha/koha-httpd.conf
+debian/tmp/var
+debian/tmp/etc/koha/zebradb/zebra-biblios.cfg
+debian/tmp/etc/koha/zebradb/zebra-authorities.cfg
+debian/tmp/etc/koha/zebradb/zebra-authorities-dom.cfg
diff --git a/debian/rules b/debian/rules
index bb49c0acfe..f573a9ca2b 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,16 +1,17 @@
#!/usr/bin/make -f
-PACKAGE = $(shell dh_listpackages)
-TMP = $(CURDIR)/debian/$(PACKAGE)
+TMP = $(CURDIR)/debian/tmp
# Make "perl Makefile.PL" be non-interactive.
export PERL_MM_USE_DEFAULT=1
%:
- dh $@
+ dh $@ --fail-missing
override_dh_auto_install:
dh_auto_install
+ rm $(TMP)/etc/koha/README.txt
+ rm -r $(TMP)/usr/share/koha/doc
rm -r $(TMP)/var/run
rm -r $(TMP)/var/lock
rm $(TMP)/var/log/koha/README
@@ -32,6 +33,9 @@ override_dh_auto_install:
$(TMP)/usr/share/koha/opac/htdocs/opac-tmpl/prog/en/lib/yui
ln -s /usr/share/javascript/yui \
$(TMP)/usr/share/koha/opac/htdocs/opac-tmpl/prog/en/lib/yui
+ install -d $(TMP)/etc/apache2/sites-available
+ install -d $(TMP)/etc/apache2/sites-enabled
+ install -d $(TMP)/etc/apache2/conf.d
ln -s ../../koha/koha-httpd.conf $(TMP)/etc/apache2/sites-available/koha
ln -s ../sites-available/koha $(TMP)/etc/apache2/sites-enabled/koha
install -m 0644 debian/koha.apache-ports $(TMP)/etc/apache2/conf.d/koha
diff --git a/debian/templates/apache-shared-disable.conf b/debian/templates/apache-shared-disable.conf
new file mode 100644
index 0000000000..0696bf05d7
--- /dev/null
+++ b/debian/templates/apache-shared-disable.conf
@@ -0,0 +1,3 @@
+# This file is included in a Koha site's Apache config to disable the site.
+
+RewriteRule .* /unavailable.html [L]
diff --git a/debian/templates/apache-shared-intranet.conf b/debian/templates/apache-shared-intranet.conf
new file mode 100644
index 0000000000..04bab25f61
--- /dev/null
+++ b/debian/templates/apache-shared-intranet.conf
@@ -0,0 +1,19 @@
+# Apache configuration settings that are shared for every Koha instance.
+# This file contains settings for the intranet site.
+#
+# This file should be included from an instance's
+# /etc/apache2/site-available file, from within the VirtualHost section
+# for the intranet.
+
+DocumentRoot /usr/share/koha/intranet/htdocs
+
+ScriptAlias /cgi-bin/koha/ "/usr/share/koha/intranet/cgi-bin/"
+ScriptAlias /index.html "/usr/share/koha/intranet/cgi-bin/mainpage.pl"
+ScriptAlias /search "/usr/share/koha/intranet/cgi-bin/search.pl"
+
+
+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]
diff --git a/debian/templates/apache-shared-opac.conf b/debian/templates/apache-shared-opac.conf
new file mode 100644
index 0000000000..42715c89e3
--- /dev/null
+++ b/debian/templates/apache-shared-opac.conf
@@ -0,0 +1,19 @@
+# Apache configuration settings that are shared for every Koha instance.
+# This file contains settings for the OPAC site.
+#
+# This file should be included from an instance's
+# /etc/apache2/site-available file, from within the VirtualHost section
+# for OPAC.
+
+DocumentRoot /usr/share/koha/opac/htdocs
+
+ScriptAlias /cgi-bin/koha/ "/usr/share/koha/opac/cgi-bin/opac/"
+ScriptAlias /index.html "/usr/share/koha/opac/cgi-bin/opac/opac-main.pl"
+ScriptAlias /search "/usr/share/koha/opac/cgi-bin/opac/opac-search.pl"
+ScriptAlias /opac-search.pl "/usr/share/koha/opac/cgi-bin/opac/opac-search.pl"
+
+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]
diff --git a/debian/templates/apache-shared.conf b/debian/templates/apache-shared.conf
new file mode 100644
index 0000000000..077bd7fc17
--- /dev/null
+++ b/debian/templates/apache-shared.conf
@@ -0,0 +1,69 @@
+# Apache configuration settings that are shared for every Koha instance.
+# This file contains settings that are the same for both the OPAC and
+# the Intranet site.
+#
+# This file should be included from an instance's
+# /etc/apache2/site-available file, once from the OPAC section, and once
+# from the intranet section.
+
+
+SetEnv PERL5LIB "/usr/share/koha/lib"
+
+
+
+ mod_gzip_on yes
+ mod_gzip_dechunk yes
+ mod_gzip_keep_workfiles No
+ mod_gzip_can_negotiate yes
+ mod_gzip_update_static No
+ mod_gzip_temp_dir /tmp
+ mod_gzip_minimum_file_size 512
+ mod_gzip_maximum_file_size 1000000
+ mod_gzip_maximum_inmem_size 1000000
+ mod_gzip_handle_methods GET POST
+ mod_gzip_item_exclude reqheader "User-Agent: .*Mozilla/4\..*\["
+ mod_gzip_item_exclude mime ^image/.*
+ mod_gzip_item_exclude rspheader Content-Type:image/*
+ mod_gzip_item_include file \.js$
+ mod_gzip_item_include mime ^application/x-javascript$
+ mod_gzip_item_include file \.php$
+ mod_gzip_item_include mime ^text/html$
+ mod_gzip_item_include file \.css$
+ mod_gzip_item_include mime ^text/css$
+
+
+
+
+ # Compress content with type html, text, and css, ...
+ AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css
+ AddOutputFilterByType DEFLATE application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript
+
+ DeflateCompressionLevel 9
+
+ # Properly handle old browsers that do not support compression
+ BrowserMatch ^Mozilla/4 gzip-only-text/html
+ BrowserMatch ^Mozilla/4\.0[678] no-gzip
+ BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
+
+ DeflateFilterNote Input instream
+ DeflateFilterNote Output outstream
+ DeflateFilterNote Ratio ratio
+
+ LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate
+
+ #properly handle requests coming from behind proxies
+ Header append Vary User-Agent
+
+
+
+
+Options +FollowSymLinks
+
+
+ErrorDocument 400 /cgi-bin/koha/errors/400.pl
+ErrorDocument 401 /cgi-bin/koha/errors/401.pl
+ErrorDocument 403 /cgi-bin/koha/errors/403.pl
+ErrorDocument 404 /cgi-bin/koha/errors/404.pl
+ErrorDocument 500 /cgi-bin/koha/errors/500.pl
+
+RewriteEngine On
diff --git a/debian/templates/apache-site.conf.in b/debian/templates/apache-site.conf.in
new file mode 100644
index 0000000000..e8313406de
--- /dev/null
+++ b/debian/templates/apache-site.conf.in
@@ -0,0 +1,31 @@
+# Koha instance __KOHASITE__ Apache config.
+
+# OPAC
+
+ Include /etc/koha/apache-shared.conf
+# Include /etc/koha/apache-shared-disable.conf
+ Include /etc/koha/apache-shared-opac.conf
+
+ ServerName __OPACSERVER__
+ SetEnv KOHA_CONF "/etc/koha/sites/__KOHASITE__/koha-conf.xml"
+ User __UNIXUSER__
+ Group __UNIXGROUP__
+
+ ErrorLog /var/log/koha/__KOHASITE__/opac-error.log
+# TransferLog /var/log/koha/__KOHASITE__/opac-access_log
+# RewriteLog /var/log/koha/__KOHASITE__/opac-rewrite.log
+
+
+# Intranet
+
+ Include /etc/koha/apache-shared.conf
+# Include /etc/koha/apache-shared-disable.conf
+ Include /etc/koha/apache-shared-intranet.conf
+
+ ServerName __INTRASERVER__
+ SetEnv KOHA_CONF "/etc/koha/sites/__KOHASITE__/koha-conf.xml"
+
+ ErrorLog /var/log/koha/__KOHASITE__/intranet-error.log
+# TransferLog /var/log/koha/__KOHASITE__/intranet-access_log
+# RewriteLog /var/log/koha/__KOHASITE__/intranet-rewrite.log
+
diff --git a/debian/templates/koha-conf-site.xml.in b/debian/templates/koha-conf-site.xml.in
new file mode 100644
index 0000000000..38808fe2dd
--- /dev/null
+++ b/debian/templates/koha-conf-site.xml.in
@@ -0,0 +1,145 @@
+
+
+unix:/var/run/koha/__KOHASITE__/bibliosocket
+unix:/var/run/koha/__KOHASITE__/authoritysocket
+
+
+
+ /var/lib/koha/__KOHASITE__/biblios
+ /etc/koha/sites/__KOHASITE__/zebra-biblios.cfg
+ /etc/koha/zebradb/pqf.properties
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ /etc/koha/zebradb/ccl.properties
+ kohauser
+ __ZEBRA_PASS__
+
+
+
+
+ /var/lib/koha/__KOHASITE__/authorities
+ /etc/koha/sites/__KOHASITE__/zebra-authorities-dom.cfg
+ /etc/koha/zebradb/pqf.properties
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ /etc/koha/zebradb/ccl.properties
+ kohauser
+ __ZEBRA_PASS__
+
+
+
+ mysql
+ __DB_NAME__
+ localhost
+ 3306
+ __DB_USER__
+ __DB_PASS__
+ biblios
+ 1
+ authorities
+ 1
+ /usr/share/koha/intranet/cgi-bin
+ /usr/share/koha/opac/cgi-bin/opac
+ /usr/share/koha/opac/htdocs/opac-tmpl
+ /usr/share/koha/intranet/htdocs/intranet-tmpl
+ /usr/share/koha/intranet/htdocs/intranet-tmpl/prog/en/includes/
+ /var/log/koha/__KOHASITE__
+ /usr/share/koha/misc/koha-install-log
+ 0
+
+
+
+
+
diff --git a/debian/templates/zebra-authorities-dom-site.cfg.in b/debian/templates/zebra-authorities-dom-site.cfg.in
new file mode 100644
index 0000000000..5b8fd7ac26
--- /dev/null
+++ b/debian/templates/zebra-authorities-dom-site.cfg.in
@@ -0,0 +1,50 @@
+
+# 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:/etc/koha/zebradb/authorities/etc:/etc/koha/zebradb/etc:/etc/koha/zebradb/marc_defs/marc21/authorities:/etc/koha/zebradb/lang_defs/en:/etc/koha/zebradb/xsl
+
+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
+# group .recordType[ .name ]: type
+# type is split into fundamental type. file-read-type . argument
+# http://www.indexdata.dk/zebra/doc/zebra-cfg.tkl
+# http://www.indexdata.dk/zebra/doc/grs.tkl
+recordtype: dom./etc/koha/zebradb/authorities/etc/dom-config.xml
+marcxml.recordtype: dom./etc/koha/zebradb/authorities/etc/dom-config.xml
+iso2709.recordtype: dom./etc/koha/zebradb/authorities/etc/dom-config-marc.xml
+
+recordId: (bib1,Local-Number)
+# was auth1
+storeKeys:1
+storeData:1
+
+# Lock File Area
+lockDir: /var/lock/koha/__KOHASITE__/authorities
+perm.anonymous:ar
+perm.kohauser:rw
+register: /var/lib/koha/__KOHASITE__/authorities/register:4G
+shadow: /var/lib/koha/__KOHASITE__/authorities/shadow:1G
+
+# Temp File area for result sets
+setTmpDir: /var/lib/koha/__KOHASITE__/authorities/tmp
+
+# Temp File area for index program
+keyTmpDir: /var/lib/koha/__KOHASITE__/authorities/key
+
+# Approx. Memory usage during indexing
+memMax: 50M
+rank:rank-1
+
diff --git a/debian/templates/zebra-authorities-site.cfg.in b/debian/templates/zebra-authorities-site.cfg.in
new file mode 100644
index 0000000000..301e5e6f9b
--- /dev/null
+++ b/debian/templates/zebra-authorities-site.cfg.in
@@ -0,0 +1,61 @@
+
+# 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:/etc/koha/zebradb/authorities/etc:/etc/koha/zebradb/etc:/etc/koha/zebradb/marc_defs/marc21/authorities:/etc/koha/zebradb/lang_defs/en
+
+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
+# group .recordType[ .name ]: type
+# type is split into fundamental type. file-read-type . argument
+# http://www.indexdata.dk/zebra/doc/zebra-cfg.tkl
+# http://www.indexdata.dk/zebra/doc/grs.tkl
+
+# Can use -g iso2709 to batch index raw iso2709 records in a single or
+# multiple files, or marcxml records that are split into separate files
+# the trailing .record tells zebraidx to use record.abs
+iso2709.recordType:grs.marcxml.record
+
+# Can use -g marcxml to batch index marcxml files
+# zebraidx uses record.abs because of is the root element
+marcxml.recordType:grs.sgml
+
+# Koha uses grs.xml internally when updating a single record, no idea
+# why it knows to use record.abs
+recordType:grs.xml
+
+recordId: (bib1,Local-Number)
+# was auth1
+storeKeys:1
+storeData:1
+
+# Lock File Area
+lockDir: /var/lock/koha/__KOHASITE__/authorities
+perm.anonymous:ar
+perm.kohauser:rw
+passwd: /etc/koha/sites/__KOHASITE__/zebra.passwd
+register: /var/lib/koha/__KOHASITE__/biblios/register:4G
+shadow: /var/lib/koha/__KOHASITE__/biblios/shadow:1G
+
+# Temp File area for result sets
+setTmpDir: /var/lib/koha/__KOHASITE__/authorities/tmp
+
+# Temp File area for index program
+keyTmpDir: /var/lib/koha/__KOHASITE__/authorities/key
+
+# Approx. Memory usage during indexing
+memMax: 50M
+rank:rank-1
+
diff --git a/debian/templates/zebra-biblios-site.cfg.in b/debian/templates/zebra-biblios-site.cfg.in
new file mode 100644
index 0000000000..5402f37b9d
--- /dev/null
+++ b/debian/templates/zebra-biblios-site.cfg.in
@@ -0,0 +1,59 @@
+# 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:/etc/koha/zebradb/biblios/etc:/etc/koha/zebradb/etc:/etc/koha/zebradb/marc_defs/marc21/biblios:/etc/koha/zebradb/lang_defs/en
+# 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
+# group .recordType[ .name ]: type
+# type is split into fundamental type. file-read-type . argument
+# http://www.indexdata.dk/zebra/doc/zebra-cfg.tkl
+# http://www.indexdata.dk/zebra/doc/grs.tkl
+
+# Can use -g iso2709 to batch index raw iso2709 records in a single or
+# multiple files, or marcxml records that are split into separate files
+# the trailing .record tells zebraidx to use record.abs
+iso2709.recordType:grs.marcxml.record
+
+# Can use -g marcxml to batch index marcxml files
+# zebraidx uses record.abs because of is the root element
+marcxml.recordType:grs.sgml
+
+# Koha uses grs.xml internally when updating a single record, no idea
+# why it knows to use record.abs
+recordType:grs.xml
+
+recordId: (bib1,Local-number)
+storeKeys:1
+storeData:1
+
+
+# Lock File Area
+lockDir: /var/lock/koha/__KOHASITE__/biblios
+perm.anonymous:ar
+perm.kohauser:rw
+passwd: /etc/koha/sites/__KOHASITE__/zebra.passwd
+register: /var/lib/koha/__KOHASITE__/biblios/register:4G
+shadow: /var/lib/koha/__KOHASITE__/biblios/shadow:4G
+
+# Temp File area for result sets
+setTmpDir: /var/lib/koha/__KOHASITE__/biblios/tmp
+
+# Temp File area for index program
+keyTmpDir: /var/lib/koha/__KOHASITE__/biblios/key
+
+# Approx. Memory usage during indexing
+memMax: 50M
+rank:rank-1
+truncmax: 1000000000