Lines 23-28
usage="Usage: $0 [--create-db|--request-db|--populate-db|--use-db] \
Link Here
|
23 |
[--marcflavor marc21|normarc|unimarc] \ |
23 |
[--marcflavor marc21|normarc|unimarc] \ |
24 |
[--zebralang en|es|fr|nb|ru|uk] \ |
24 |
[--zebralang en|es|fr|nb|ru|uk] \ |
25 |
[--auth-idx dom|grs1] [--biblio-idx dom|grs1] \ |
25 |
[--auth-idx dom|grs1] [--biblio-idx dom|grs1] \ |
|
|
26 |
[--use-memcached] \ |
27 |
[--memcached-servers server:port] [--memcached-prefix prefix] \ |
26 |
[--defaultsql /path/to/some.sql] \ |
28 |
[--defaultsql /path/to/some.sql] \ |
27 |
[--configfile /path/to/config] [--passwdfile /path/to/passwd] \ |
29 |
[--configfile /path/to/config] [--passwdfile /path/to/passwd] \ |
28 |
[--database database] [--adminuser n] instancename" |
30 |
[--database database] [--adminuser n] instancename" |
Lines 61-66
generate_config_file() {
Link Here
|
61 |
-e "s/__UNIXUSER__/$username/g" \ |
63 |
-e "s/__UNIXUSER__/$username/g" \ |
62 |
-e "s/__UNIXGROUP__/$username/g" \ |
64 |
-e "s/__UNIXGROUP__/$username/g" \ |
63 |
-e "s/__PLUGINS_DIR__/\/var\/lib\/koha\/$name\/plugins/g" \ |
65 |
-e "s/__PLUGINS_DIR__/\/var\/lib\/koha\/$name\/plugins/g" \ |
|
|
66 |
-e "s/__MEMCACHED_NAMESPACE__/$MEMCACHED_NAMESPACE/g" \ |
67 |
-e "s/__MEMCACHED_SERVERS__/$MEMCACHED_SERVERS/g" \ |
64 |
"/etc/koha/$1" > "$2" |
68 |
"/etc/koha/$1" > "$2" |
65 |
|
69 |
|
66 |
} |
70 |
} |
Lines 154-159
EOF`
Link Here
|
154 |
esac |
158 |
esac |
155 |
} |
159 |
} |
156 |
|
160 |
|
|
|
161 |
|
162 |
set_memcached() |
163 |
{ |
164 |
local instance="$1" |
165 |
|
166 |
if [ "$CLO_MEMCACHED_SERVERS" != "" ]; then |
167 |
MEMCACHED_SERVERS=$CLO_MEMCACHED_SERVERS |
168 |
else |
169 |
if [ "$MEMCACHED_SERVERS" = "" ]; then |
170 |
MEMCACHED_SERVERS=$DEFAULT_MEMCACHED_SERVERS |
171 |
# else: was set by the koha-sites.conf file |
172 |
fi |
173 |
fi |
174 |
|
175 |
if [ "$CLO_MEMCACHED_PREFIX" != "" ]; then |
176 |
MEMCACHED_NAMESPACE="$CLO_MEMCACHED_PREFIX$instance" |
177 |
else |
178 |
if [ "$MEMCACHED_PREFIX" != "" ]; then |
179 |
MEMCACHED_NAMESPACE="$MEMCACHED_PREFIX$instance" |
180 |
else |
181 |
MEMCACHED_NAMESPACE="$DEFAULT_MEMCACHED_PREFIX$instance" |
182 |
fi |
183 |
fi |
184 |
|
185 |
} |
186 |
|
157 |
# Set defaults and read config file, if it exists. |
187 |
# Set defaults and read config file, if it exists. |
158 |
DOMAIN="" |
188 |
DOMAIN="" |
159 |
OPACPORT="80" |
189 |
OPACPORT="80" |
Lines 168-173
ZEBRA_LANGUAGE="en"
Link Here
|
168 |
ADMINUSER="1" |
198 |
ADMINUSER="1" |
169 |
PASSWDFILE="/etc/koha/passwd" |
199 |
PASSWDFILE="/etc/koha/passwd" |
170 |
|
200 |
|
|
|
201 |
# memcached variables |
202 |
USE_MEMCACHED="no" |
203 |
MEMCACHED_SERVERS="" |
204 |
MEMCACHED_PREFIX="" |
205 |
# hardcoded memcached defaults |
206 |
DEFAULT_MEMCACHED_SERVERS="127.0.0.1:11211" |
207 |
DEFAULT_MEMCACHED_PREFIX="koha_" |
208 |
|
171 |
# Indexing mode variables (default is DOM) |
209 |
# Indexing mode variables (default is DOM) |
172 |
BIBLIOS_INDEXING_MODE="dom" |
210 |
BIBLIOS_INDEXING_MODE="dom" |
173 |
AUTHORITIES_INDEXING_MODE="dom" |
211 |
AUTHORITIES_INDEXING_MODE="dom" |
Lines 184-190
fi
Link Here
|
184 |
|
222 |
|
185 |
[ $# -ge 2 ] && [ $# -le 16 ] || die $usage |
223 |
[ $# -ge 2 ] && [ $# -le 16 ] || die $usage |
186 |
|
224 |
|
187 |
TEMP=`getopt -o crpm:l:d:f:b:a: -l create-db,request-db,populate-db,use-db,marcflavor:,auth-idx:,biblio-idx:,zebralang:,defaultsql:,configfile:,passwdfile:,database:,adminuser: \ |
225 |
TEMP=`getopt -o crpm:l:d:f:b:a: -l create-db,request-db,populate-db,use-db,use-memcached,marcflavor:,auth-idx:,biblio-idx:,zebralang:,defaultsql:,configfile:,passwdfile:,database:,adminuser:,memcached-servers:,memcached-prefix:, \ |
188 |
-n "$0" -- "$@"` |
226 |
-n "$0" -- "$@"` |
189 |
|
227 |
|
190 |
# Note the quotes around `$TEMP': they are essential! |
228 |
# Note the quotes around `$TEMP': they are essential! |
Lines 197-222
CLO_DEFAULTSQL=""
Link Here
|
197 |
CLO_ADMINUSER="" |
235 |
CLO_ADMINUSER="" |
198 |
CLO_BIBLIOS_INDEXING_MODE="" |
236 |
CLO_BIBLIOS_INDEXING_MODE="" |
199 |
CLO_AUTHORITIES_INDEXING_MODE="" |
237 |
CLO_AUTHORITIES_INDEXING_MODE="" |
|
|
238 |
CLO_MEMCACHED_SERVERS="" |
239 |
CLO_MEMCACHED_PREFIX="" |
200 |
|
240 |
|
201 |
|
241 |
|
202 |
while true ; do |
242 |
while true ; do |
203 |
case "$1" in |
243 |
case "$1" in |
204 |
-c|--create-db) op=create ; shift ;; |
244 |
-c|--create-db) |
205 |
-r|--request-db) op=request ; shift ;; |
245 |
op=create ; shift ;; |
206 |
-p|--populate-db) op=populate ; shift ;; |
246 |
-r|--request-db) |
207 |
-u|--use-db) op=use ; shift ;; |
247 |
op=request ; shift ;; |
208 |
-m|--marcflavor) CLO_ZEBRA_MARC_FORMAT="$2" ; shift 2 ;; |
248 |
-p|--populate-db) |
209 |
-l|--zebralang) CLO_ZEBRA_LANGUAGE="$2" ; shift 2 ;; |
249 |
op=populate ; shift ;; |
210 |
--auth-idx) CLO_AUTHORITIES_INDEXING_MODE="$2" ; shift 2 ;; |
250 |
-u|--use-db) |
211 |
--biblio-idx) CLO_BIBLIOS_INDEXING_MODE="$2" ; shift 2 ;; |
251 |
op=use ; shift ;; |
212 |
-d|--defaultsql) CLO_DEFAULTSQL="$2" ; shift 2 ;; |
252 |
--use-memcached) |
213 |
-f|--configfile) configfile="$2" ; shift 2 ;; |
253 |
USE_MEMCACHED="yes" ; shift ;; |
214 |
-s|--passwdfile) CLO_PASSWDFILE="$2" ; shift 2 ;; |
254 |
--memcached-servers) |
215 |
-b|--database) CLO_DATABASE="$2" ; shift 2 ;; |
255 |
CLO_MEMCACHED_SERVERS="$2" ; shift 2 ;; |
216 |
-a|--adminuser) CLO_ADMINUSER="$2" ; shift 2 ;; |
256 |
--memcached-prefix) |
217 |
--) shift ; break ;; |
257 |
CLO_MEMCACHED_PREFIX="$2" ; shift 2;; |
218 |
*) die "Internal error processing command line arguments" ;; |
258 |
-m|--marcflavor) |
219 |
esac |
259 |
CLO_ZEBRA_MARC_FORMAT="$2" ; shift 2 ;; |
|
|
260 |
-l|--zebralang) |
261 |
CLO_ZEBRA_LANGUAGE="$2" ; shift 2 ;; |
262 |
--auth-idx) |
263 |
CLO_AUTHORITIES_INDEXING_MODE="$2" ; shift 2 ;; |
264 |
--biblio-idx) |
265 |
CLO_BIBLIOS_INDEXING_MODE="$2" ; shift 2 ;; |
266 |
-d|--defaultsql) |
267 |
CLO_DEFAULTSQL="$2" ; shift 2 ;; |
268 |
-f|--configfile) |
269 |
configfile="$2" ; shift 2 ;; |
270 |
-s|--passwdfile) |
271 |
CLO_PASSWDFILE="$2" ; shift 2 ;; |
272 |
-b|--database) |
273 |
CLO_DATABASE="$2" ; shift 2 ;; |
274 |
-a|--adminuser) |
275 |
CLO_ADMINUSER="$2" ; shift 2 ;; |
276 |
--) |
277 |
shift ; break ;; |
278 |
*) |
279 |
die "Internal error processing command line arguments" ;; |
280 |
esac |
220 |
done |
281 |
done |
221 |
|
282 |
|
222 |
# Load the configfile given on the command line |
283 |
# Load the configfile given on the command line |
Lines 267-272
set_authorities_indexing_mode $AUTHORITIES_INDEXING_MODE $ZEBRA_MARC_FORMAT
Link Here
|
267 |
|
328 |
|
268 |
name="$1" |
329 |
name="$1" |
269 |
|
330 |
|
|
|
331 |
if [ "$USE_MEMCACHED" = "yes" ]; then |
332 |
set_memcached $name |
333 |
elif [ "$CLO_MEMCACHED_SERVERS" != "" ] || \ |
334 |
[ "$CLO_MEMCACHED_PREFIX" != "" ]; then |
335 |
|
336 |
MSG=`cat <<EOF |
337 |
|
338 |
Error: you provided memcached configuration switches but memcached is not enabled. |
339 |
Please set USE_MEMCACHED="yes" on /etc/koha/koha-sites.conf or use the |
340 |
--use-memcached optio switch to enable it. |
341 |
|
342 |
EOF` |
343 |
|
344 |
echo $usage |
345 |
die $MSG |
346 |
fi |
347 |
|
270 |
opacdomain="$OPACPREFIX$name$OPACSUFFIX$DOMAIN" |
348 |
opacdomain="$OPACPREFIX$name$OPACSUFFIX$DOMAIN" |
271 |
intradomain="$INTRAPREFIX$name$INTRASUFFIX$DOMAIN" |
349 |
intradomain="$INTRAPREFIX$name$INTRASUFFIX$DOMAIN" |
272 |
|
350 |
|