Bugzilla – Attachment 28186 Details for
Bug 11404
add out-of-the-box support for Apache 2.4
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11404: koha-functions.sh introduced for reuse
Bug-11404-koha-functionssh-introduced-for-reuse.patch (text/plain), 24.68 KB, created by
Robin Sheat
on 2014-05-13 03:06:00 UTC
(
hide
)
Description:
Bug 11404: koha-functions.sh introduced for reuse
Filename:
MIME Type:
Creator:
Robin Sheat
Created:
2014-05-13 03:06:00 UTC
Size:
24.68 KB
patch
obsolete
>From 640fa888217da3ba5074a88a2394820ef0bc8814 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@gmail.com> >Date: Mon, 5 May 2014 11:50:55 -0300 >Subject: [PATCH] Bug 11404: koha-functions.sh introduced for reuse > >As asked by Robin, a bash lib of functions is introduced with the common >functions to be reused. Most of the scripts are modified (reduced) to include >this file and the repeated functions cleaned. > >No noticeable change in behaviour should be noticed. > >As I've been said in #debian-mentors, it is used that files for inclusion >should be installed at the apps directory (i.e. /usr/share/koha/) so this >patch makes the install script put the file in the bin/ directory. > >All koha-* scripts assume the file is there already (and fail otherwise). > >Regards >To+ > >Sponsored-by: Universidad Nacional de Cordoba >Signed-off-by: Robin Sheat <robin@catalyst.net.nz> >--- > debian/scripts/koha-create | 13 +++-- > debian/scripts/koha-disable | 59 ++++++------------- > debian/scripts/koha-dump | 14 ++--- > debian/scripts/koha-email-disable | 39 ++----------- > debian/scripts/koha-email-enable | 39 ++----------- > debian/scripts/koha-enable | 46 ++------------- > debian/scripts/koha-functions.sh | 115 ++++++++++++++++++++++++++++++++++++++ > debian/scripts/koha-list | 52 ++--------------- > debian/scripts/koha-mysql | 9 ++- > debian/scripts/koha-mysqlcheck | 9 ++- > debian/scripts/koha-rebuild-zebra | 28 ++-------- > debian/scripts/koha-remove | 16 ++++-- > debian/scripts/koha-reset-passwd | 11 ++-- > debian/scripts/koha-restart-zebra | 58 ++----------------- > debian/scripts/koha-restore | 11 ++-- > debian/scripts/koha-start-zebra | 105 ++++++++++------------------------ > debian/scripts/koha-stop-zebra | 93 ++++++++---------------------- > debian/scripts/koha-translate | 14 +++-- > 18 files changed, 276 insertions(+), 455 deletions(-) > create mode 100755 debian/scripts/koha-functions.sh > >diff --git a/debian/scripts/koha-create b/debian/scripts/koha-create >index a96cf3e..1556051 100755 >--- a/debian/scripts/koha-create >+++ b/debian/scripts/koha-create >@@ -19,6 +19,14 @@ > > set -e > >+# include helper functions >+if [ -f "/usr/share/koha/bin/koha-functions.sh" ]; then >+ . "/usr/share/koha/bin/koha-functions.sh" >+else >+ echo "Error: /usr/share/koha/bin/koha-functions.sh not present." 1>&2 >+ exit 1 >+fi >+ > usage() > { > local scriptname=$0 >@@ -63,11 +71,6 @@ Note: the instance name cannot be longer that 11 chars. > EOF > } > >-die() { >- echo "$@" 1>&2 >- exit 1 >-} >- > # UPPER CASE VARIABLES - from configfile or default value > # lower case variables - generated within this script > generate_config_file() { >diff --git a/debian/scripts/koha-disable b/debian/scripts/koha-disable >index 91e31b6..762ac13 100755 >--- a/debian/scripts/koha-disable >+++ b/debian/scripts/koha-disable >@@ -19,52 +19,22 @@ > > set -e > >- >-die() >-{ >- echo "$@" 1>&2 >+# include helper functions >+if [ -f "/usr/share/koha/bin/koha-functions.sh" ]; then >+ . "/usr/share/koha/bin/koha-functions.sh" >+else >+ echo "Error: /usr/share/koha/bin/koha-functions.sh not present." 1>&2 > exit 1 >-} >- >-warn() >-{ >- echo "$@" 1>&2 >-} >- >-is_enabled() >-{ >- local instancename=$1 >- local instancefile="/etc/apache2/sites-available/$instancename.conf" >- >- if ! is_instance $instancename; then >- return 1 >- fi >- >- if grep -q '^[[:space:]]*Include /etc/koha/apache-shared-disable.conf' \ >- "$instancefile" ; then >- return 1 >- else >- return 0 >- fi >-} >+fi > >-is_instance() >+disable_instance() > { >- local instancename=$1 >+ local site=$1 >+ local instancefile=$(get_apache_config_for $site) > >- if find /etc/koha/sites -mindepth 1 -maxdepth 1 \ >- -type d -printf '%f\n'\ >- | grep -q -x $instancename ; then >- return 0 >- else >- return 1 >+ if [ "$instancefile" = ""]; then >+ return 2 > fi >-} >- >-disable_instance() >-{ >- local instancename=$1 >- local instancefile="/etc/apache2/sites-available/$instancename.conf" > > if is_enabled $instancename; then > sed -i 's:^\s*#\(\s*Include /etc/koha/apache-shared-disable.conf\)$:\1:' \ >@@ -94,10 +64,13 @@ restart_apache="no" > for name in "$@" > do > if is_instance $name ; then >- if disable_instance $name; then >+ RET=$(disable_instance $name) >+ if [ "$RET" = 0 ]; then > restart_apache="yes" >+ elif [ "$RET" = 2 ]; then >+ warn "Error: Apache configuration file not present for instance $name." > else >- warn "Instance $name already disabled." >+ warn "Warning: instance $name already disabled." > fi > else > warn "Unknown instance $name." >diff --git a/debian/scripts/koha-dump b/debian/scripts/koha-dump >index fb770d4..bf4bd5f 100755 >--- a/debian/scripts/koha-dump >+++ b/debian/scripts/koha-dump >@@ -19,17 +19,17 @@ > > set -e > >+# include helper functions >+if [ -f "/usr/share/koha/bin/koha-functions.sh" ]; then >+ . "/usr/share/koha/bin/koha-functions.sh" >+else >+ echo "Error: /usr/share/koha/bin/koha-functions.sh not present." 1>&2 >+ exit 1 >+fi > > # Make sure the files we create are not accessible by anyone else. > umask 0077 > >- >-die() { >- echo "$@" 1>&2 >- exit 1 >-} >- >- > # Parse command line. > [ "$#" = 1 ] || die "Usage: $0 instancename" > name="$1" >diff --git a/debian/scripts/koha-email-disable b/debian/scripts/koha-email-disable >index 615f4f4..3d3d697 100755 >--- a/debian/scripts/koha-email-disable >+++ b/debian/scripts/koha-email-disable >@@ -18,40 +18,13 @@ > > set -e > >-die() >-{ >- echo "$@" 1>&2 >+# include helper functions >+if [ -f "/usr/share/koha/bin/koha-functions.sh" ]; then >+ . "/usr/share/koha/bin/koha-functions.sh" >+else >+ echo "Error: /usr/share/koha/bin/koha-functions.sh not present." 1>&2 > exit 1 >-} >- >-warn() >-{ >- echo "$@" 1>&2 >-} >- >-is_instance() >-{ >- local instancename=$1 >- >- if find /etc/koha/sites -mindepth 1 -maxdepth 1 \ >- -type d -printf '%f\n'\ >- | grep -q -x $instancename ; then >- return 0 >- else >- return 1 >- fi >-} >- >-is_email_enabled() >-{ >- local instancename=$1 >- >- if [ -e /var/lib/koha/$instancename/email.enabled ]; then >- return 0 >- else >- return 1 >- fi >-} >+fi > > disable_email() > { >diff --git a/debian/scripts/koha-email-enable b/debian/scripts/koha-email-enable >index a130c49..7a941c4 100755 >--- a/debian/scripts/koha-email-enable >+++ b/debian/scripts/koha-email-enable >@@ -18,40 +18,13 @@ > > set -e > >-die() >-{ >- echo "$@" 1>&2 >+# include helper functions >+if [ -f "/usr/share/koha/bin/koha-functions.sh" ]; then >+ . "/usr/share/koha/bin/koha-functions.sh" >+else >+ echo "Error: /usr/share/koha/bin/koha-functions.sh not present." 1>&2 > exit 1 >-} >- >-warn() >-{ >- echo "$@" 1>&2 >-} >- >-is_instance() >-{ >- local instancename=$1 >- >- if find /etc/koha/sites -mindepth 1 -maxdepth 1 \ >- -type d -printf '%f\n'\ >- | grep -q -x $instancename ; then >- return 0 >- else >- return 1 >- fi >-} >- >-is_email_enabled() >-{ >- local instancename=$1 >- >- if [ -e /var/lib/koha/$instancename/email.enabled ]; then >- return 0 >- else >- return 1 >- fi >-} >+fi > > enable_email() > { >diff --git a/debian/scripts/koha-enable b/debian/scripts/koha-enable >index b5f0cd2..67cbc8b 100755 >--- a/debian/scripts/koha-enable >+++ b/debian/scripts/koha-enable >@@ -19,47 +19,13 @@ > > set -e > >- >-die() >-{ >- echo "$@" 1>&2 >+# include helper functions >+if [ -f "/usr/share/koha/bin/koha-functions.sh" ]; then >+ . "/usr/share/koha/bin/koha-functions.sh" >+else >+ echo "Error: /usr/share/koha/bin/koha-functions.sh not present." 1>&2 > exit 1 >-} >- >-warn() >-{ >- echo "$@" 1>&2 >-} >- >-is_enabled() >-{ >- local instancename=$1 >- local instancefile="/etc/apache2/sites-available/$instancename.conf" >- >- if ! is_instance $instancename; then >- return 1 >- fi >- >- if grep -q '^[[:space:]]*Include /etc/koha/apache-shared-disable.conf' \ >- "$instancefile" ; then >- return 1 >- else >- return 0 >- fi >-} >- >-is_instance() >-{ >- local instancename=$1 >- >- if find /etc/koha/sites -mindepth 1 -maxdepth 1 \ >- -type d -printf '%f\n'\ >- | grep -q -x $instancename ; then >- return 0 >- else >- return 1 >- fi >-} >+fi > > enable_instance() > { >diff --git a/debian/scripts/koha-functions.sh b/debian/scripts/koha-functions.sh >new file mode 100755 >index 0000000..d1a3c04 >--- /dev/null >+++ b/debian/scripts/koha-functions.sh >@@ -0,0 +1,115 @@ >+#!/bin/sh >+# >+# koha-functions.sh -- shared library of helper functions for koha-* scripts >+# Copyright 2014 - Tomas Cohen Arazi >+# Universidad Nacional de Cordoba >+# >+# This program 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 3 of the License, or >+# (at your option) any later version. >+# >+# This program 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 this program. If not, see <http://www.gnu.org/licenses/>. >+ >+ >+die() >+{ >+ echo "$@" 1>&2 >+ exit 1 >+} >+ >+warn() >+{ >+ echo "$@" 1>&2 >+} >+ >+get_apache_config_for() >+{ >+ local site=$1 >+ local sitefile="/etc/apache2/sites-available/$site" >+ >+ if is_instance $site; then >+ if [ -f "$sitefile.conf" ]; then >+ echo "$sitefile.conf" >+ elif [ -f "$sitefile" ]; then >+ echo "$sitefile" >+ fi >+ fi >+} >+ >+is_enabled() >+{ >+ local site=$1 >+ local instancefile=$(get_apache_config_for $site) >+ >+ if [ "$instancefile" = "" ]; then >+ return 1 >+ fi >+ >+ if grep -q '^[[:space:]]*Include /etc/koha/apache-shared-disable.conf' \ >+ "$instancefile" ; then >+ return 1 >+ else >+ return 0 >+ fi >+} >+ >+is_instance() >+{ >+ local instancename=$1 >+ >+ if find /etc/koha/sites -mindepth 1 -maxdepth 1 \ >+ -type d -printf '%f\n'\ >+ | grep -q -x "$instancename" ; then >+ return 0 >+ else >+ return 1 >+ fi >+} >+ >+is_email_enabled() >+{ >+ local instancename=$1 >+ >+ if [ -e /var/lib/koha/$instancename/email.enabled ]; then >+ return 0 >+ else >+ return 1 >+ fi >+} >+ >+is_sip_enabled() >+{ >+ local instancename=$1 >+ >+ if [ -e /etc/koha/sites/$instancename/SIPconfig.xml ]; then >+ return 0 >+ else >+ return 1 >+ fi >+} >+ >+is_zebra_running() >+{ >+ local instancename=$1 >+ >+ if daemon --name="$instancename-koha-zebra" \ >+ --user="$instancename-koha.$instancename-koha" \ >+ --running ; then >+ return 0 >+ else >+ return 1 >+ fi >+} >+ >+get_instances() >+{ >+ find /etc/koha/sites -mindepth 1 -maxdepth 1\ >+ -type d -printf '%f\n' | sort >+} >diff --git a/debian/scripts/koha-list b/debian/scripts/koha-list >index ea8ae4b..848494b 100755 >--- a/debian/scripts/koha-list >+++ b/debian/scripts/koha-list >@@ -19,53 +19,13 @@ > > set -e > >-die() >-{ >- echo "$@" 1>&2 >+# include helper functions >+if [ -f "/usr/share/koha/bin/koha-functions.sh" ]; then >+ . "/usr/share/koha/bin/koha-functions.sh" >+else >+ echo "Error: /usr/share/koha/bin/koha-functions.sh not present." 1>&2 > exit 1 >-} >- >-is_enabled() >-{ >- local instancename=$1 >- local instancefile="/etc/apache2/sites-available/$instancename.conf" >- >- if grep '^[[:space:]]*Include /etc/koha/apache-shared-disable.conf' \ >- "$instancefile" > /dev/null >- then >- return 1 >- else >- return 0 >- fi >-} >- >-is_email_enabled() >-{ >- local instancename=$1 >- >- if [ -e /var/lib/koha/$instancename/email.enabled ]; then >- return 0 >- else >- return 1 >- fi >-} >- >-is_sip_enabled() >-{ >- local instancename=$1 >- >- if [ -e /etc/koha/sites/$instancename/SIPconfig.xml ]; then >- return 0 >- else >- return 1 >- fi >-} >- >-get_instances() >-{ >- find /etc/koha/sites -mindepth 1 -maxdepth 1\ >- -type d -printf '%f\n' | sort >-} >+fi > > show_instances() > { >diff --git a/debian/scripts/koha-mysql b/debian/scripts/koha-mysql >index fb3fba9..d1f9576 100755 >--- a/debian/scripts/koha-mysql >+++ b/debian/scripts/koha-mysql >@@ -21,10 +21,13 @@ set -e > > umask 0077 > >-die() { >- echo "$@" 1>&2 >+# include helper functions >+if [ -f "/usr/share/koha/bin/koha-functions.sh" ]; then >+ . "/usr/share/koha/bin/koha-functions.sh" >+else >+ echo "Error: /usr/share/koha/bin/koha-functions.sh not present." 1>&2 > exit 1 >-} >+fi > > [ "$#" = 1 ] || die "Usage: $0 instancename" > name="$1" >diff --git a/debian/scripts/koha-mysqlcheck b/debian/scripts/koha-mysqlcheck >index 5a5286b..d3b8363 100755 >--- a/debian/scripts/koha-mysqlcheck >+++ b/debian/scripts/koha-mysqlcheck >@@ -21,10 +21,13 @@ set -e > > umask 0077 > >-die() { >- echo "$@" 1>&2 >+# include helper functions >+if [ -f "/usr/share/koha/bin/koha-functions.sh" ]; then >+ . "/usr/share/koha/bin/koha-functions.sh" >+else >+ echo "Error: /usr/share/koha/bin/koha-functions.sh not present." 1>&2 > exit 1 >-} >+fi > > # Parse command line. > if [ $# -lt 1 ]; then >diff --git a/debian/scripts/koha-rebuild-zebra b/debian/scripts/koha-rebuild-zebra >index 6464958..f8267c5 100755 >--- a/debian/scripts/koha-rebuild-zebra >+++ b/debian/scripts/koha-rebuild-zebra >@@ -19,29 +19,13 @@ > > set -e > >-die() >-{ >- echo "$@" 1>&2 >+# include helper functions >+if [ -f "/usr/share/koha/bin/koha-functions.sh" ]; then >+ . "/usr/share/koha/bin/koha-functions.sh" >+else >+ echo "Error: /usr/share/koha/bin/koha-functions.sh not present." 1>&2 > exit 1 >-} >- >-warn() >-{ >- echo "$@" 1>&2 >-} >- >-is_instance() >-{ >- local instancename=$1 >- >- if find /etc/koha/sites -mindepth 1 -maxdepth 1 \ >- -type d -printf '%f\n'\ >- | grep -q -x $instancename ; then >- return 0 >- else >- return 1 >- fi >-} >+fi > > toggle_biblios_only() > { >diff --git a/debian/scripts/koha-remove b/debian/scripts/koha-remove >index 40bb3f6..38c6c85 100755 >--- a/debian/scripts/koha-remove >+++ b/debian/scripts/koha-remove >@@ -19,6 +19,14 @@ > > set -e > >+# include helper functions >+if [ -f "/usr/share/koha/bin/koha-functions.sh" ]; then >+ . "/usr/share/koha/bin/koha-functions.sh" >+else >+ echo "Error: /usr/share/koha/bin/koha-functions.sh not present." 1>&2 >+ exit 1 >+fi >+ > args=$(getopt -l keep-mysql -o k -n $0 -- "$@") > eval set -- $args > while [ ! -z "$1" ] >@@ -35,7 +43,7 @@ NAMES="$@" > > SITECONFDIR="/etc/koha/sites" > # There has to be a better way of excluding '.' from find. But this works. >-INSTANCES=`cd $SITECONFDIR && find . -type d -printf " %f" |sed s/\ .\ //` >+INSTANCES=$(get_instances) > > if [ -z $NAMES ] ; then > echo "Please specify a Koha instance name. Your choices are:" >@@ -69,10 +77,10 @@ eof > # If the daemon is not running already, we don't want to fail this loop. So bin the result code if this fails. > koha-stop-zebra $name || /bin/true > >- instancefile="$name.conf" >+ instancefile=$(get_apache_config_for $name) > >- [ -f "/etc/apache2/sites-available/$instancefile" ] && \ >- rm "/etc/apache2/sites-available/$instancefile" >+ [ -f "$instancefile" ] && \ >+ rm "$instancefile" > [ -f "/etc/koha/sites/$name/koha-conf.xml" ] && \ > rm "/etc/koha/sites/$name/koha-conf.xml" > [ -f "/etc/koha/sites/$name/zebra-biblios.cfg" ] && \ >diff --git a/debian/scripts/koha-reset-passwd b/debian/scripts/koha-reset-passwd >index fd4a60e..317e2bc 100755 >--- a/debian/scripts/koha-reset-passwd >+++ b/debian/scripts/koha-reset-passwd >@@ -19,12 +19,13 @@ > > set -e > >- >-die() { >- echo "$@" 1>&2 >+# include helper functions >+if [ -f "/usr/share/koha/bin/koha-functions.sh" ]; then >+ . "/usr/share/koha/bin/koha-functions.sh" >+else >+ echo "Error: /usr/share/koha/bin/koha-functions.sh not present." 1>&2 > exit 1 >-} >- >+fi > > pwdigest() { > echo -n "$1" | >diff --git a/debian/scripts/koha-restart-zebra b/debian/scripts/koha-restart-zebra >index 8b4b681..1c8ace9 100755 >--- a/debian/scripts/koha-restart-zebra >+++ b/debian/scripts/koha-restart-zebra >@@ -18,59 +18,13 @@ > > set -e > >-die() >-{ >- echo "$@" 1>&2 >+# include helper functions >+if [ -f "/usr/share/koha/bin/koha-functions.sh" ]; then >+ . "/usr/share/koha/bin/koha-functions.sh" >+else >+ echo "Error: /usr/share/koha/bin/koha-functions.sh not present." 1>&2 > exit 1 >-} >- >-warn() >-{ >- echo "$@" 1>&2 >-} >- >-is_enabled() >-{ >- local instancename=$1 >- local instancefile="/etc/apache2/sites-available/$instancename.conf" >- >- if ! is_instance $instancename; then >- return 1 >- fi >- >- if grep -q '^[[:space:]]*Include /etc/koha/apache-shared-disable.conf' \ >- "$instancefile" ; then >- return 1 >- else >- return 0 >- fi >-} >- >-is_instance() >-{ >- local instancename=$1 >- >- if find /etc/koha/sites -mindepth 1 -maxdepth 1 \ >- -type d -printf '%f\n'\ >- | grep -q -x $instancename ; then >- return 0 >- else >- return 1 >- fi >-} >- >-is_zebra_running() >-{ >- local instancename=$1 >- >- if daemon --name="$instancename-koha-zebra" \ >- --user="$instancename-koha.$instancename-koha" \ >- --running ; then >- return 0 >- else >- return 1 >- fi >-} >+fi > > restart_zebra_instance() > { >diff --git a/debian/scripts/koha-restore b/debian/scripts/koha-restore >index caf4c7d..e8ec053 100755 >--- a/debian/scripts/koha-restore >+++ b/debian/scripts/koha-restore >@@ -19,12 +19,13 @@ > > set -e > >- >-die() { >- echo "$@" 1>&2 >+# include helper functions >+if [ -f "/usr/share/koha/bin/koha-functions.sh" ]; then >+ . "/usr/share/koha/bin/koha-functions.sh" >+else >+ echo "Error: /usr/share/koha/bin/koha-functions.sh not present." 1>&2 > exit 1 >-} >- >+fi > > # Parse command line. > [ "$#" = 2 ] || die "Usage: $0 sqldump configdump" >diff --git a/debian/scripts/koha-start-zebra b/debian/scripts/koha-start-zebra >index 069b31a..7d25b81 100755 >--- a/debian/scripts/koha-start-zebra >+++ b/debian/scripts/koha-start-zebra >@@ -18,90 +18,41 @@ > > set -e > >-die() >-{ >- echo "$@" 1>&2 >+# include helper functions >+if [ -f "/usr/share/koha/bin/koha-functions.sh" ]; then >+ . "/usr/share/koha/bin/koha-functions.sh" >+else >+ echo "Error: /usr/share/koha/bin/koha-functions.sh not present." 1>&2 > exit 1 >-} >- >-warn() >-{ >- echo "$@" 1>&2 >-} >- >-is_enabled() >-{ >- local instancename=$1 >- local instancefile="/etc/apache2/sites-available/$instancename.conf" >- >- if ! is_instance $instancename; then >- return 1 >- fi >- >- if grep -q '^[[:space:]]*Include /etc/koha/apache-shared-disable.conf' \ >- "$instancefile" ; then >- return 1 >- else >- return 0 >- fi >-} >- >-is_instance() >-{ >- local instancename=$1 >- >- if find /etc/koha/sites -mindepth 1 -maxdepth 1 \ >- -type d -printf '%f\n'\ >- | grep -q -x $instancename ; then >- return 0 >- else >- return 1 >- fi >-} >- >-is_zebra_running() >-{ >- local instancename=$1 >- >- if daemon --name="$instancename-koha-zebra" \ >- --user="$instancename-koha.$instancename-koha" \ >- --running ; then >- return 0 >- else >- return 1 >- fi >-} >+fi > > start_zebra_instance() > { > local instancename=$1 > >- if is_enabled $instancename; then >- echo "Starting Zebra server for $instancename" >- touch "/var/log/koha/$instancename/zebra-error.log" \ >- "/var/log/koha/$instancename/zebra.log" \ >- "/var/log/koha/$instancename/zebra-output.log" >- chown "$instancename-koha:$instancename-koha" \ >- "/var/log/koha/$instancename/zebra-error.log" \ >- "/var/log/koha/$instancename/zebra.log" \ >- "/var/log/koha/$instancename/zebra-output.log" >- daemon \ >- --name="$instancename-koha-zebra" \ >- --errlog="/var/log/koha/$instancename/zebra-error.log" \ >- --stdout="/var/log/koha/$instancename/zebra.log" \ >- --output="/var/log/koha/$instancename/zebra-output.log" \ >- --verbose=1 \ >- --respawn \ >- --delay=30 \ >- --user="$instancename-koha.$instancename-koha" \ >- -- \ >- zebrasrv \ >- -v none,fatal,warn \ >- -f "/etc/koha/sites/$instancename/koha-conf.xml" && \ >- return 0 >- else >+ echo "Starting Zebra server for $instancename" >+ touch "/var/log/koha/$instancename/zebra-error.log" \ >+ "/var/log/koha/$instancename/zebra.log" \ >+ "/var/log/koha/$instancename/zebra-output.log" >+ chown "$instancename-koha:$instancename-koha" \ >+ "/var/log/koha/$instancename/zebra-error.log" \ >+ "/var/log/koha/$instancename/zebra.log" \ >+ "/var/log/koha/$instancename/zebra-output.log" >+ daemon \ >+ --name="$instancename-koha-zebra" \ >+ --errlog="/var/log/koha/$instancename/zebra-error.log" \ >+ --stdout="/var/log/koha/$instancename/zebra.log" \ >+ --output="/var/log/koha/$instancename/zebra-output.log" \ >+ --verbose=1 \ >+ --respawn \ >+ --delay=30 \ >+ --user="$instancename-koha.$instancename-koha" \ >+ -- \ >+ zebrasrv \ >+ -v none,fatal,warn \ >+ -f "/etc/koha/sites/$instancename/koha-conf.xml" && \ >+ return 0 || \ > return 1 >- fi > } > > usage() >diff --git a/debian/scripts/koha-stop-zebra b/debian/scripts/koha-stop-zebra >index 2c8b726..cf5084d 100755 >--- a/debian/scripts/koha-stop-zebra >+++ b/debian/scripts/koha-stop-zebra >@@ -18,84 +18,35 @@ > > set -e > >-die() >-{ >- echo "$@" 1>&2 >+# include helper functions >+if [ -f "/usr/share/koha/bin/koha-functions.sh" ]; then >+ . "/usr/share/koha/bin/koha-functions.sh" >+else >+ echo "Error: /usr/share/koha/bin/koha-functions.sh not present." 1>&2 > exit 1 >-} >- >-warn() >-{ >- echo "$@" 1>&2 >-} >- >-is_enabled() >-{ >- local instancename=$1 >- local instancefile="/etc/apache2/sites-available/$instancename.conf" >- >- if ! is_instance $instancename; then >- return 1 >- fi >- >- if grep -q '^[[:space:]]*Include /etc/koha/apache-shared-disable.conf' \ >- "$instancefile" ; then >- return 1 >- else >- return 0 >- fi >-} >- >-is_instance() >-{ >- local instancename=$1 >- >- if find /etc/koha/sites -mindepth 1 -maxdepth 1 \ >- -type d -printf '%f\n'\ >- | grep -q -x $instancename ; then >- return 0 >- else >- return 1 >- fi >-} >- >-is_zebra_running() >-{ >- local instancename=$1 >- >- if daemon --name="$instancename-koha-zebra" \ >- --user="$instancename-koha.$instancename-koha" \ >- --running ; then >- return 0 >- else >- return 1 >- fi >-} >+fi > > stop_zebra_instance() > { > local instancename=$1 > >- if is_zebra_running $instancename; then >- echo "Stopping Zebra server for $instancename" >- daemon \ >- --name="$instancename-koha-zebra" \ >- --errlog="/var/log/koha/$instancename/zebra-error.log" \ >- --stdout="/var/log/koha/$instancename/zebra.log" \ >- --output="/var/log/koha/$instancename/zebra-output.log" \ >- --verbose=1 \ >- --respawn \ >- --delay=30 \ >- --user="$instancename-koha.$instancename-koha" \ >- --stop \ >- -- \ >- zebrasrv \ >- -v none,fatal,warn \ >- -f "/etc/koha/sites/$instancename/koha-conf.xml" && \ >- return 0 >- else >+ echo "Stopping Zebra server for $instancename" >+ daemon \ >+ --name="$instancename-koha-zebra" \ >+ --errlog="/var/log/koha/$instancename/zebra-error.log" \ >+ --stdout="/var/log/koha/$instancename/zebra.log" \ >+ --output="/var/log/koha/$instancename/zebra-output.log" \ >+ --verbose=1 \ >+ --respawn \ >+ --delay=30 \ >+ --user="$instancename-koha.$instancename-koha" \ >+ --stop \ >+ -- \ >+ zebrasrv \ >+ -v none,fatal,warn \ >+ -f "/etc/koha/sites/$instancename/koha-conf.xml" && \ >+ return 0 || \ > return 1 >- fi > } > > usage() >diff --git a/debian/scripts/koha-translate b/debian/scripts/koha-translate >index 0164a72..16ae5cf 100755 >--- a/debian/scripts/koha-translate >+++ b/debian/scripts/koha-translate >@@ -20,6 +20,14 @@ > > set -e > >+# include helper functions >+if [ -f "/usr/share/koha/bin/koha-functions.sh" ]; then >+ . "/usr/share/koha/bin/koha-functions.sh" >+else >+ echo "Error: /usr/share/koha/bin/koha-functions.sh not present." 1>&2 >+ exit 1 >+fi >+ > usage() > { > local scriptname=$(basename $0) >@@ -50,12 +58,6 @@ $scriptname --help|-h > EOF > } > >-die() >-{ >- echo "$@" 1>&2 >- exit 1 >-} >- > list() > { > all=$1 >-- >1.8.3.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 11404
:
23581
|
28163
|
28164
|
28165
|
28185
|
28186
|
28187
|
28188
|
28215
|
28370
|
28371
|
28372
|
28373