+[ $# -ge 2 ] && [ $# -le 16 ] || die $usage
+
+TEMP=`getopt -o crpm:l:d:f:b:a: -l create-db,request-db,populate-db,use-db,marcflavor:,zebralang:,defaultsql:,configfile:,passwdfile:,database:,adminuser: \
+ -n "$0" -- "$@"`
+
+# Note the quotes around `$TEMP': they are essential!
+eval set -- "$TEMP"
+
+# Temporary variables for the command line options
+CLO_ZEBRA_MARC_FORMAT=""
+CLO_ZEBRA_LANGUAGE=""
+CLO_DEFAULTSQL=""
+CLO_ADMINUSER=""
+
+while true ; do
+ case "$1" in
+ -c|--create-db) op=create ; shift ;;
+ -r|--request-db) op=request ; shift ;;
+ -p|--populate-db) op=populate ; shift ;;
+ -u|--use-db) op=use ; shift ;;
+ -m|--marcflavor) CLO_ZEBRA_MARC_FORMAT="$2" ; shift 2 ;;
+ -l|--zebralang) CLO_ZEBRA_LANGUAGE="$2" ; shift 2 ;;
+ -d|--defaultsql) CLO_DEFAULTSQL="$2" ; shift 2 ;;
+ -f|--configfile) configfile="$2" ; shift 2 ;;
+ -s|--passwdfile) CLO_PASSWDFILE="$2" ; shift 2 ;;
+ -b|--database) CLO_DATABASE="$2" ; shift 2 ;;
+ -a|--adminuser) CLO_ADMINUSER="$2" ; shift 2 ;;
+ --) shift ; break ;;
+ *) die "Internal error processing command line arguments" ;;
+ esac
+done
+
+# Load the configfile given on the command line
+if [ "$configfile" != "" ]
+then
+ if [ -e "$configfile" ]
+ then
+ . "$configfile"
+ else
+ die "$configfile does not exist.";
+ fi
+fi
+
+# Make sure options from the command line get the highest precedence
+if [ "$CLO_ZEBRA_MARC_FORMAT" != "" ]
+then
+ ZEBRA_MARC_FORMAT="$CLO_ZEBRA_MARC_FORMAT"
+fi
+if [ "$CLO_ZEBRA_LANGUAGE" != "" ]
+then
+ ZEBRA_LANGUAGE="$CLO_ZEBRA_LANGUAGE"
+fi
+if [ "$CLO_DEFAULTSQL" != "" ]
+then
+ DEFAULTSQL="$CLO_DEFAULTSQL"
+fi
+if [ "$CLO_ADMINUSER" != "" ]
+then
+ ADMINUSER="$CLO_ADMINUSER"
+fi
+if [ "$CLO_PASSWDFILE" != "" ]
+then
+ PASSWDFILE="$CLO_PASSWDFILE"
+fi
+
+name="$1"
+
+opacdomain="$OPACPREFIX$name$OPACSUFFIX$DOMAIN"
+intradomain="$INTRAPREFIX$name$INTRASUFFIX$DOMAIN"