Koha/debian/scripts/koha-rebuild-zebra
Chris Cormack ae70c2f790 Bug 6031 : Fix for syntax (bashism crept into a pure sh script)
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
2011-05-02 12:44:48 +12:00

61 lines
1.4 KiB
Bash
Executable file

#!/bin/sh
#
# koha-rebuild-zebra -- Rebuild the Zebra database for a Koha instance.
# Copyright 2010 Catalyst IT, Ltd
#
# 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/>.
set -e
opt_idx="-z"
opt_xml="-x"
opts_other=""
while [ -n "$*" ]; do
case "$1" in
-u|--usmarc)
opt_xml=""
;;
-f|--full)
opt_idx="-r"
;;
-*)
opts_other="$opts_other $1";
;;
*)
break
;;
esac
shift
done
run_zebra()
{
name=$1; shift
sudo -u "$name-koha" -H \
env PERL5LIB=/usr/share/koha/lib \
KOHA_CONF="/etc/koha/sites/$name/koha-conf.xml" \
/usr/share/koha/bin/migration_tools/rebuild_zebra.pl $@
}
for name in "$@"
do
run_zebra $name -b $opt_idx $opt_xml $opts_other
run_zebra $name -a $opt_idx $opts_other
done