Using sed and regex was causing issues when LDAP connection details were
added.
See
http://stackoverflow.com/questions/
1732348/regex-match-open-tags-except-xhtml-self-contained-tags/
1732454#
1732454
for more information.
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
libdbi-perl,
libdigest-sha-perl | perl,
libemail-date-perl,
- libfile-temp-perl | perl-modules,
libgd-barcode-perl,
libgd-gd2-noxpm-perl | libgd-gd2-perl,
libgraphics-magick-perl,
mysql-client,
pwgen,
tinymce2,
+ xmlstarlet,
yaz
Suggests: mysql-server
Homepage: http://koha-community.org/
mysql-client,
pwgen,
tinymce2,
+ xmlstarlet,
yaz
Suggests: mysql-server
Homepage: http://koha-community.org/
# Dump database.
-mysqlhost="$(sed -n '/.*<hostname>\(.*\)<\/hostname>.*/s::\1:p' $kohaconfig)"
-mysqldb="$(sed -n '/.*<database>\(.*\)<\/database>.*/s::\1:p' $kohaconfig)"
-mysqluser="$(sed -n '/.*<user>\(.*\)<\/user>.*/s::\1:p' $kohaconfig | tail -n1)"
-mysqlpass="$(sed -n '/.*<pass>\(.*\)<\/pass>.*/s::\1:p' $kohaconfig)"
+mysqlhost="$( xmlstarlet sel -t -v 'yazgfs/config/hostname' $kohaconfig )"
+mysqldb="$( xmlstarlet sel -t -v 'yazgfs/config/database' $kohaconfig )"
+mysqluser="$( xmlstarlet sel -t -v 'yazgfs/config/user' $kohaconfig )"
+mysqlpass="$( xmlstarlet sel -t -v 'yazgfs/config/pass' $kohaconfig )"
dbdump="/var/spool/koha/$name/$name-$date.sql.gz"
echo "* DB to $dbdump"
mysqldump --databases --host="$mysqlhost" \
date="$(date +%Y-%m-%d)"
-mysqldb="$(sed -n '/.*<database>\(.*\)<\/database>.*/s::\1:p' $kohaconfig)"
-mysqluser="$(sed -n '/.*<user>\(.*\)<\/user>.*/s::\1:p' $kohaconfig | tail -n1)"
-mysqlpass="$(sed -n '/.*<pass>\(.*\)<\/pass>.*/s::\1:p' $kohaconfig)"
-mysqldump --databases --user="$mysqluser" --password="$mysqlpass" "$mysqldb" |
+mysqlhost="$( xmlstarlet sel -t -v 'yazgfs/config/hostname' $kohaconfig )"
+mysqldb="$( xmlstarlet sel -t -v 'yazgfs/config/database' $kohaconfig )"
+mysqluser="$( xmlstarlet sel -t -v 'yazgfs/config/user' $kohaconfig )"
+mysqlpass="$( xmlstarlet sel -t -v 'yazgfs/config/pass' $kohaconfig )"
+mysqldump --databases --host="$mysqlhost" --user="$mysqluser" \
+ --password="$mysqlpass" "$mysqldb" |
sed "s/$name/__KOHASITE__/g"
# Re-create database and database user.
mysqldb="koha_$name"
mysqluser="koha_$name"
-mysqlpwd="$(sed -n '/.*<pass>\(.*\)<\/pass>.*/s//\1/p' /etc/koha/sites/$name/koha-conf.xml)"
+mysqlpwd="$( xmlstarlet sel -t -v 'yazgfs/config/pass' /etc/koha/sites/$name/koha-conf.xml )"
zcat "$sqldump" | mysql --defaults-extra-file=/etc/mysql/koha-common.cnf
mysql --defaults-extra-file=/etc/mysql/koha-common.cnf <<eof || true
DROP USER '$mysqluser';