This patch adds two parameters to the koha-create command: --enable-sru: makes the koha-create script enabled the SRU server for the created instance
--sru-port: lets the user specify a desired port for the SRU server to listen at. It defaults to 7090 To test: - Apply the patch on top of master - Build your own package and install / can be tested just using the koha-create command on a 3.16+ packages install - Create an instance as usual (i.e. without --enable-sru and --sru-port) => SUCCESS: The instance is created, the publicserver sections are both commented out. The first publicserver section has 7090 set as the listening port. - Create an instance as usual, passing --sru-port 456 => SUCCESS: The instance is created, the port is set but the publicserver sections are commented out - Create an instance with --enable-sru (with and without --sru-port) => SUCCESS: Verify the instance is created as expected, with the SRU server enabled (port 7090 if no --sru-port passed, the one we chose otherwise). - Verify that the docs also talk about this new parameters addition. - Sign off :-D Regards To+ Sponsored-by: Universidad Nacional de Cordoba --- debian/docs/koha-create.xml | 16 ++++++++++++++++ debian/scripts/koha-create | 34 +++++++++++++++++++++++++++++++++- debian/templates/koha-conf-site.xml.in | 12 ++++++------ 3 files changed, 55 insertions(+), 7 deletions(-) diff --git a/debian/docs/koha-create.xml b/debian/docs/koha-create.xml index 7fb7956..17b0671 100644 --- a/debian/docs/koha-create.xml +++ b/debian/docs/koha-create.xml @@ -37,6 +37,8 @@ <arg><option>--passwdfile</option> /path/to/passwd</arg> <arg><option>--database</option> database</arg> <arg><option>--adminuser</option> n</arg> + <arg><option>--enable-sru</option></arg> + <arg><option>--sru-port</option> port</arg> <arg><option>--help</option>|<option>-h</option></arg> <arg choice="req" rep="norepeat"><replaceable>instancename</replaceable></arg> @@ -152,6 +154,20 @@ </varlistentry> <varlistentry> + <term><option>--enable-sru</option></term> + <listitem> + <para>Enable the SRU server for the created instance.</para> + </listitem> + </varlistentry> + + <varlistentry> + <term><option>--sru-port</option></term> + <listitem> + <para>Specifiy a <option> TCP port number</option> for the SRU server to listen on.</para> + </listitem> + </varlistentry> + + <varlistentry> <term><option>--help</option>,<option>-h</option></term> <listitem> <para>Print usage information.</para> diff --git a/debian/scripts/koha-create b/debian/scripts/koha-create index 6891ac1..b137645 100755 --- a/debian/scripts/koha-create +++ b/debian/scripts/koha-create @@ -60,6 +60,9 @@ Options: --use-memcached Set the instance to make use of memcache. --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 SRU server (default: disabled). + --sru-port Specifiy a TCP port number for the 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. --passwdfile passwd Specify an alternate passwd file. @@ -87,6 +90,9 @@ generate_config_file() { -e "s/__ZEBRA_PASS__/$zebrapwd/g" \ -e "s/__ZEBRA_MARC_FORMAT__/$ZEBRA_MARC_FORMAT/g" \ -e "s/__ZEBRA_LANGUAGE__/$ZEBRA_LANGUAGE/g" \ + -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" \ @@ -280,6 +286,17 @@ set_memcached() } +enable_sru_server() +{ + # remove the commenting symbols + START_SRU_PUBLICSERVER="" + END_SRU_PUBLICSERVER="" + if [ "$SRU_SERVER_PORT" = "" ]; then + # --sru-port not passed, use the default + SRU_SERVER_PORT=$DEFAULT_SRU_SERVER_PORT + fi +} + # Set defaults and read config file, if it exists. DOMAIN="" OPACPORT="80" @@ -302,6 +319,14 @@ MEMCACHED_PREFIX="" DEFAULT_MEMCACHED_SERVERS="127.0.0.1:11211" DEFAULT_MEMCACHED_PREFIX="koha_" +# SRU server variables +ENABLE_SRU="no" +SRU_SERVER_PORT="" +# hardcoded default SRU server port +DEFAULT_SRU_SERVER_PORT="7090" +START_SRU_PUBLICSERVER="<!--" +END_SRU_PUBLICSERVER="-->" + # Indexing mode variables (default is DOM) BIBLIOS_INDEXING_MODE="dom" AUTHORITIES_INDEXING_MODE="dom" @@ -318,7 +343,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,use-memcached,help,marcflavor:,auth-idx:,biblio-idx:,zebralang:,defaultsql:,configfile:,passwdfile:,database:,adminuser:,memcached-servers:,memcached-prefix:, \ +TEMP=`getopt -o chrpm:l:d:f:b:a: -l create-db,request-db,populate-db,use-db,use-memcached,enable-sru,sru-port:,help,marcflavor:,auth-idx:,biblio-idx:,zebralang:,defaultsql:,configfile:,passwdfile:,database:,adminuser:,memcached-servers:,memcached-prefix:, \ -n "$0" -- "$@"` # Note the quotes around `$TEMP': they are essential! @@ -369,6 +394,10 @@ while true ; do CLO_DATABASE="$2" ; shift 2 ;; -a|--adminuser) CLO_ADMINUSER="$2" ; shift 2 ;; + --enable-sru) + ENABLE_SRU="yes" ; shift ;; + --sru-port) + SRU_SERVER_PORT="$2" ; shift 2 ;; -h|--help) usage ; exit 0 ;; --) @@ -417,6 +446,9 @@ fi set_biblios_indexing_mode $BIBLIOS_INDEXING_MODE $ZEBRA_MARC_FORMAT +if [ "$ENABLE_SRU" != "no" ]; then + enable_sru_server +fi if [ "$CLO_AUTHORITIES_INDEXING_MODE" != "" ]; then AUTHORITIES_INDEXING_MODE=$CLO_AUTHORITIES_INDEXING_MODE diff --git a/debian/templates/koha-conf-site.xml.in b/debian/templates/koha-conf-site.xml.in index 371b1d2..f1c5b2d 100644 --- a/debian/templates/koha-conf-site.xml.in +++ b/debian/templates/koha-conf-site.xml.in @@ -6,9 +6,9 @@ <!-- Uncomment the following entry if you want to run the public Z39.50 server. Also uncomment the <server> and <serverinfo> sections for id 'publicserver' under PUBLICSERVER'S BIBLIOGRAPHIC RECORDS title--> -<!-- -<listen id="publicserver" >tcp:@:__ZEBRA_SRU_BIBLIOS_PORT__</listen> ---> +__START_SRU_PUBLICSERVER__ +<listen id="publicserver" >tcp:@:__SRU_BIBLIOS_PORT__</listen> +__END_SRU_PUBLICSERVER__ <!-- Settings for special biblio server instance for PazPar2. Because PazPar2 only connects to a Z39.50 server using TCP/IP, @@ -171,8 +171,8 @@ </serverinfo> <!-- PUBLICSERVER'S BIBLIOGRAPHIC RECORDS --> -<!-- This can be used to set up a public Z39.50/SRU server. - +<!-- This can be used to set up a public Z39.50/SRU server. --> +__START_SRU_PUBLICSERVER__ <server id="publicserver" listenref="publicserver"> <directory>/var/lib/koha/__KOHASITE__/biblios</directory> <config>/etc/koha/sites/__KOHASITE__/__ZEBRA_BIBLIOS_CFG__</config> @@ -245,7 +245,7 @@ <user>kohauser</user> <password>__ZEBRA_PASS__</password> </serverinfo> ---> +__END_SRU_PUBLICSERVER__ <config> <db_scheme>mysql</db_scheme> -- 1.9.1 _______________________________________________ Koha-patches mailing list Koha-patches@lists.koha-community.org http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-patches website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/