| Summary: | fix koha-upgrade-schema to work with git/dev installs | ||
|---|---|---|---|
| Product: | Koha | Reporter: | Mason James <mtj> |
| Component: | Command-line Utilities | Assignee: | Mason James <mtj> |
| Status: | NEW --- | QA Contact: | Testopia <testopia> |
| Severity: | enhancement | ||
| Priority: | P5 - low | CC: | chris.kirby, m.de.rooy, tomascohen |
| Version: | Main | ||
| Hardware: | All | ||
| OS: | All | ||
| See Also: |
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13216 https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16733 |
||
| GIT URL: | Initiative type: | --- | |
| Sponsorship status: | --- | Crowdfunding goal: | 0 |
| Patch complexity: | --- | Documentation contact: | |
| Documentation submission: | Text to go in the release notes: | ||
| Version(s) released in: | Circulation function: | ||
|
Description
Mason James
2014-11-07 00:53:58 UTC
here's an example of a failed attempt... # koha-create --create-db master # koha-gitify master /path/to/my/koha # apachectl restart # koha-upgrade-schema -v master Upgrading database schema for -v unable to locate Koha configuration file koha-conf.xml at /usr/share/koha/lib/C4/Context.pm line 373. unable to locate Koha configuration file koha-conf.xml at /usr/share/koha/lib/C4/Context.pm line 373. unable to locate Koha configuration file koha-conf.xml at /usr/share/koha/lib/C4/Context.pm line 373. Can't call method "config" on unblessed reference at /usr/share/koha/lib/C4/Context.pm line 796. > # koha-upgrade-schema -v master
> Upgrading database schema for -v
oops, typo ^
root@xen1:~# sh -x /usr/sbin/koha-upgrade-schema master
+ set -e
+ update=/usr/share/koha/intranet/cgi-bin/installer/data/mysql/updatedatabase.pl
+ echo Upgrading database schema for master
Upgrading database schema for master
+ KOHA_CONF=/etc/koha/sites/master/koha-conf.xml PERL5LIB=/usr/share/koha/lib /usr/share/koha/intranet/cgi-bin/installer/data/mysql/updatedatabase.pl
this is a similar issue to 13216, where PERL5LIB is assumed be '/usr/share/koha'
I'd like to say that gitified instance issues should be handled outside Koha... With that in mind, I'd say the best approach to this is to make the scripts (all of them?)
- Test for PERL5LIB be defined (so we can make koha-gitify wrap things or... we'll solve it)
- Otherwise fallback to the system-wide one that is set in /etc/default/koha-common
So maintenance scripts should do something like this:
# include helper functions
if [ -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
exit 1
fi
Ok, most of them do it already. And then add to koha-functions.sh the check+read:
if [ ! -z $PERL5LIB ]; then
CLI_PERL5LIB=$PERL5LIB
fi
if [ -r /etc/default/$NAME ]; then
# Debian / Ubuntu
. /etc/default/$NAME
elif [ -r /etc/sysconfig/$NAME ]; then
# RedHat / SuSE
. /etc/sysconfig/$NAME
fi
if [ ! -z $CLI_PERL5LIB ]; then
PERL5LIB=$CLI_PERL5LIB
fi
(In reply to Tomás Cohen Arazi from comment #3) > I'd like to say that gitified instance issues should be handled outside > Koha... With that in mind, I'd say the best approach to this is to make the > scripts (all of them?) > - Test for PERL5LIB be defined (so we can make koha-gitify wrap things or... > we'll solve it) > - Otherwise fallback to the system-wide one that is set in > /etc/default/koha-common I submitted some patches on bug 16733 to adjust all debian scripts that use PERL5LIB (including this one). With some minimal changes and less hardcoded paths, we can make life easier for those of us willing to use debian scripts and having a dev install. My approach seems to be what Tomas suggested: read the defaults, add one line to koha-conf for dev installs, and adjust PERL5LIB if needed. |