X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=debian%2Fscripts%2Fkoha-create;h=b90e7d4e236ae54870ed1fe7c599a9a1f334cc6d;hb=7b1e8c59fe0edc2faab878c6bd9d45de9f720e81;hp=e0fd5cdd779eea586da72c49a4d3f42ca6c3a6e8;hpb=64be74b3380441b645ec808e0c30455e76b326e1;p=koha-ffzg.git diff --git a/debian/scripts/koha-create b/debian/scripts/koha-create index e0fd5cdd77..b90e7d4e23 100755 --- a/debian/scripts/koha-create +++ b/debian/scripts/koha-create @@ -52,15 +52,14 @@ Options: --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. @@ -71,8 +70,11 @@ Options: conjunction with --defaultsql and --populate-db. --template-cache-dir Set a user defined template_cache_dir. It defaults to /var/cache/koha//templates + --timezone time/zone Specify a timezone. e.g. America/Argentina --upload-path dir Set a user defined upload_path. It defaults to /var/lib/koha//uploads + --tmp-path dir Set a user defined tmp_path. It defaults to + /var/lib/koha//tmp --letsencrypt Set up a https-only site with letsencrypt certificates --help,-h Show this help. @@ -99,23 +101,18 @@ generate_config_file() { -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/__BIBLIOS_INDEXING_MODE__/$BIBLIOS_INDEXING_MODE/g" \ - -e "s/__AUTHORITIES_INDEXING_MODE__/$AUTHORITIES_INDEXING_MODE/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" \ + -e "s#__TIMEZONE__#$TIMEZONE#g" \ -e "s#__UPLOAD_PATH__#$UPLOAD_PATH#g" \ + -e "s#__TMP_PATH__#$TMP_PATH#g" \ -e "s/__LOG_DIR__/\/var\/log\/koha\/$name/g" \ -e "s/__PLUGINS_DIR__/\/var\/lib\/koha\/$name\/plugins/g" \ -e "s/__MEMCACHED_NAMESPACE__/$MEMCACHED_NAMESPACE/g" \ @@ -154,16 +151,16 @@ check_apache_config() { # 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 @@ -182,7 +179,7 @@ EOM 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 < /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: @@ -207,7 +204,7 @@ EOM # 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 <\n - \n - -EOF` - - END_BIBLIOS_RETRIEVAL_INFO=`cat <\n - <\/xi:fallback>\n - <\/xi:include> -EOF` - BIBLIOS_INDEXING_MODE="dom" - ZEBRA_BIBLIOS_CFG="zebra-biblios-dom.cfg" - ;; - "grs1") - START_BIBLIOS_RETRIEVAL_INFO=" " - END_BIBLIOS_RETRIEVAL_INFO=" <\/retrievalinfo>" - BIBLIOS_INDEXING_MODE="grs1" - ZEBRA_BIBLIOS_CFG="zebra-biblios.cfg" - ;; - *) - die "Error: '$indexing_mode' is not a valid indexing mode for bibliographic records." - ;; - esac -} - - -set_authorities_indexing_mode() -{ - local indexing_mode=$1 - local marc_format=$2 - - case $indexing_mode in - "dom") - START_AUTHORITIES_RETRIEVAL_INFO=`cat <\n - \n - -EOF` - - END_AUTHORITIES_RETRIEVAL_INFO=`cat <\n - <\/xi:fallback>\n - <\/xi:include>\n -EOF` - AUTHORITIES_INDEXING_MODE="dom" - ZEBRA_AUTHORITIES_CFG="zebra-authorities-dom.cfg" - ;; - "grs1") - START_AUTHORITIES_RETRIEVAL_INFO=" " - END_AUTHORITIES_RETRIEVAL_INFO=" <\/retrievalinfo>" - AUTHORITIES_INDEXING_MODE="grs1" - ZEBRA_AUTHORITIES_CFG="zebra-authorities.cfg" - ;; - *) - die "Error: '$indexing_mode' is not a valid indexing mode for authority records." - ;; - esac -} - - set_memcached() { local instance="$1" @@ -323,7 +250,18 @@ set_upload_path() if [ "$CLO_UPLOAD_PATH" != "" ]; then UPLOAD_PATH=$CLO_UPLOAD_PATH else - UPLOAD_PATH="$UPLOAD_PATH_BASE/$instance/$UPLOAD_DIR" + UPLOAD_PATH="$INSTANCE_PATH_BASE/$instance/$UPLOAD_DIR" + fi +} + +set_tmp_path() +{ + local instance="$1" + + if [ "$CLO_TMP_PATH" != "" ]; then + TMP_PATH=$CLO_TMP_PATH + else + TMP_PATH="$INSTANCE_PATH_BASE/$instance/$TMP_DIR" fi } @@ -406,13 +344,20 @@ PASSWDFILE="/etc/koha/passwd" 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_" -# hardcoded upload_path -UPLOAD_PATH_BASE="/var/lib/koha" +# hardcoded instance base path +INSTANCE_PATH_BASE="/var/lib/koha" UPLOAD_DIR="uploads" UPLOAD_PATH="" +# timezone defaults to empty +TIMEZONE="" +# hardcoded upload_tmp_path +TMP_DIR="tmp" +TMP_PATH="" # cache base dir CACHE_DIR_BASE="/var/cache/koha" # Generate a randomizaed API secret @@ -425,15 +370,6 @@ DEFAULT_SRU_SERVER_PORT="7090" START_SRU_PUBLICSERVER="" -# Indexing mode variables (default is DOM) -BIBLIOS_INDEXING_MODE="dom" -AUTHORITIES_INDEXING_MODE="dom" - -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 ] @@ -443,7 +379,7 @@ fi [ $# -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:,upload-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! @@ -454,13 +390,14 @@ CLO_ZEBRA_MARC_FORMAT="" CLO_ZEBRA_LANGUAGE="" CLO_DEFAULTSQL="" CLO_ADMINUSER="" -CLO_BIBLIOS_INDEXING_MODE="" -CLO_AUTHORITIES_INDEXING_MODE="" CLO_MEMCACHED_SERVERS="" CLO_MEMCACHED_PREFIX="" +CLO_ELASTICSEARCH_SERVER="" CLO_UPLOAD_PATH="" +CLO_TMP_PATH="" CLO_LETSENCRYPT="" CLO_TEMPLATE_CACHE_DIR="" +CLO_TIMEZONE="" while true ; do case "$1" in @@ -476,14 +413,12 @@ while true ; do 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) CLO_ZEBRA_LANGUAGE="$2" ; shift 2 ;; - --auth-idx) - CLO_AUTHORITIES_INDEXING_MODE="$2" ; shift 2 ;; - --biblio-idx) - CLO_BIBLIOS_INDEXING_MODE="$2" ; shift 2 ;; -d|--defaultsql) CLO_DEFAULTSQL="$2" ; shift 2 ;; -f|--configfile) @@ -502,8 +437,12 @@ while true ; do SRU_SERVER_PORT="$2" ; shift 2 ;; --template-cache-dir) CLO_TEMPLATE_CACHE_DIR="$2" ; shift 2 ;; + --timezone) + CLO_TIMEZONE="$2" ; shift 2 ;; --upload-path) CLO_UPLOAD_PATH="$2" ; shift 2 ;; + --tmp-path) + CLO_TMP_PATH="$2" ; shift 2 ;; --letsencrypt) CLO_LETSENCRYPT="yes" ; shift ;; -h|--help) @@ -548,27 +487,24 @@ then PASSWDFILE="$CLO_PASSWDFILE" fi -if [ "$CLO_BIBLIOS_INDEXING_MODE" != "" ]; then - BIBLIOS_INDEXING_MODE=$CLO_BIBLIOS_INDEXING_MODE +if [ "$CLO_TIMEZONE" != "" ]; then + TIMEZONE=$CLO_TIMEZONE fi -set_biblios_indexing_mode $BIBLIOS_INDEXING_MODE $ZEBRA_MARC_FORMAT +if [ "${CLO_ELASTICSEARCH_SERVER}" != "" ]; then + ELASTICSEARCH_SERVER="${CLO_ELASTICSEARCH_SERVER}" +fi if [ "$ENABLE_SRU" != "no" ]; then enable_sru_server fi -if [ "$CLO_AUTHORITIES_INDEXING_MODE" != "" ]; then - AUTHORITIES_INDEXING_MODE=$CLO_AUTHORITIES_INDEXING_MODE -fi - -set_authorities_indexing_mode $AUTHORITIES_INDEXING_MODE $ZEBRA_MARC_FORMAT - [ $# -ge 1 ] || ( usage ; die "Missing instance name..." ) name="$1" set_upload_path $name +set_tmp_path $name if [ "$op" = use ] && [ "$CLO_DATABASE" = "" ] && ( [ ! -f "$PASSWDFILE" ] || [ ! `cat $PASSWDFILE | grep "^$name:"` ] ) @@ -583,7 +519,13 @@ NO_DB 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 @@ -650,7 +592,8 @@ if [ "$op" = create ] || [ "$op" = request ] || [ "$op" = use ] then if [ "$mysqlpwd" = "" ] then - mysqlpwd="$(pwgen -s 16 1)" + mysqlpwd="$(pwgen -s 15 1)" + mysqlpwd="$mysqlpwd@" fi else mysqlpwd="$(getinstancemysqlpassword $name)" @@ -694,8 +637,6 @@ then mysql $MYSQL_OPTIONS <