Bugzilla – Attachment 105899 Details for
Bug 23141
The Debian scripts do not use the MySQL port number
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23141: Add option to select db credentials source when populating db.
Bug-23141-Add-option-to-select-db-credentials-sour.patch (text/plain), 4.46 KB, created by
Jonathan Druart
on 2020-06-16 10:08:11 UTC
(
hide
)
Description:
Bug 23141: Add option to select db credentials source when populating db.
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-06-16 10:08:11 UTC
Size:
4.46 KB
patch
obsolete
>From e46041d95f5b053e08007460a0f68e5d27fb239c Mon Sep 17 00:00:00 2001 >From: Andreas Jonsson <andreas.jonsson@kreablo.se> >Date: Thu, 4 Jul 2019 18:49:18 +0200 >Subject: [PATCH] Bug 23141: Add option to select db credentials source when > populating db. > >--- > debian/scripts/koha-create | 29 ++++++++++++++++++++--------- > 1 file changed, 20 insertions(+), 9 deletions(-) > >diff --git a/debian/scripts/koha-create b/debian/scripts/koha-create >index b670610c56..6bb01c0f26 100755 >--- a/debian/scripts/koha-create >+++ b/debian/scripts/koha-create >@@ -69,6 +69,8 @@ Options: > --database dbname Enforce the use of the specified DB name (64 char limit) > --adminuser n Explicit the admin user ID in the DB. Relevant in > conjunction with --defaultsql and --populate-db. >+ --defaultsql-creds src Which source should be used for database credentials to use >+ when populating the database with --defaultsql. (default|instance) > --template-cache-dir Set a user defined template_cache_dir. It defaults to > /var/cache/koha/<instance>/templates > --timezone time/zone Specify a timezone. e.g. America/Argentina >@@ -397,7 +399,7 @@ fi > > [ $# -ge 1 ] && [ $# -le 16 ] || ( usage ; die "Error: wrong parameters" ) > >-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:,elasticsearch-server:,adminuser:,memcached-servers:,memcached-prefix:,template-cache-dir:,timezone:,upload-path:,tmp-path:,letsencrypt, \ >+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:,elasticsearch-server:,adminuser:,memcached-servers:,memcached-prefix:,template-cache-dir:,timezone:,upload-path:,tmp-path:,letsencrypt, \ > -n "$0" -- "$@"` > > # Note the quotes around `$TEMP': they are essential! >@@ -416,6 +418,7 @@ CLO_TMP_PATH="" > CLO_LETSENCRYPT="" > CLO_TEMPLATE_CACHE_DIR="" > CLO_TIMEZONE="" >+CLO_DEFAULTSQL_CREDS="" > > while true ; do > case "$1" in >@@ -439,6 +442,8 @@ while true ; do > CLO_ZEBRA_LANGUAGE="$2" ; shift 2 ;; > -d|--defaultsql) > CLO_DEFAULTSQL="$2" ; shift 2 ;; >+ --defaultsql-creds) >+ CLO_DEFAULTSQL_CREDS="$2" ; shift 2 ;; > -f|--configfile) > configfile="$2" ; shift 2 ;; > -s|--passwdfile) >@@ -498,6 +503,12 @@ if [ "$CLO_DEFAULTSQL" != "" ] > then > DEFAULTSQL="$CLO_DEFAULTSQL" > fi >+if [ "$CLO_DEFAULTSQL_CREDS" != "" ] >+then >+ DEFAULTSQL_CREDS="$CLO_DEFAULTSQL_CREDS" >+else >+ DEFAULTSQL_CREDS="default" >+fi > if [ "$CLO_ADMINUSER" != "" ] > then > ADMINUSER="$CLO_ADMINUSER" >@@ -579,6 +590,7 @@ then > mysqlpwd=`echo $passwdline | cut -d ":" -f 3` > mysqldb=`echo $passwdline | cut -d ":" -f 4` > mysqlhost=`echo $passwdline | cut -d ":" -f 5` >+ mysqlport=`echo $passwdline | cut -d ":" -f 6` > fi > > # The order of precedence for MySQL database name is: >@@ -725,18 +737,18 @@ fi > > if [ "$op" = create ] || [ "$op" = populate ] > then >- # Re-fetch the passwords from the config we've generated, allows it >- # to be different from what we set, in case the user had to change >- # something. >- mysqluser=$(getinstancemysqluser $name) >- mysqldb=$(getinstancemysqldatabase $name) > # Use the default database content if that exists. > if [ -e "$DEFAULTSQL" ] > then >+ if [ "$DEFAULTSQL_CREDS" = "instance" ] ; then >+ mysqlcmd="koha-mysql $(printf %q $name)" >+ else >+ mysqlcmd="mysql --host=$(printf %q $mysqlhost) --user=$(printf %q $mysqluser) --port=$(printf %q $mysqlport) --password=$(printf %q $mysqlpwd) $(printf %q $mysqldb)" >+ fi > # Populate the database with default content. > zcat -f "$DEFAULTSQL" | > sed "s/__KOHASITE__/koha_$name/g" | >- mysql --host="$mysqlhost" --user="$mysqluser" --password="$mysqlpwd" "$mysqldb" >+ $mysqlcmd > > > # Change the default user's password. >@@ -745,8 +757,7 @@ then > perl -e ' > use Digest::MD5 qw(md5_base64); > while (<>) { print md5_base64($_), "\n"; }') >- mysql --host="$mysqlhost" --user="$mysqluser" \ >---password="$mysqlpwd" <<eof >+ $mysqlcmd <<eof > USE \`$mysqldb\`; > UPDATE borrowers > SET password = '$staffdigest' >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 23141
:
90687
|
90688
|
90689
|
91291
|
91292
|
91300
|
91408
|
105895
|
105896
|
105897
|
105898
|
105899
|
113605
|
113606
|
113607
|
113608
|
113609