@@ -, +, @@ gitified instance 1 and the path in a perl5lib tag. 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(-) --- a/debian/scripts/koha-functions.sh +++ a/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 +} --- a/debian/scripts/koha-rebuild-zebra +++ a/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 --