--marcflavor flavor Set the MARC flavor. Valid values are marc21 (default),
normarc and unimarc.
--zebralang lang Choose the primary language for Zebra indexing. Valid
- values are cs, en (default), es, fr, gr, nb, ru and uk.
- --auth-idx idx_mode Set the indexing mode for authority records. Valid
- values are dom (default) and grs1.
- --biblio-idx idx_mode Set the indexing mode for bibliographic records.
- Valid values are dom (default) and grs1.
+ values are cs, el, en (default), es, fr, nb, ru and uk.
+ --elasticsearch-server s Enforce the use of the specified Elasticsearch server(s)
+ (default: localhost:9200).
--memcached-servers str Set a comma-separated list of host:port memcached servers.
--memcached-prefix str Set the desired prefix for the instance memcached namespace.
- --enable-sru Enable the Z39.50/SRU server (default: disabled).
- --sru-port Specifiy a TCP port number for the Z39.50/SRU server
+ --enable-sru Enable the Z39.50/SRU server in Zebra search engine
+ (default: disabled).
+ --sru-port Specify a TCP port number for Zebra's Z39.50/SRU server
to listen on. (default: 7090).
--defaultsql some.sql Specify a default SQL file to be loaded on the DB.
--configfile cfg_file Specify an alternate config file for reading default values.
-e "s/__SRU_BIBLIOS_PORT__/$SRU_SERVER_PORT/g" \
-e "s/__START_SRU_PUBLICSERVER__/$START_SRU_PUBLICSERVER/g" \
-e "s/__END_SRU_PUBLICSERVER__/$END_SRU_PUBLICSERVER/g" \
- -e "s/__ZEBRA_BIBLIOS_CFG__/$ZEBRA_BIBLIOS_CFG/g" \
- -e "s/__ZEBRA_AUTHORITIES_CFG__/$ZEBRA_AUTHORITIES_CFG/g" \
- -e "s/__START_BIBLIOS_RETRIEVAL_INFO__/`echo $START_BIBLIOS_RETRIEVAL_INFO`/g" \
- -e "s/__END_BIBLIOS_RETRIEVAL_INFO__/`echo $END_BIBLIOS_RETRIEVAL_INFO`/g" \
- -e "s/__START_AUTHORITIES_RETRIEVAL_INFO__/`echo $START_AUTHORITIES_RETRIEVAL_INFO`/g" \
- -e "s/__END_AUTHORITIES_RETRIEVAL_INFO__/`echo $END_AUTHORITIES_RETRIEVAL_INFO`/g" \
-e "s/__API_SECRET__/$API_SECRET/g" \
-e "s/__DB_NAME__/$mysqldb/g" \
-e "s/__DB_HOST__/$mysqlhost/g" \
-e "s/__DB_USER__/$mysqluser/g" \
-e "s/__DB_PASS__/$mysqlpwd/g" \
+ -e "s/__ELASTICSEARCH_SERVER__/${ELASTICSEARCH_SERVER}/g" \
-e "s/__UNIXUSER__/$username/g" \
-e "s/__UNIXGROUP__/$username/g" \
-e "s#__TEMPLATE_CACHE_DIR__#$TEMPLATE_CACHE_DIR#g" \
{
# Check that mpm_itk is installed and enabled
- if ! /usr/sbin/apachectl -M 2> /dev/null | grep -q 'mpm_itk'; then
+ if ! /usr/sbin/apachectl -M | grep -q 'mpm_itk'; then
# Check Apache version
APACHE_DISABLE_MPM_MSG=""
if /usr/sbin/apache2ctl -v | grep -q "Server version: Apache/2.4"; then
# mpm_event or mpm_worker need to be disabled first. mpm_itk depends
# on mpm_prefork, which is enabled if needed. See
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=734865
- if /usr/sbin/apachectl -M 2> /dev/null | grep -q 'mpm_event'; then
+ if /usr/sbin/apachectl -M | grep -q 'mpm_event'; then
APACHE_DISABLE_MPM_MSG=" sudo a2dismod mpm_event ;"
- elif /usr/sbin/apachectl -M 2> /dev/null | grep -q 'mpm_worker'; then
+ elif /usr/sbin/apachectl -M | grep -q 'mpm_worker'; then
APACHE_DISABLE_MPM_MSG=" sudo a2dismod mpm_worker ;"
# else mpm_prefork: a2enmod mpm_itk works
fi
fi
# Check that mod_rewrite is installed and enabled.
- if ! /usr/sbin/apachectl -M 2> /dev/null | grep -q 'rewrite_module'; then
+ if ! /usr/sbin/apachectl -M | grep -q 'rewrite_module'; then
cat 1>&2 <<EOM
Koha requires mod_rewrite to be enabled within Apache in order to run.
# Check that the CGI module is installed and enabled
# (Apache 2.4 may not have it by default.)
- if ! /usr/sbin/apachectl -M 2> /dev/null | grep -q 'cgi_module'; then
+ if ! /usr/sbin/apachectl -M | grep -q 'cgi_module'; then
cat 1>&2 << EOM
Koha requires mod_cgi to be enabled within Apache in order to run.
Typically this can be enabled with:
# Check that mod_ssl is installed and enabled.
if [ "$CLO_LETSENCRYPT" = "yes" ]; then
- if ! /usr/sbin/apachectl -M 2> /dev/null | grep -q 'ssl_module'; then
+ if ! /usr/sbin/apachectl -M | grep -q 'ssl_module'; then
cat 1>&2 <<EOM
Koha requires mod_ssl to be enabled within Apache in order to run with --letsencrypt.
}
-set_biblios_indexing_mode()
-{
- local marc_format=$1
-
- START_BIBLIOS_RETRIEVAL_INFO=`cat <<EOF
- <xi:include href="\/etc\/koha\/$marc_format-retrieval-info-bib-dom.xml"\n
- xmlns:xi="http:\/\/www.w3.org\/2001\/XInclude">\n
- <xi:fallback>\n
- <retrievalinfo>
-EOF`
-
- END_BIBLIOS_RETRIEVAL_INFO=`cat <<EOF
- <\/retrievalinfo>\n
- <\/xi:fallback>\n
- <\/xi:include>
-EOF`
- ZEBRA_BIBLIOS_CFG="zebra-biblios-dom.cfg"
-}
-
-
-set_authorities_indexing_mode()
-{
- local marc_format=$1
-
- START_AUTHORITIES_RETRIEVAL_INFO=`cat <<EOF
- <xi:include href="\/etc\/koha\/$marc_format-retrieval-info-auth-dom.xml"\n
- xmlns:xi="http:\/\/www.w3.org\/2001\/XInclude">\n
- <xi:fallback>\n
- <retrievalinfo>
-EOF`
-
- END_AUTHORITIES_RETRIEVAL_INFO=`cat <<EOF
- <\/retrievalinfo>\n
- <\/xi:fallback>\n
- <\/xi:include>\n
-EOF`
- ZEBRA_AUTHORITIES_CFG="zebra-authorities-dom.cfg"
-}
-
-
set_memcached()
{
local instance="$1"
USE_MEMCACHED="yes"
MEMCACHED_SERVERS=""
MEMCACHED_PREFIX=""
+# elasticsearch config
+ELASTICSEARCH_SERVER="localhost:9200"
# hardcoded memcached defaults
DEFAULT_MEMCACHED_SERVERS="127.0.0.1:11211"
DEFAULT_MEMCACHED_PREFIX="koha_"
START_SRU_PUBLICSERVER="<!--"
END_SRU_PUBLICSERVER="-->"
-START_BIBLIOS_RETRIEVAL_INFO=""
-END_BIBLIOS_RETRIEVAL_INFO=""
-START_AUTHORITIES_RETRIEVAL_INFO=""
-END_AUTHORITIES_RETRIEVAL_INFO=""
-
APACHE_CONFIGFILE=""
if [ -e /etc/koha/koha-sites.conf ]
[ $# -ge 1 ] && [ $# -le 16 ] || ( usage ; die "Error: wrong parameters" )
-TEMP=`getopt -o chrpm:l:d:f:b:a: -l create-db,request-db,populate-db,use-db,enable-sru,sru-port:,help,marcflavor:,auth-idx:,biblio-idx:,zebralang:,defaultsql:,configfile:,passwdfile:,dbhost:,database:,adminuser:,memcached-servers:,memcached-prefix:,template-cache-dir:,timezone:,upload-path:,tmp-path:,letsencrypt, \
+TEMP=`getopt -o chrpm:l:d:f:b:a: -l create-db,request-db,populate-db,use-db,enable-sru,sru-port:,help,marcflavor:,auth-idx:,biblio-idx:,zebralang:,defaultsql:,configfile:,passwdfile:,dbhost:,database:,elasticsearch-server:,adminuser:,memcached-servers:,memcached-prefix:,template-cache-dir:,timezone:,upload-path:,tmp-path:,letsencrypt, \
-n "$0" -- "$@"`
# Note the quotes around `$TEMP': they are essential!
CLO_ADMINUSER=""
CLO_MEMCACHED_SERVERS=""
CLO_MEMCACHED_PREFIX=""
+CLO_ELASTICSEARCH_SERVER=""
CLO_UPLOAD_PATH=""
CLO_TMP_PATH=""
CLO_LETSENCRYPT=""
CLO_MEMCACHED_SERVERS="$2" ; shift 2 ;;
--memcached-prefix)
CLO_MEMCACHED_PREFIX="$2" ; shift 2;;
+ --elasticsearch-server)
+ CLO_ELASTICSEARCH_SERVER="$2" ; shift 2 ;;
-m|--marcflavor)
CLO_ZEBRA_MARC_FORMAT="$2" ; shift 2 ;;
-l|--zebralang)
TIMEZONE=$CLO_TIMEZONE
fi
-if [ "$CLO_BIBLIOS_INDEXING_MODE" != "" ]; then
- BIBLIOS_INDEXING_MODE=$CLO_BIBLIOS_INDEXING_MODE
+if [ "${CLO_ELASTICSEARCH_SERVER}" != "" ]; then
+ ELASTICSEARCH_SERVER="${CLO_ELASTICSEARCH_SERVER}"
fi
-set_biblios_indexing_mode $ZEBRA_MARC_FORMAT
-
if [ "$ENABLE_SRU" != "no" ]; then
enable_sru_server
fi
-set_authorities_indexing_mode $ZEBRA_MARC_FORMAT
-
[ $# -ge 1 ] || ( usage ; die "Missing instance name..." )
name="$1"
die;
fi
-set_memcached $name
+if [ "$USE_MEMCACHED" = "no" ]; then
+ MEMCACHED_SERVERS=""
+ MEMCACHED_NAMESPACE=""
+ MEMCACHED_PREFIX=""
+else
+ set_memcached $name
+fi
# Set template cache dir
if [ "$CLO_TEMPLATE_CACHE_DIR" != "" ]; then
then
if [ "$mysqlpwd" = "" ]
then
- mysqlpwd="$(pwgen -s 16 1)"
+ mysqlpwd="$(pwgen -s 15 1)"
+ mysqlpwd="$mysqlpwd@"
fi
else
mysqlpwd="$(getinstancemysqlpassword $name)"
mysql $MYSQL_OPTIONS <<eof
CREATE DATABASE \`$mysqldb\`;
CREATE USER \`$mysqluser\`@'$mysql_hostname' IDENTIFIED BY '$mysqlpwd';
-CREATE USER \`$mysqluser\`@'%' IDENTIFIED BY '$mysqlpwd';
-GRANT ALL PRIVILEGES ON \`$mysqldb\`.* TO \`$mysqluser\`;
GRANT ALL PRIVILEGES ON \`$mysqldb\`.* TO \`$mysqluser\`@'$mysql_hostname';
FLUSH PRIVILEGES;
eof
if [ -e "$DEFAULTSQL" ]
then
# Populate the database with default content.
- zcat "$DEFAULTSQL" |
+ zcat -f "$DEFAULTSQL" |
sed "s/__KOHASITE__/koha_$name/g" |
mysql --host="$mysqlhost" --user="$mysqluser" --password="$mysqlpwd" "$mysqldb"
# Get letsencrypt certificates
letsencrypt_instance
fi
+
+ chown $username:$username /var/log/koha/$name/*.log
fi