From 48bd536b997c27a5047faf3a14e4945875fccb1e Mon Sep 17 00:00:00 2001 From: Magnus Enger Date: Mon, 18 Jul 2011 15:35:27 +0200 Subject: [PATCH 2/2] Bug 6540 - Followup patch adding command line options This adds the --marcflavor and --zebralang commandline options, as well as short versions of all options. --- debian/scripts/koha-create | 36 +++++++++++++++++++++++------------- 1 files changed, 23 insertions(+), 13 deletions(-) diff --git a/debian/scripts/koha-create b/debian/scripts/koha-create index c3bd465..08f4baf 100755 --- a/debian/scripts/koha-create +++ b/debian/scripts/koha-create @@ -19,13 +19,11 @@ set -e - die() { echo "$@" 1>&2 exit 1 } - generate_config_file() { touch "$2" chown "root:$username" "$2" @@ -60,7 +58,6 @@ getinstancemysqlpassword() { "/etc/koha/sites/$1/koha-conf.xml" } - # Set defaults and read config file, if it exists. DOMAIN="" INTRAPORT="8080" @@ -74,18 +71,31 @@ then . /etc/koha/koha-sites.conf fi +[ $# -ge 2 ] && [ $# -le 6 ] || + die "Usage: $0 [--create-db|--request-db|--populate-db] \ +[--marcflavor marc21|normarc|unimarc] \ +[--zebralang en|fr|nb] instancename" + +TEMP=`getopt -o crpm:l: -l create-db,request-db,populate-db,marcflavor:,zebralang: \ + -n "$0" -- "$@"` + +# Note the quotes around `$TEMP': they are essential! +eval set -- "$TEMP" + +while true ; do + case "$1" in + -c|--create-db) op=create ; shift ;; + -r|--request-db) op=request ; shift ;; + -p|--populate-db) op=populate ; shift ;; + -m|--marcflavor) ZEBRA_MARC_FORMAT="$2" ; shift 2 ;; + -l|--zebralang) ZEBRA_LANGUAGE="$2" ; shift 2 ;; + --) shift ; break ;; + *) die "Internal error! " ;; + esac +done -# Parse command line. -[ "$#" = 2 ] || - die "Usage: $0 [--create-db|--request-db|--populate-db] instancename" -case "$1" in - --create-db) op=create ;; - --request-db) op=request ;; - --populate-db) op=populate ;; - *) die "Usage: $0 [--create-db|--request-db|--populate-db] instancename" ;; -esac +name="$1" -name="$2" domain="$name$DOMAIN" if [ "$INTRAPORT" = 80 ] || [ "$INTRAPORT" = "" ] then -- 1.7.4.1