Bug 7924 - Fix handling of command line arguments in koha-remove

koha-remove would fail with a message like this:
Removing Koha instance --
ERROR 1396 (HY000) at line 1: Operation DROP USER failed for 'koha_--'@'%'

After fixing this, the --keep-mysql option made the script exit without doing
anything.

To test:

Alt 1
- Build package with build-git-snapshot
- Install package

Alt 2
- Replicate the changes in the patch in an existing installation

Then:
- Add instance1 and instance2
- koha-remove instance1
-- Check that script completes and the databse is gone
- koha-remove --keep-mysql instance2
-- Check that the script completes but the database is not removed

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
This commit is contained in:
Magnus Enger 2012-04-30 13:49:38 +02:00 committed by Chris Cormack
parent 7e8551cd9d
commit 72e85b40f1
1 changed files with 3 additions and 3 deletions

View File

@ -20,17 +20,17 @@
set -e
args=$(getopt -l keep-mysql -o k -n $0 -- "$@")
set -- $args
eval set -- $args
while [ ! -z "$1" ]
do
case "$1" in
-k|--keep-mysql) keepmysql=1; exit;;
-k|--keep-mysql) keepmysql=1; shift;;
--) shift; break;;
*) break;;
esac
shift
done
for name in "$@"
do
echo "Removing Koha instance $name"