Add support for a remote mysql server.
Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
This commit is contained in:
parent
2ae1e3c21d
commit
df6767467b
4 changed files with 15 additions and 5 deletions
2
debian/control
vendored
2
debian/control
vendored
|
@ -75,9 +75,9 @@ Depends: ${shlib:Depends}, ${misc:Depends}, ${koha:Depends},
|
|||
libjs-jquery,
|
||||
libjs-yui,
|
||||
mysql-client,
|
||||
mysql-server,
|
||||
tinymce2,
|
||||
yaz
|
||||
Suggests: mysql-server
|
||||
Homepage: http://koha-community.org/
|
||||
Description: integrated (physical) library management system
|
||||
Koha is an Integrated Library Managment system for real-world libraries
|
||||
|
|
4
debian/koha-common.postinst
vendored
4
debian/koha-common.postinst
vendored
|
@ -3,9 +3,9 @@
|
|||
set -e
|
||||
|
||||
conf=/etc/mysql/koha-common.cnf
|
||||
if [ ! -e "$conf" ]
|
||||
if [ ! -e "$conf" ] && [ ! -L "$conf" ]
|
||||
then
|
||||
ln -s debian.cnf /etc/mysql/koha-common.cnf
|
||||
ln -s debian.cnf "$conf"
|
||||
fi
|
||||
|
||||
#DEBHELPER#
|
||||
|
|
12
debian/scripts/koha-create
vendored
12
debian/scripts/koha-create
vendored
|
@ -37,6 +37,7 @@ generate_config_file() {
|
|||
-e "s/__INTRASERVER__/$intradomain/g" \
|
||||
-e "s/__ZEBRA_PASS__/$zebrapwd/g" \
|
||||
-e "s/__DB_NAME__/$mysqldb/g" \
|
||||
-e "s/__DB_HOST__/$mysqlhost/g" \
|
||||
-e "s/__DB_USER__/$mysqluser/g" \
|
||||
-e "s/__DB_PASS__/$mysqlpwd/g" \
|
||||
-e "s/__UNIXUSER__/$username/g" \
|
||||
|
@ -44,6 +45,14 @@ generate_config_file() {
|
|||
"/etc/koha/$1" > "$2"
|
||||
}
|
||||
|
||||
getmysqlhost() {
|
||||
awk '
|
||||
/^\[/ { inclient = 0 }
|
||||
/^\[client\]/ { inclient = 1 }
|
||||
inclient && /^ *host *=/ { print $3 }' \
|
||||
/etc/mysql/koha-common.cnf
|
||||
}
|
||||
|
||||
|
||||
# Set defaults and read config file, if it exists.
|
||||
DOMAIN=""
|
||||
|
@ -93,11 +102,12 @@ zebrapwd="$(pwgen -1)"
|
|||
|
||||
# Set up MySQL database for this instance.
|
||||
mysqldb="koha_$name"
|
||||
mysqlhost="$(getmysqlhost)"
|
||||
mysqluser="koha_$name"
|
||||
mysqlpwd="$(pwgen -1)"
|
||||
mysql --defaults-extra-file=/etc/mysql/koha-common.cnf <<eof
|
||||
CREATE DATABASE $mysqldb;
|
||||
CREATE USER '$mysqluser' IDENTIFIED BY '$mysqlpwd';
|
||||
CREATE USER '$mysqluser'@'%' IDENTIFIED BY '$mysqlpwd';
|
||||
GRANT ALL PRIVILEGES ON $mysqldb.* TO '$mysqluser';
|
||||
FLUSH PRIVILEGES;
|
||||
eof
|
||||
|
|
2
debian/templates/koha-conf-site.xml.in
vendored
2
debian/templates/koha-conf-site.xml.in
vendored
|
@ -122,7 +122,7 @@
|
|||
<config>
|
||||
<db_scheme>mysql</db_scheme>
|
||||
<database>__DB_NAME__</database>
|
||||
<hostname>localhost</hostname>
|
||||
<hostname>__DB_HOST__</hostname>
|
||||
<port>3306</port>
|
||||
<user>__DB_USER__</user>
|
||||
<pass>__DB_PASS__</pass>
|
||||
|
|
Loading…
Reference in a new issue