From dbb941e227a7e628737d26edfc2277a789be7929 Mon Sep 17 00:00:00 2001 From: Barton Chittenden Date: Sat, 27 Aug 2016 17:33:06 +0000 Subject: [PATCH] Bug 12374: Add koha-mqsqldump script, analagous to koha-mysql Includes documentation, koha-common.install entry, and bash completion. --- debian/docs/koha-common.xml | 8 +++++ debian/docs/koha-mysql.xml | 1 + debian/docs/koha-mysqldump.xml | 63 ++++++++++++++++++++++++++++++++++++ debian/koha-common.bash-completion | 3 +- debian/koha-common.install | 1 + debian/scripts/koha-mysqldump | 59 +++++++++++++++++++++++++++++++++ 6 files changed, 134 insertions(+), 1 deletion(-) create mode 100644 debian/docs/koha-mysqldump.xml create mode 100755 debian/scripts/koha-mysqldump diff --git a/debian/docs/koha-common.xml b/debian/docs/koha-common.xml index 2790341..6969764 100644 --- a/debian/docs/koha-common.xml +++ b/debian/docs/koha-common.xml @@ -113,6 +113,14 @@ + + + + + A wrapper for mysqldump for the specified koha instance. + + + Zebra-related diff --git a/debian/docs/koha-mysql.xml b/debian/docs/koha-mysql.xml index f0360be..84657bc 100644 --- a/debian/docs/koha-mysql.xml +++ b/debian/docs/koha-mysql.xml @@ -63,6 +63,7 @@ See also mysql (1) + koha-mysqlsump (1) koha-dump-defaults(8) koha-reset-passwd(8) koha-upgrade-schema(8) diff --git a/debian/docs/koha-mysqldump.xml b/debian/docs/koha-mysqldump.xml new file mode 100644 index 0000000..189b5ea --- /dev/null +++ b/debian/docs/koha-mysqldump.xml @@ -0,0 +1,63 @@ +
+koha-mysqldump + +Koha is the first free software library automation package. + + The Koha Community + http://koha-community.org/ + + + + + + + koha-mysqldump + 8 + + + + koha-mysqldump + Provide a flexible database dumper for the specified koha instance. + UNIX/Linux + + + + + koha-mysqldump instancename mysqldump option + + + + Description + A wrapper for mysqldump for the specified koha instance. + + + Example usage + + + Dump the database associated with a given instance. SQL output goes to STDOUT. + + koha-mysqldump instancename + + + + Dump data from TABLENAME matching the where clause, redirect output to a file + + koha-mysqldump instancename TABLENAME --where "SOME SQL QUERY" < TABLENAME.sql + + + + + + See also + + mysqldump (1) + koha-mysql (1) + koha-dump-defaults(8) + koha-reset-passwd(8) + koha-upgrade-schema(8) + + + + + +
diff --git a/debian/koha-common.bash-completion b/debian/koha-common.bash-completion index 637a56b..2e53791 100644 --- a/debian/koha-common.bash-completion +++ b/debian/koha-common.bash-completion @@ -135,8 +135,9 @@ complete -F _koha_enabled_instances koha-start-zebra complete -F _koha_enabled_instances koha-restart-zebra complete -F _koha_enabled_instances koha-stop-zebra -# koha-mysql autocompletes with a single instance name +# koha-mysql* autocompletes with a single instance name complete -F _koha_single_instance koha-mysql +complete -F _koha_single_instance koha-mysqldump _koha_list() { diff --git a/debian/koha-common.install b/debian/koha-common.install index 270a54a..b4214bd 100644 --- a/debian/koha-common.install +++ b/debian/koha-common.install @@ -20,6 +20,7 @@ debian/scripts/koha-foreach usr/sbin debian/scripts/koha-indexer usr/sbin debian/scripts/koha-list usr/sbin debian/scripts/koha-mysql usr/sbin +debian/scripts/koha-mysqldump usr/sbin debian/scripts/koha-passwd usr/sbin debian/scripts/koha-plack usr/sbin debian/scripts/koha-rebuild-zebra usr/sbin diff --git a/debian/scripts/koha-mysqldump b/debian/scripts/koha-mysqldump new file mode 100755 index 0000000..c2fed88 --- /dev/null +++ b/debian/scripts/koha-mysqldump @@ -0,0 +1,59 @@ +#!/bin/sh +# +# koha-mysqldump: run mysqldump on the database of the specified Koha instance. +# Copyright 2016 Barton Chittenden +# Based on koha-mysql, which is Copyright 2011 Catalyst IT, Ltd +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +set -e + +umask 0077 + +# 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 + +usage() +{ + local scriptname=$0 + cat <