Bugzilla – Attachment 37616 Details for
Bug 13971
Adjusted locations in koha-rebuild-zebra for gitified instance
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 13971: Adjusted locations in koha-rebuild-zebra for gitified instance
Bug-13971-Adjusted-locations-in-koha-rebuild-zebra.patch (text/plain), 3.93 KB, created by
Marcel de Rooy
on 2015-04-09 11:16:52 UTC
(
hide
)
Description:
Bug 13971: Adjusted locations in koha-rebuild-zebra for gitified instance
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2015-04-09 11:16:52 UTC
Size:
3.93 KB
patch
obsolete
>From c5bf943fc800443ee83f6e997fa30b99ae82403a Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Wed, 8 Apr 2015 16:28:18 +0200 >Subject: [PATCH] Bug 13971: Adjusted locations in koha-rebuild-zebra for > gitified instance >Content-Type: text/plain; charset=utf-8 > >This patch adds a few lines to koha-rebuild-zebra in order to adjust the >locations for PERL5LIB and rebuild_zebra.pl script. It also adds two >functions to koha-functions: is_gitified and get_perl5lib. >It builds on the notion that koha-conf.xml contains a <gitified> tag for >gitified installs. It also looks for a perl5lib tag in koha-conf. > >NOTE: If the gitified or the perl5lib tag does not exist, behavior does not >change. >I will submit a separate follow-up report for adding those tags. >The use of function get_perl5lib can replace hardcoded paths in the other >scripts too; I will also move that to a new report. >Furthermore, I would like to use the Zebra setup from the gitified instance >instead of the default files in /etc/koha/zebradb. Will put that in another >report too. > >Test plan: >[1] Verify that your koha-conf does not contain: > <gitified>1</gitified> >[2] Run koha-rebuild-zebra -a -b -v [instance] >[3] If you have a gitified instance, add the gitified tag to your koha-conf > and the path in a perl5lib tag. >[4] Run koha-rebuild-zebra -a -b -v [instance] > Verify that you run the right version of rebuild_zebra.pl. You could do > that by adding a simple debug print. >--- > debian/scripts/koha-functions.sh | 25 +++++++++++++++++++++++++ > debian/scripts/koha-rebuild-zebra | 18 +++++++++++++++--- > 2 files changed, 40 insertions(+), 3 deletions(-) > >diff --git a/debian/scripts/koha-functions.sh b/debian/scripts/koha-functions.sh >index 8090fc5..2bf17b2 100755 >--- a/debian/scripts/koha-functions.sh >+++ b/debian/scripts/koha-functions.sh >@@ -126,3 +126,28 @@ get_instances() > find /etc/koha/sites -mindepth 1 -maxdepth 1\ > -type d -printf '%f\n' | sort > } >+ >+get_perl5lib() >+{ >+ local instancename=$1 >+ >+ #first try perl5lib in koha-conf.xml >+ local retval=$(xmlstarlet sel -t -v 'yazgfs/config/perl5lib' /etc/koha/sites/$instancename/koha-conf.xml) >+ >+ if [ "$retval" != "" ]; then >+ echo "$retval" >+ else >+ echo "/usr/share/koha/lib" >+ fi >+} >+ >+is_gitified() >+{ >+ local instancename=$1 >+ local retval=$(xmlstarlet sel -t -v 'yazgfs/config/gitified' /etc/koha/sites/$instancename/koha-conf.xml) >+ if [ "$retval" = "1" ]; then >+ return 0 >+ else >+ return 1 >+ fi >+} >diff --git a/debian/scripts/koha-rebuild-zebra b/debian/scripts/koha-rebuild-zebra >index f8267c5..e701d6b 100755 >--- a/debian/scripts/koha-rebuild-zebra >+++ b/debian/scripts/koha-rebuild-zebra >@@ -20,7 +20,10 @@ > set -e > > # include helper functions >-if [ -f "/usr/share/koha/bin/koha-functions.sh" ]; then >+scriptdir=$(dirname "$0") >+if [ -f $scriptdir/koha-functions.sh ]; then >+ . "$scriptdir/koha-functions.sh" >+elif [ -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 >@@ -49,12 +52,21 @@ run_rebuild_zebra() > { > local instancename=$1; shift > >+ # If we 'gitified' a Koha instance, point to adjusted locations >+ local libpath=$(get_perl5lib $instancename) >+ local rebuild >+ if is_gitified $instancename; then >+ rebuild="$libpath/misc" >+ else >+ rebuild="/usr/share/koha/bin" >+ fi >+ > # TODO: This comment is here to remind us that we should make > # rebuild_zebra.pl return error codes on failure > if sudo -u "$instancename-koha" -H \ >- env PERL5LIB=/usr/share/koha/lib \ >+ env PERL5LIB=$libpath \ > KOHA_CONF="/etc/koha/sites/$instancename/koha-conf.xml" \ >- /usr/share/koha/bin/migration_tools/rebuild_zebra.pl $@ ; then >+ $rebuild/migration_tools/rebuild_zebra.pl $@ ; then > return 0 > else > return 1 >-- >1.7.10.4
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 13971
:
37582
|
37616
|
40628