Bug 39740: Replace envvar check by calling is_git_install on instance level
Replace the $GIT_INSTALL check by is_git_install. Some scripts did call is_git_install once while potentially looping over multiple instances. Note: koha-reset-passwd only runs on one instance (unlike most). Test plan: Check/adjust git_install and test_system in koha-conf.xml for used instances. cp debian/scripts/koha-functions.sh /usr/share/koha/bin/ cp debian/scripts/koha-* /usr/sbin/ Note: We will still test koha-plack and -z3950-responder later. Test running a few of the other changed koha-* scripts on one or more instances. Verify that things work as expected. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
parent
c41ba6ca06
commit
1aed2204ab
|
|
@ -84,12 +84,6 @@ run_rebuild_elasticsearch()
|
|||
# read instance name and eliminate instance name from params
|
||||
local name=$1; shift
|
||||
|
||||
if [ "$GIT_INSTALL" = "" ]; then
|
||||
KOHA_BINDIR=${KOHA_HOME}/bin
|
||||
else
|
||||
KOHA_BINDIR=${KOHA_HOME}/misc
|
||||
fi
|
||||
|
||||
if [ "${clo_commit_size}" -gt 0 ] 2>/dev/null; then
|
||||
commit_size=${clo_commit_size}
|
||||
fi
|
||||
|
|
@ -120,8 +114,9 @@ run_rebuild_elasticsearch()
|
|||
rebuild_opts="${rebuild_opts} -v"
|
||||
fi
|
||||
|
||||
# KOHA_HOME and KOHA_BINDIR may have been adjusted/set by adjust_paths_git_install
|
||||
if koha-shell \
|
||||
-c "${KOHA_BINDIR}/search_tools/rebuild_elasticsearch.pl ${rebuild_opts}" \
|
||||
-c "${KOHA_HOME}/${KOHA_BINDIR}/search_tools/rebuild_elasticsearch.pl ${rebuild_opts}" \
|
||||
${name}; then
|
||||
return 0
|
||||
else
|
||||
|
|
@ -177,9 +172,6 @@ while [ -n "$*" ]; do
|
|||
shift
|
||||
done
|
||||
|
||||
# Optionally use alternative paths for a dev install
|
||||
adjust_paths_git_install $1
|
||||
|
||||
# Parse command line.
|
||||
if [ $# -lt 1 ]; then
|
||||
usage
|
||||
|
|
@ -190,6 +182,7 @@ fi
|
|||
for name in "$@"
|
||||
do
|
||||
if is_instance $name; then
|
||||
adjust_paths_git_install $name
|
||||
if [ "${op}" = "rebuild" ]; then
|
||||
if ! run_rebuild_elasticsearch $name; then
|
||||
warn "Something went wrong rebuilding indexes for ${name}"
|
||||
|
|
|
|||
|
|
@ -198,24 +198,16 @@ while [ $# -gt 0 ]; do
|
|||
|
||||
done
|
||||
|
||||
# Optionally use alternative paths for a dev install
|
||||
adjust_paths_git_install $1
|
||||
|
||||
if [ "$GIT_INSTALL" = "" ]; then
|
||||
worker_DAEMON="${KOHA_HOME}/bin/workers/es_indexer_daemon.pl"
|
||||
else
|
||||
worker_DAEMON="${KOHA_HOME}/misc/workers/es_indexer_daemon.pl"
|
||||
fi
|
||||
|
||||
# PERL5LIB has been read from etc/default
|
||||
export PERL5LIB
|
||||
|
||||
if [ $# -gt 0 ]; then
|
||||
# We have at least one instance name
|
||||
for name in "$@"; do
|
||||
|
||||
if is_instance $name; then
|
||||
|
||||
adjust_paths_dev_install $name
|
||||
worker_DAEMON="${KOHA_HOME}/${KOHA_BINDIR}/workers/es_indexer_daemon.pl"
|
||||
export PERL5LIB
|
||||
|
||||
case $op in
|
||||
"start")
|
||||
start_es_indexer $name
|
||||
|
|
|
|||
|
|
@ -194,19 +194,9 @@ while [ $# -gt 0 ]; do
|
|||
|
||||
done
|
||||
|
||||
# Optionally use alternative paths for a dev install
|
||||
adjust_paths_git_install $1
|
||||
|
||||
# Check if an alternate indexer has been set
|
||||
if [ ! -z "$ALTERNATE_INDEXER_DAEMON" ]; then
|
||||
INDEXER_DAEMON="$ALTERNATE_INDEXER_DAEMON"
|
||||
else
|
||||
# We default to rebuild_zebra.pl if no alternate indexer set
|
||||
if [ "$GIT_INSTALL" = "" ]; then
|
||||
INDEXER_DAEMON="${KOHA_HOME}/bin/migration_tools/rebuild_zebra.pl"
|
||||
else
|
||||
INDEXER_DAEMON="${KOHA_HOME}/misc/migration_tools/rebuild_zebra.pl"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $INDEXER_TIMEOUT -lt 1 ]; then
|
||||
|
|
@ -219,15 +209,19 @@ if [ -z "$INDEXER_PARAMS" ]; then
|
|||
INDEXER_PARAMS="-daemon -sleep $INDEXER_TIMEOUT $DEBUG"
|
||||
fi
|
||||
|
||||
# PERL5LIB has been read from etc/default
|
||||
export PERL5LIB
|
||||
|
||||
if [ $# -gt 0 ]; then
|
||||
# We have at least one instance name
|
||||
for name in "$@"; do
|
||||
|
||||
if is_instance $name; then
|
||||
|
||||
adjust_paths_git_install $name
|
||||
if [ -z "$ALTERNATE_INDEXER_DAEMON" ]; then
|
||||
# We default to rebuild_zebra.pl if no alternate indexer set
|
||||
INDEXER_DAEMON="${KOHA_HOME}/${KOHA_BINDIR}/migration_tools/rebuild_zebra.pl"
|
||||
fi
|
||||
export PERL5LIB
|
||||
|
||||
case $op in
|
||||
"start")
|
||||
start_indexer $name
|
||||
|
|
|
|||
|
|
@ -56,18 +56,12 @@ run_rebuild_zebra()
|
|||
[ "${full_reindex}" = "yes" ] ||
|
||||
[ "${force}" = "yes" ] ; then
|
||||
|
||||
if [ "$GIT_INSTALL" = "" ]; then
|
||||
KOHA_BINDIR=$KOHA_HOME/bin
|
||||
else
|
||||
KOHA_BINDIR=$KOHA_HOME/misc
|
||||
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=$PERL5LIB \
|
||||
KOHA_CONF="/etc/koha/sites/$instancename/koha-conf.xml" \
|
||||
$KOHA_BINDIR/migration_tools/rebuild_zebra.pl $@ ; then
|
||||
$KOHA_HOME/$KOHA_BINDIR/migration_tools/rebuild_zebra.pl $@ ; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
|
|
@ -148,10 +142,6 @@ while [ -n "$*" ]; do
|
|||
shift
|
||||
done
|
||||
|
||||
# Optionally use alternative paths for a dev install
|
||||
adjust_paths_git_install $1
|
||||
|
||||
# Parse command line.
|
||||
if [ $# -lt 1 ]; then
|
||||
if [ "$quiet" = "no" ]; then
|
||||
usage
|
||||
|
|
@ -165,6 +155,9 @@ fi
|
|||
for name in "$@"
|
||||
do
|
||||
if is_instance $name; then
|
||||
|
||||
adjust_paths_git_install $name
|
||||
|
||||
if [ "$biblios" = "yes" ]; then
|
||||
if ! run_rebuild_zebra $name \
|
||||
-b $opt_verbose $opt_idx $opts_other; then
|
||||
|
|
|
|||
|
|
@ -45,19 +45,10 @@ set_password()
|
|||
local instancename=$1
|
||||
local userid=$2
|
||||
|
||||
# Optionally use alternative paths for a dev install
|
||||
adjust_paths_git_install $1
|
||||
|
||||
if [ "$GIT_INSTALL" = "" ]; then
|
||||
KOHA_BINDIR=$KOHA_HOME/bin
|
||||
else
|
||||
KOHA_BINDIR=$KOHA_HOME/misc
|
||||
fi
|
||||
|
||||
if sudo -u "$instancename-koha" -H \
|
||||
env PERL5LIB=$PERL5LIB \
|
||||
KOHA_CONF="/etc/koha/sites/$instancename/koha-conf.xml" \
|
||||
$KOHA_BINDIR/admin/set_password.pl --userid $userid ; then
|
||||
$KOHA_HOME/$KOHA_BINDIR/admin/set_password.pl --userid $userid ; then
|
||||
|
||||
return 0
|
||||
else
|
||||
|
|
@ -72,6 +63,8 @@ fi
|
|||
|
||||
instance="$1"
|
||||
shift
|
||||
# Adjust KOHA_HOME, KOHA_BINDIR if needed
|
||||
adjust_paths_git_install $instance
|
||||
|
||||
for userid in "$@"
|
||||
do
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ start_sip()
|
|||
adjust_paths_git_install $name
|
||||
export KOHA_HOME PERL5LIB
|
||||
|
||||
if [ "$GIT_INSTALL" = "" ]; then
|
||||
if ! is_git_install $name; then
|
||||
LIBDIR=$KOHA_HOME/lib
|
||||
else
|
||||
LIBDIR=$KOHA_HOME
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ generate_sitemap()
|
|||
if sudo -u "$instance-koha" -H \
|
||||
env PERL5LIB=$PERL5LIB \
|
||||
KOHA_CONF="/etc/koha/sites/$instance/koha-conf.xml" \
|
||||
$KOHA_BINDIR/cronjobs/sitemap.pl \
|
||||
$KOHA_HOME/$KOHA_BINDIR/cronjobs/sitemap.pl \
|
||||
--dir $sitemapdir ; then
|
||||
return 0
|
||||
else
|
||||
|
|
@ -171,20 +171,14 @@ while [ $# -gt 0 ]; do
|
|||
|
||||
done
|
||||
|
||||
# Optionally use alternative paths for a dev install
|
||||
adjust_paths_git_install $1
|
||||
if [ "$GIT_INSTALL" = "" ]; then
|
||||
KOHA_BINDIR=$KOHA_HOME/bin
|
||||
else
|
||||
KOHA_BINDIR=$KOHA_HOME/misc
|
||||
fi
|
||||
|
||||
if [ $# -gt 0 ]; then
|
||||
# We have at least one instance name
|
||||
for name in "$@"; do
|
||||
|
||||
if is_instance $name; then
|
||||
|
||||
adjust_paths_git_install $name
|
||||
|
||||
case $op in
|
||||
"generate")
|
||||
generate_sitemap $name
|
||||
|
|
|
|||
|
|
@ -29,17 +29,17 @@ else
|
|||
exit 1
|
||||
fi
|
||||
|
||||
# Optionally use alternative paths for a dev install
|
||||
adjust_paths_git_install $1
|
||||
if [ "$GIT_INSTALL" = "" ]; then
|
||||
CGI_PATH=$KOHA_HOME/intranet/cgi-bin
|
||||
else
|
||||
CGI_PATH=$KOHA_HOME
|
||||
fi
|
||||
|
||||
for name in "$@"
|
||||
do
|
||||
if is_instance $name; then
|
||||
|
||||
adjust_paths_git_install $name
|
||||
if ! is_git_install $name; then
|
||||
CGI_PATH=$KOHA_HOME/intranet/cgi-bin
|
||||
else
|
||||
CGI_PATH=$KOHA_HOME
|
||||
fi
|
||||
|
||||
echo "Upgrading database schema for $name"
|
||||
if KOHA_CONF="/etc/koha/sites/$name/koha-conf.xml" \
|
||||
PERL5LIB=$PERL5LIB \
|
||||
|
|
|
|||
|
|
@ -211,24 +211,16 @@ while [ $# -gt 0 ]; do
|
|||
|
||||
done
|
||||
|
||||
# Optionally use alternative paths for a dev install
|
||||
adjust_paths_git_install $1
|
||||
|
||||
if [ "$GIT_INSTALL" = "" ]; then
|
||||
worker_DAEMON="${KOHA_HOME}/bin/workers/background_jobs_worker.pl"
|
||||
else
|
||||
worker_DAEMON="${KOHA_HOME}/misc/workers/background_jobs_worker.pl"
|
||||
fi
|
||||
|
||||
# PERL5LIB has been read from etc/default
|
||||
export PERL5LIB
|
||||
|
||||
if [ $# -gt 0 ]; then
|
||||
# We have at least one instance name
|
||||
for name in "$@"; do
|
||||
|
||||
if is_instance $name; then
|
||||
|
||||
adjust_paths_git_install $name
|
||||
worker_DAEMON="${KOHA_HOME}/${KOHA_BINDIR}/workers/background_jobs_worker.pl"
|
||||
export PERL5LIB
|
||||
|
||||
case $op in
|
||||
"start")
|
||||
start_worker $name $queue
|
||||
|
|
|
|||
|
|
@ -85,13 +85,7 @@ start_z3950()
|
|||
daemonize="-D -d ${instancename}-koha-z3950"
|
||||
logging="-l /var/log/koha/${instancename}/z3950.log"
|
||||
|
||||
if [ "$GIT_INSTALL" = "1" ]; then
|
||||
MISCDIR=$KOHA_HOME/misc
|
||||
else
|
||||
MISCDIR=/usr/share/koha/bin
|
||||
fi
|
||||
|
||||
Z3950RESPONDER="/usr/bin/perl $MISCDIR/z3950_responder.pl"
|
||||
Z3950RESPONDER="/usr/bin/perl $KOHA_HOME/$KOHA_BINDIR/z3950_responder.pl"
|
||||
if [ "$debug_mode" = "yes" ]; then
|
||||
if [ "$GIT_INSTALL" = "1" ]; then
|
||||
warn "Not a dev install, disabling debug mode"
|
||||
|
|
@ -99,7 +93,7 @@ start_z3950()
|
|||
environment="development"
|
||||
daemonize=""
|
||||
logging="" # remote debugger takes care
|
||||
Z3950RESPONDER="/usr/bin/perl -d ${MISCDIR}/z3950_responder.pl"
|
||||
Z3950RESPONDER="/usr/bin/perl -d $KOHA_HOME/$KOHA_BINDIR/z3950_responder.pl"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
|
@ -317,7 +311,6 @@ if [ $# -gt 0 ]; then
|
|||
export DBGP_IDEKEY=${debugger_key}
|
||||
export PERL5OPT="-d"
|
||||
fi
|
||||
|
||||
export PERL5LIB
|
||||
|
||||
case $op in
|
||||
|
|
|
|||
Loading…
Reference in New Issue