|
Lines 66-71
Options:
Link Here
|
| 66 |
--database dbname Enforce the use of the specified DB name (64 char limit) |
66 |
--database dbname Enforce the use of the specified DB name (64 char limit) |
| 67 |
--adminuser n Explicit the admin user ID in the DB. Relevant in |
67 |
--adminuser n Explicit the admin user ID in the DB. Relevant in |
| 68 |
conjunction with --defaultsql and --populate-db. |
68 |
conjunction with --defaultsql and --populate-db. |
|
|
69 |
--defaultsql-creds src Which source should be used for database credentials to use |
| 70 |
when populating the database with --defaultsql. (default|instance) |
| 69 |
--template-cache-dir Set a user defined template_cache_dir. It defaults to |
71 |
--template-cache-dir Set a user defined template_cache_dir. It defaults to |
| 70 |
/var/cache/koha/<instance>/templates |
72 |
/var/cache/koha/<instance>/templates |
| 71 |
--timezone time/zone Specify a timezone. e.g. America/Argentina |
73 |
--timezone time/zone Specify a timezone. e.g. America/Argentina |
|
Lines 391-397
fi
Link Here
|
| 391 |
|
393 |
|
| 392 |
[ $# -ge 1 ] && [ $# -le 16 ] || ( usage ; die "Error: wrong parameters" ) |
394 |
[ $# -ge 1 ] && [ $# -le 16 ] || ( usage ; die "Error: wrong parameters" ) |
| 393 |
|
395 |
|
| 394 |
TEMP=`getopt -o chrpm:l:d:f:b:a: -l create-db,request-db,populate-db,use-db,enable-sru,sru-port:,help,marcflavor:,auth-idx:,biblio-idx:,zebralang:,defaultsql:,configfile:,passwdfile:,dbhost:,dbport:,database:,adminuser:,memcached-servers:,memcached-prefix:,template-cache-dir:,timezone:,upload-path:,tmp-path:,letsencrypt, \ |
396 |
TEMP=`getopt -o chrpm:l:d:f:b:a: -l create-db,request-db,populate-db,use-db,enable-sru,sru-port:,help,marcflavor:,auth-idx:,biblio-idx:,zebralang:,defaultsql:,defaultsql-creds:,configfile:,passwdfile:,dbhost:,dbport:,database:,adminuser:,memcached-servers:,memcached-prefix:,template-cache-dir:,timezone:,upload-path:,tmp-path:,letsencrypt, \ |
| 395 |
-n "$0" -- "$@"` |
397 |
-n "$0" -- "$@"` |
| 396 |
|
398 |
|
| 397 |
# Note the quotes around `$TEMP': they are essential! |
399 |
# Note the quotes around `$TEMP': they are essential! |
|
Lines 409-414
CLO_TMP_PATH=""
Link Here
|
| 409 |
CLO_LETSENCRYPT="" |
411 |
CLO_LETSENCRYPT="" |
| 410 |
CLO_TEMPLATE_CACHE_DIR="" |
412 |
CLO_TEMPLATE_CACHE_DIR="" |
| 411 |
CLO_TIMEZONE="" |
413 |
CLO_TIMEZONE="" |
|
|
414 |
CLO_DEFAULTSQL_CREDS="" |
| 412 |
|
415 |
|
| 413 |
while true ; do |
416 |
while true ; do |
| 414 |
case "$1" in |
417 |
case "$1" in |
|
Lines 430-435
while true ; do
Link Here
|
| 430 |
CLO_ZEBRA_LANGUAGE="$2" ; shift 2 ;; |
433 |
CLO_ZEBRA_LANGUAGE="$2" ; shift 2 ;; |
| 431 |
-d|--defaultsql) |
434 |
-d|--defaultsql) |
| 432 |
CLO_DEFAULTSQL="$2" ; shift 2 ;; |
435 |
CLO_DEFAULTSQL="$2" ; shift 2 ;; |
|
|
436 |
--defaultsql-creds) |
| 437 |
CLO_DEFAULTSQL_CREDS="$2" ; shift 2 ;; |
| 433 |
-f|--configfile) |
438 |
-f|--configfile) |
| 434 |
configfile="$2" ; shift 2 ;; |
439 |
configfile="$2" ; shift 2 ;; |
| 435 |
-s|--passwdfile) |
440 |
-s|--passwdfile) |
|
Lines 489-494
if [ "$CLO_DEFAULTSQL" != "" ]
Link Here
|
| 489 |
then |
494 |
then |
| 490 |
DEFAULTSQL="$CLO_DEFAULTSQL" |
495 |
DEFAULTSQL="$CLO_DEFAULTSQL" |
| 491 |
fi |
496 |
fi |
|
|
497 |
if [ "$CLO_DEFAULTSQL_CREDS" != "" ] |
| 498 |
then |
| 499 |
DEFAULTSQL_CREDS="$CLO_DEFAULTSQL_CREDS" |
| 500 |
else |
| 501 |
DEFAULTSQL_CREDS="default" |
| 502 |
fi |
| 492 |
if [ "$CLO_ADMINUSER" != "" ] |
503 |
if [ "$CLO_ADMINUSER" != "" ] |
| 493 |
then |
504 |
then |
| 494 |
ADMINUSER="$CLO_ADMINUSER" |
505 |
ADMINUSER="$CLO_ADMINUSER" |
|
Lines 566-571
then
Link Here
|
| 566 |
mysqlpwd=`echo $passwdline | cut -d ":" -f 3` |
577 |
mysqlpwd=`echo $passwdline | cut -d ":" -f 3` |
| 567 |
mysqldb=`echo $passwdline | cut -d ":" -f 4` |
578 |
mysqldb=`echo $passwdline | cut -d ":" -f 4` |
| 568 |
mysqlhost=`echo $passwdline | cut -d ":" -f 5` |
579 |
mysqlhost=`echo $passwdline | cut -d ":" -f 5` |
|
|
580 |
mysqlport=`echo $passwdline | cut -d ":" -f 6` |
| 569 |
fi |
581 |
fi |
| 570 |
|
582 |
|
| 571 |
# The order of precedence for MySQL database name is: |
583 |
# The order of precedence for MySQL database name is: |
|
Lines 711-728
fi
Link Here
|
| 711 |
|
723 |
|
| 712 |
if [ "$op" = create ] || [ "$op" = populate ] |
724 |
if [ "$op" = create ] || [ "$op" = populate ] |
| 713 |
then |
725 |
then |
| 714 |
# Re-fetch the passwords from the config we've generated, allows it |
|
|
| 715 |
# to be different from what we set, in case the user had to change |
| 716 |
# something. |
| 717 |
mysqluser=$(getinstancemysqluser $name) |
| 718 |
mysqldb=$(getinstancemysqldatabase $name) |
| 719 |
# Use the default database content if that exists. |
726 |
# Use the default database content if that exists. |
| 720 |
if [ -e "$DEFAULTSQL" ] |
727 |
if [ -e "$DEFAULTSQL" ] |
| 721 |
then |
728 |
then |
|
|
729 |
if [ "$DEFAULTSQL_CREDS" = "instance" ] ; then |
| 730 |
mysqlcmd="koha-mysql $name" |
| 731 |
else |
| 732 |
mysqlcmd="mysql --host=\"$mysqlhost\" --user=\"$mysqluser\" --port=\"$mysqlport\" --password=\"$mysqlpwd\" \"$mysqldb\"" |
| 733 |
fi |
| 722 |
# Populate the database with default content. |
734 |
# Populate the database with default content. |
| 723 |
zcat -f "$DEFAULTSQL" | |
735 |
zcat -f "$DEFAULTSQL" | |
| 724 |
sed "s/__KOHASITE__/koha_$name/g" | |
736 |
sed "s/__KOHASITE__/koha_$name/g" | |
| 725 |
mysql --host="$mysqlhost" --user="$mysqluser" --password="$mysqlpwd" "$mysqldb" |
737 |
$mysqlcmd |
| 726 |
|
738 |
|
| 727 |
|
739 |
|
| 728 |
# Change the default user's password. |
740 |
# Change the default user's password. |
|
Lines 731-738
then
Link Here
|
| 731 |
perl -e ' |
743 |
perl -e ' |
| 732 |
use Digest::MD5 qw(md5_base64); |
744 |
use Digest::MD5 qw(md5_base64); |
| 733 |
while (<>) { print md5_base64($_), "\n"; }') |
745 |
while (<>) { print md5_base64($_), "\n"; }') |
| 734 |
mysql --host="$mysqlhost" --user="$mysqluser" \ |
746 |
$mysqlcmd <<eof |
| 735 |
--password="$mysqlpwd" <<eof |
|
|
| 736 |
USE \`$mysqldb\`; |
747 |
USE \`$mysqldb\`; |
| 737 |
UPDATE borrowers |
748 |
UPDATE borrowers |
| 738 |
SET password = '$staffdigest' |
749 |
SET password = '$staffdigest' |
| 739 |
- |
|
|