Module: kamailio
Branch: master
Commit: 782c3259a7afd0a0ea462a8ee17b95eacbfe3c81
URL:
https://github.com/kamailio/kamailio/commit/782c3259a7afd0a0ea462a8ee17b95e…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2019-10-23T08:47:19+02:00
kamdbctl: new option DBINITASK to control the steps for db init
- if set DBINITASK=yes, then each step requires confirmation (e.g.,
database creation, users creation, standard tables creation)
- can be useful when needing to run only some of the steps
---
Modified: utils/kamctl/kamctlrc
Modified: utils/kamctl/kamdbctl.mysql
---
Diff:
https://github.com/kamailio/kamailio/commit/782c3259a7afd0a0ea462a8ee17b95e…
Patch:
https://github.com/kamailio/kamailio/commit/782c3259a7afd0a0ea462a8ee17b95e…
---
diff --git a/utils/kamctl/kamctlrc b/utils/kamctl/kamctlrc
index 5306a6116d..a49c79f2ec 100644
--- a/utils/kamctl/kamctlrc
+++ b/utils/kamctl/kamctlrc
@@ -52,6 +52,9 @@
## - known to work for: mysql
# DBROOTPW="dbrootpw"
+## option to ask confirmation for all database creation steps
+# DBINITASK=yes
+
## database character set (used by MySQL when creating database)
#CHARSET="latin1"
diff --git a/utils/kamctl/kamdbctl.mysql b/utils/kamctl/kamdbctl.mysql
index e8f8d2e861..bdb8b98ab4 100644
--- a/utils/kamctl/kamdbctl.mysql
+++ b/utils/kamctl/kamdbctl.mysql
@@ -238,24 +238,45 @@ kamailio_create () # pars: <database name>
exit 1
fi
- kamailio_db_create $1
+ if [ "$DBINITASK" = "yes" ]; then
+ get_answer "ask" "Create the database '$1'? (y/n): "
+ else
+ ANSWER="y"
+ fi
+ if [ "$ANSWER" = "y" ]; then
+ kamailio_db_create $1
+ fi
- kamailio_db_grant $1
+ if [ "$DBINITASK" = "yes" ]; then
+ get_answer "ask" "Create database users with access privileges? (y/n):
"
+ else
+ ANSWER="y"
+ fi
+ if [ "$ANSWER" = "y" ]; then
+ kamailio_db_grant $1
+ fi
- standard_create $1
+ if [ "$DBINITASK" = "yes" ]; then
+ get_answer "ask" "Create the standard database tables? (y/n): "
+ else
+ ANSWER="y"
+ fi
+ if [ "$ANSWER" = "y" ]; then
+ standard_create $1
+ fi
- get_answer $INSTALL_PRESENCE_TABLES "Install presence related tables? (y/n):
"
+ get_answer $INSTALL_PRESENCE_TABLES "Create the presence related tables? (y/n):
"
if [ "$ANSWER" = "y" ]; then
presence_create $1
fi
- get_answer $INSTALL_EXTRA_TABLES "Install tables for $EXTRA_MODULES? (y/n): "
+ get_answer $INSTALL_EXTRA_TABLES "Create the tables for $EXTRA_MODULES? (y/n):
"
if [ "$ANSWER" = "y" ]; then
HAS_EXTRA="yes"
extra_create $1
fi
- get_answer $INSTALL_DBUID_TABLES "Install tables for $DBUID_MODULES? (y/n): "
+ get_answer $INSTALL_DBUID_TABLES "Create the tables for $DBUID_MODULES? (y/n):
"
if [ "$ANSWER" = "y" ]; then
HAS_EXTRA="yes"
dbuid_create $1