Bug 39740: Add is_git_install and is_test_system
Test plan:
Copy koha-functions.sh to /usr/share/koha/bin.
Source bin/koha-functions.sh ('. bin/koha-functions.sh')
Test in bash (Yes expected; adjust instance name):
GIT_INSTALL=1; if is_git_install your_instance; then echo Yes; fi
Add/set git_install to 1 in koha-conf.xml.
Test in bash (Yes expected):
unset GIT_INSTALL; if is_git_install your_instance; then echo Yes; fi
Set git_install to 0 in koha-conf.xml.
Test in bash (No expected):
unset GIT_INSTALL; if ! is_git_install your_instance; then echo No; fi
Remove git_install and add/set dev_install to 1 in koha-conf.xml.
Test in bash (Yes expected):
unset GIT_INSTALL; if is_git_install your_instance; then echo Yes; fi
A few similar tests with test_system.
Add/set test_system to 0 in koha-conf.xml.
Test in bash (Yes expected):
TEST_SYSTEM=1; if is_test_system your_instance; then echo Yes; fi
Test in bash (No expected):
unset TEST_SYSTEM; if ! is_test_system your_instance; then echo No; fi
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
e1116df2c1
commit
b627f950c7
|
|
@ -367,22 +367,57 @@ is_elasticsearch_enabled()
|
|||
|
||||
adjust_paths_dev_install()
|
||||
{
|
||||
# Adjust KOHA_HOME, PERL5LIB for dev installs, as indicated by
|
||||
# corresponding tag in koha-conf.xml
|
||||
# Adjust KOHA_HOME, PERL5LIB, KOHA_BINDIR for git installs
|
||||
|
||||
local instancename=$1
|
||||
local dev_install=""
|
||||
|
||||
if [ "$instancename" != "" ] && is_instance $instancename; then
|
||||
dev_install=$(run_safe_xmlstarlet $instancename dev_install)
|
||||
fi
|
||||
|
||||
if [ "$dev_install" != "" ] && [ "$dev_install" != "0" ]; then
|
||||
DEV_INSTALL=1
|
||||
if is_git_install $instancename; then
|
||||
KOHA_HOME=$(run_safe_xmlstarlet $instancename intranetdir)
|
||||
PERL5LIB="$KOHA_HOME:$KOHA_HOME/lib"
|
||||
KOHA_BINDIR=misc
|
||||
else
|
||||
DEV_INSTALL=""
|
||||
KOHA_BINDIR=bin
|
||||
fi
|
||||
}
|
||||
|
||||
is_git_install()
|
||||
{
|
||||
local instancename=$1 git_install
|
||||
|
||||
# env var GIT_INSTALL overrules koha-conf entry
|
||||
if [ -n "$GIT_INSTALL" ]; then
|
||||
if [ "$GIT_INSTALL" != "0" ]; then return 0; else return 1; fi
|
||||
fi
|
||||
|
||||
# now check koha-conf; looking at dev_install as historical fallback
|
||||
if [ "$instancename" != "" ] && is_instance $instancename; then
|
||||
git_install=$(run_safe_xmlstarlet $instancename git_install)
|
||||
if [ -z "$git_install" ]; then git_install=$(run_safe_xmlstarlet $instancename dev_install); fi
|
||||
fi
|
||||
if [ -n "$git_install" ] && [ "$git_install" != "0" ]; then
|
||||
return 0; # true
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
is_test_system()
|
||||
{
|
||||
local instancename=$1 test_system
|
||||
|
||||
# env var TEST_SYSTEM overrules koha-conf entry
|
||||
if [ -n "$TEST_SYSTEM" ]; then
|
||||
if [ "$TEST_SYSTEM" != "0" ]; then return 0; else return 1; fi
|
||||
fi
|
||||
|
||||
# now check koha-conf
|
||||
if [ "$instancename" != "" ] && is_instance $instancename; then
|
||||
test_system=$(run_safe_xmlstarlet $instancename test_system)
|
||||
fi
|
||||
if [ -n "$test_system" ] && [ "test_system" != "0" ]; then
|
||||
return 0; # true
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue