View | Details | Raw Unified | Return to bug 6540
Collapse All | Expand All

(-)a/debian/scripts/koha-create (-10 / +39 lines)
Lines 19-24 Link Here
19
19
20
set -e
20
set -e
21
21
22
usage="Usage: $0 [--create-db|--request-db|--populate-db] \
23
[--marcflavor marc21|normarc|unimarc] \
24
[--zebralang en|fr|nb] [--defaultsql /path/to/some.sql] 
25
[--configfile /path/to/config] instancename"
26
22
die() {
27
die() {
23
    echo "$@" 1>&2
28
    echo "$@" 1>&2
24
    exit 1
29
    exit 1
Lines 71-100 then Link Here
71
    . /etc/koha/koha-sites.conf
76
    . /etc/koha/koha-sites.conf
72
fi
77
fi
73
78
74
[ $# -ge 2 ] && [ $# -le 6 ] || 
79
[ $# -ge 2 ] && [ $# -le 10 ] || die $usage
75
    die "Usage: $0 [--create-db|--request-db|--populate-db] \
76
[--marcflavor marc21|normarc|unimarc] \
77
[--zebralang en|fr|nb] instancename"
78
80
79
TEMP=`getopt -o crpm:l: -l create-db,request-db,populate-db,marcflavor:,zebralang: \
81
TEMP=`getopt -o crpm:l: -l create-db,request-db,populate-db,marcflavor:,zebralang:,configfile: \
80
     -n "$0" -- "$@"`
82
     -n "$0" -- "$@"`
81
83
82
# Note the quotes around `$TEMP': they are essential!
84
# Note the quotes around `$TEMP': they are essential!
83
eval set -- "$TEMP"
85
eval set -- "$TEMP"
84
86
87
# Temporary variables for the command line options
88
CLO_ZEBRA_MARC_FORMAT=""
89
CLO_ZEBRA_LANGUAGE=""
90
CLO_DEFAULTSQL=""
91
85
while true ; do
92
while true ; do
86
	case "$1" in
93
	case "$1" in
87
		-c|--create-db) op=create ; shift ;;
94
		-c|--create-db) op=create ; shift ;;
88
		-r|--request-db) op=request ; shift ;;
95
		-r|--request-db) op=request ; shift ;;
89
		-p|--populate-db) op=populate ; shift ;;
96
		-p|--populate-db) op=populate ; shift ;;
90
		-m|--marcflavor) ZEBRA_MARC_FORMAT="$2" ; shift 2 ;;
97
		-m|--marcflavor) CLO_ZEBRA_MARC_FORMAT="$2" ; shift 2 ;;
91
		-l|--zebralang) ZEBRA_LANGUAGE="$2" ; shift 2 ;;
98
		-l|--zebralang) CLO_ZEBRA_LANGUAGE="$2" ; shift 2 ;;
92
		-d|--defaultsql) DEFAULTSQL="$2" ; shift 2 ;;
99
		-d|--defaultsql) CLO_DEFAULTSQL="$2" ; shift 2 ;;
100
		-f|--configfile) configfile="$2" ; shift 2 ;;
93
		--) shift ; break ;;
101
		--) shift ; break ;;
94
		*) die "Internal error! " ;;
102
		*) die $usage ;;
95
	esac
103
	esac
96
done
104
done
97
105
106
# Load the configfile given on the command line
107
if [ -e "$configfile" ]
108
then
109
    . "$configfile"
110
else
111
    die "$configfile does not exist.";
112
fi
113
114
# Make sure options from the command line get the highest precedence
115
if [ "$CLO_ZEBRA_MARC_FORMAT" != "" ]
116
then
117
    ZEBRA_MARC_FORMAT="$CLO_ZEBRA_MARC_FORMAT"
118
fi
119
if [ "$CLO_ZEBRA_LANGUAGE" != "" ]
120
then
121
    ZEBRA_LANGUAGE="$CLO_ZEBRA_LANGUAGE"
122
fi
123
if [ "$CLO_DEFAULTSQL" != "" ]
124
then
125
    DEFAULTSQL="$CLO_DEFAULTSQL"
126
fi
127
98
name="$1"
128
name="$1"
99
129
100
domain="$name$DOMAIN"
130
domain="$name$DOMAIN"
101
- 

Return to bug 6540