Bug 6913: More options for koha-create and koha-remove
[koha-ffzg.git] / debian / scripts / koha-remove
index b9e5c2a..09720ea 100755 (executable)
 
 set -e
 
+args=$(getopt -l keep-mysql -o k -n $0 -- "$@")
+set -- $args
+while [ ! -z "$1" ]
+do
+    case "$1" in
+         -k|--keep-mysql) keepmysql=1; exit;;
+          *) break;;
+    esac
+    shift
+done
+
 
 for name in "$@"
 do
     echo "Removing Koha instance $name"
 
-    mysql --defaults-extra-file=/etc/mysql/koha-common.cnf <<eof
+    if [ "$keepmysql" != "1" ]
+    then
+        mysql --defaults-extra-file=/etc/mysql/koha-common.cnf <<eof
 DROP USER \`koha_$name\`;
 DROP DATABASE \`koha_$name\`;
 FLUSH PRIVILEGES;
 eof
+    fi #`
     
     koha-stop-zebra $name
     [ -f "/etc/apache2/sites-available/$name" ]  && \