Browse code

kamctl: update name to globalblocklist in EXTRA_TABLES

- GH #2773

Daniel-Constantin Mierla authored on 10/06/2021 10:15:29
Showing 1 changed files
... ...
@@ -40,7 +40,7 @@ STANDARD_TABLES=${STANDARD_TABLES:-'version acc dbaliases domain domain_attrs
40 40
 		acc_cdrs topos_d topos_t'}
41 41
 EXTRA_TABLES=${EXTRA_TABLES:-'imc_members imc_rooms cpl sip_trace domainpolicy
42 42
 		carrierroute carrier_name domain_name carrierfailureroute userblocklist
43
-		globalblacklist htable purplemap uacreg pl_pipes mtree mtrees
43
+		globalblocklist htable purplemap uacreg pl_pipes mtree mtrees
44 44
 		sca_subscriptions mohqcalls mohqueues rtpproxy rtpengine
45 45
 		dr_gateways dr_rules dr_gw_lists dr_groups secfilter'}
46 46
 PRESENCE_TABLES=${PRESENCE_TABLES:-'presentity active_watchers watchers xcap
Browse code

kamctl: rename userblacklist to userblocklist

Lucian Balaceanu authored on 09/11/2020 09:51:11
Showing 1 changed files
... ...
@@ -39,7 +39,7 @@ STANDARD_TABLES=${STANDARD_TABLES:-'version acc dbaliases domain domain_attrs
39 39
 		usr_preferences aliases silo dialog dialog_vars dispatcher dialplan
40 40
 		acc_cdrs topos_d topos_t'}
41 41
 EXTRA_TABLES=${EXTRA_TABLES:-'imc_members imc_rooms cpl sip_trace domainpolicy
42
-		carrierroute carrier_name domain_name carrierfailureroute userblacklist
42
+		carrierroute carrier_name domain_name carrierfailureroute userblocklist
43 43
 		globalblacklist htable purplemap uacreg pl_pipes mtree mtrees
44 44
 		sca_subscriptions mohqcalls mohqueues rtpproxy rtpengine
45 45
 		dr_gateways dr_rules dr_gw_lists dr_groups secfilter'}
... ...
@@ -76,7 +76,7 @@ STANDARD_MODULES=${STANDARD_MODULES:-'standard acc lcr domain group
76 76
 PRESENCE_MODULES=${PRESENCE_MODULES:-'presence rls'}
77 77
 
78 78
 EXTRA_MODULES=${EXTRA_MODULES:-'imc cpl siptrace domainpolicy carrierroute
79
-		drouting userblacklist htable purple uac pipelimit mtree sca mohqueue
79
+		drouting userblocklist htable purple uac pipelimit mtree sca mohqueue
80 80
 		rtpproxy rtpengine secfilter'}
81 81
 
82 82
 DBUID_MODULES=${UID_MODULES:-'uid_auth_db uid_avp_db uid_domain uid_gflags
Browse code

kamctl: kamdbctl.base - replaced get_answer() with a portable version

- contributed by Sergey Safarov, GH #2019

Daniel-Constantin Mierla authored on 16/09/2019 08:12:47
Showing 1 changed files
... ...
@@ -205,16 +205,11 @@ merr() {
205 205
 #
206 206
 get_answer ()
207 207
 {
208
-    value=$1
209
-    question=$2
210
-    if [ "${value}" = "ask" ]; then
211
-        echo -n "$question"
212
-        read ANSWER
213
-    else
214
-        ANSWER=${value}
215
-    fi
216
-    ANSWER=${ANSWER:0:1}
217
-    ANSWER=${ANSWER/Y/y}
218
-    ANSWER=${ANSWER/N/n}
208
+	value=$1
209
+	question=$2
210
+	if [ "${value}" = "ask" ]; then
211
+		echo -n "$question"
212
+		read value
213
+	fi
214
+	ANSWER=$(echo ${value} | grep -o -e '[YyNn]' | sed -e 's/Y/y/' -e 's/N/n/')
219 215
 }
220
-
Browse code

kamdbctl: Merged patch from alpine packaging (#1786)

- kamdbctl: Merged patch from alpine packaging (#1786)
- add proper quoting for DB table and module definitions

sergey-safarov authored on 04/01/2019 21:34:47 • Henning Westerholt committed on 04/01/2019 21:34:47
Showing 1 changed files
... ...
@@ -33,20 +33,20 @@ INSTALL_DBUID_TABLES=${INSTALL_DBUID_TABLES:-ask}
33 33
 
34 34
 # Used by dbtext and db_berkeley to define tables to be created, used by
35 35
 # postgres to do the grants
36
-STANDARD_TABLES=${STANDARD_TABLES:-version acc dbaliases domain domain_attrs
36
+STANDARD_TABLES=${STANDARD_TABLES:-'version acc dbaliases domain domain_attrs
37 37
 		grp uri speed_dial lcr_gw lcr_rule lcr_rule_target pdt subscriber
38 38
 		location location_attrs re_grp trusted address missed_calls
39 39
 		usr_preferences aliases silo dialog dialog_vars dispatcher dialplan
40
-		acc_cdrs topos_d topos_t}
41
-EXTRA_TABLES=${EXTRA_TABLES:-imc_members imc_rooms cpl sip_trace domainpolicy
40
+		acc_cdrs topos_d topos_t'}
41
+EXTRA_TABLES=${EXTRA_TABLES:-'imc_members imc_rooms cpl sip_trace domainpolicy
42 42
 		carrierroute carrier_name domain_name carrierfailureroute userblacklist
43 43
 		globalblacklist htable purplemap uacreg pl_pipes mtree mtrees
44 44
 		sca_subscriptions mohqcalls mohqueues rtpproxy rtpengine
45
-		dr_gateways dr_rules dr_gw_lists dr_groups secfilter}
46
-PRESENCE_TABLES=${PRESENCE_TABLES:-presentity active_watchers watchers xcap
47
-		pua rls_presentity rls_watchers}
48
-DBUID_TABLES=${UID_TABLES:-uid_credentials uid_domain uid_domain_attrs
49
-		uid_global_attrs uid_uri uid_uri_attrs uid_user_attrs}
45
+		dr_gateways dr_rules dr_gw_lists dr_groups secfilter'}
46
+PRESENCE_TABLES=${PRESENCE_TABLES:-'presentity active_watchers watchers xcap
47
+		pua rls_presentity rls_watchers'}
48
+DBUID_TABLES=${UID_TABLES:-'uid_credentials uid_domain uid_domain_attrs
49
+		uid_global_attrs uid_uri uid_uri_attrs uid_user_attrs'}
50 50
 
51 51
 # SQL definitions
52 52
 # If you change this definitions here, then you must change them
... ...
@@ -69,18 +69,18 @@ GREP=${GREP:-grep}
69 69
 SED=${SED:-sed}
70 70
 
71 71
 # define what modules should be installed
72
-STANDARD_MODULES=${STANDARD_MODULES:-standard acc lcr domain group
72
+STANDARD_MODULES=${STANDARD_MODULES:-'standard acc lcr domain group
73 73
 		permissions registrar usrloc msilo alias_db uri_db speeddial
74
-		avpops auth_db pdt dialog dispatcher dialplan topos}
74
+		avpops auth_db pdt dialog dispatcher dialplan topos'}
75 75
 
76
-PRESENCE_MODULES=${PRESENCE_MODULES:-presence rls}
76
+PRESENCE_MODULES=${PRESENCE_MODULES:-'presence rls'}
77 77
 
78
-EXTRA_MODULES=${EXTRA_MODULES:-imc cpl siptrace domainpolicy carrierroute
78
+EXTRA_MODULES=${EXTRA_MODULES:-'imc cpl siptrace domainpolicy carrierroute
79 79
 		drouting userblacklist htable purple uac pipelimit mtree sca mohqueue
80
-		rtpproxy rtpengine secfilter}
80
+		rtpproxy rtpengine secfilter'}
81 81
 
82
-DBUID_MODULES=${UID_MODULES:-uid_auth_db uid_avp_db uid_domain uid_gflags
83
-		uid_uri_db}
82
+DBUID_MODULES=${UID_MODULES:-'uid_auth_db uid_avp_db uid_domain uid_gflags
83
+		uid_uri_db'}
84 84
 
85 85
 ############################################################
86 86
 
Browse code

utils: add secfilter DB to kamdbctl file, for DB creation

Henning Westerholt authored on 02/01/2019 01:27:06
Showing 1 changed files
... ...
@@ -42,7 +42,7 @@ EXTRA_TABLES=${EXTRA_TABLES:-imc_members imc_rooms cpl sip_trace domainpolicy
42 42
 		carrierroute carrier_name domain_name carrierfailureroute userblacklist
43 43
 		globalblacklist htable purplemap uacreg pl_pipes mtree mtrees
44 44
 		sca_subscriptions mohqcalls mohqueues rtpproxy rtpengine
45
-		dr_gateways dr_rules dr_gw_lists dr_groups}
45
+		dr_gateways dr_rules dr_gw_lists dr_groups secfilter}
46 46
 PRESENCE_TABLES=${PRESENCE_TABLES:-presentity active_watchers watchers xcap
47 47
 		pua rls_presentity rls_watchers}
48 48
 DBUID_TABLES=${UID_TABLES:-uid_credentials uid_domain uid_domain_attrs
... ...
@@ -77,7 +77,7 @@ PRESENCE_MODULES=${PRESENCE_MODULES:-presence rls}
77 77
 
78 78
 EXTRA_MODULES=${EXTRA_MODULES:-imc cpl siptrace domainpolicy carrierroute
79 79
 		drouting userblacklist htable purple uac pipelimit mtree sca mohqueue
80
-		rtpproxy rtpengine}
80
+		rtpproxy rtpengine secfilter}
81 81
 
82 82
 DBUID_MODULES=${UID_MODULES:-uid_auth_db uid_avp_db uid_domain uid_gflags
83 83
 		uid_uri_db}
Browse code

kamdbctl: remove not working db migrate command

- remove db migrate implementation in kamdbctl, .base, .mysql and .db_berkley files
- it was not working for mysql anyway, and not implemented for berkleydb
- this state was already documtend some weeks ago in commit 52a8def8d2a3e831

Henning Westerholt authored on 03/03/2018 18:08:30
Showing 1 changed files
... ...
@@ -97,7 +97,6 @@ usage: $COMMAND create <db name or db_path, optional> ...(creates a new database
97 97
        $COMMAND backup <file> ...........................(dumps current database to file)
98 98
        $COMMAND restore <file> ..........................(restores tables from a file)
99 99
        $COMMAND copy <new_db> ...........................(creates a new db from an existing one)
100
-       $COMMAND migrate <old_db> <new_db> ...............(migrates DB - no longer maintained!)
101 100
        $COMMAND presence ................................(adds the presence related tables)
102 101
        $COMMAND extra ...................................(adds the extra tables)
103 102
        $COMMAND dbuid ...................................(adds the uid tables)
Browse code

utils: kamdbctl - updated help message for migrate command

Daniel-Constantin Mierla authored on 14/02/2018 10:24:37
Showing 1 changed files
... ...
@@ -97,7 +97,7 @@ usage: $COMMAND create <db name or db_path, optional> ...(creates a new database
97 97
        $COMMAND backup <file> ...........................(dumps current database to file)
98 98
        $COMMAND restore <file> ..........................(restores tables from a file)
99 99
        $COMMAND copy <new_db> ...........................(creates a new db from an existing one)
100
-       $COMMAND migrate <old_db> <new_db> ...............(migrates DB from 1.2 to 1.3, not implemented yet!)
100
+       $COMMAND migrate <old_db> <new_db> ...............(migrates DB - no longer maintained!)
101 101
        $COMMAND presence ................................(adds the presence related tables)
102 102
        $COMMAND extra ...................................(adds the extra tables)
103 103
        $COMMAND dbuid ...................................(adds the uid tables)
Browse code

kamctl: added missing dr_groups to extra tables

Daniel-Constantin Mierla authored on 02/06/2017 18:15:09
Showing 1 changed files
... ...
@@ -42,7 +42,7 @@ EXTRA_TABLES=${EXTRA_TABLES:-imc_members imc_rooms cpl sip_trace domainpolicy
42 42
 		carrierroute carrier_name domain_name carrierfailureroute userblacklist
43 43
 		globalblacklist htable purplemap uacreg pl_pipes mtree mtrees
44 44
 		sca_subscriptions mohqcalls mohqueues rtpproxy rtpengine
45
-		dr_gateways dr_rules dr_gw_lists}
45
+		dr_gateways dr_rules dr_gw_lists dr_groups}
46 46
 PRESENCE_TABLES=${PRESENCE_TABLES:-presentity active_watchers watchers xcap
47 47
 		pua rls_presentity rls_watchers}
48 48
 DBUID_TABLES=${UID_TABLES:-uid_credentials uid_domain uid_domain_attrs
Browse code

kamctl: added rtpengine table to be created by kamdbctl

Daniel-Constantin Mierla authored on 02/06/2017 18:03:57
Showing 1 changed files
... ...
@@ -41,8 +41,8 @@ STANDARD_TABLES=${STANDARD_TABLES:-version acc dbaliases domain domain_attrs
41 41
 EXTRA_TABLES=${EXTRA_TABLES:-imc_members imc_rooms cpl sip_trace domainpolicy
42 42
 		carrierroute carrier_name domain_name carrierfailureroute userblacklist
43 43
 		globalblacklist htable purplemap uacreg pl_pipes mtree mtrees
44
-		sca_subscriptions mohqcalls mohqueues rtpproxy dr_gateways dr_rules
45
-		dr_gw_lists}
44
+		sca_subscriptions mohqcalls mohqueues rtpproxy rtpengine
45
+		dr_gateways dr_rules dr_gw_lists}
46 46
 PRESENCE_TABLES=${PRESENCE_TABLES:-presentity active_watchers watchers xcap
47 47
 		pua rls_presentity rls_watchers}
48 48
 DBUID_TABLES=${UID_TABLES:-uid_credentials uid_domain uid_domain_attrs
... ...
@@ -77,7 +77,7 @@ PRESENCE_MODULES=${PRESENCE_MODULES:-presence rls}
77 77
 
78 78
 EXTRA_MODULES=${EXTRA_MODULES:-imc cpl siptrace domainpolicy carrierroute
79 79
 		drouting userblacklist htable purple uac pipelimit mtree sca mohqueue
80
-		rtpproxy}
80
+		rtpproxy rtpengine}
81 81
 
82 82
 DBUID_MODULES=${UID_MODULES:-uid_auth_db uid_avp_db uid_domain uid_gflags
83 83
 		uid_uri_db}
Browse code

kamctl: added drouting tables to be created by kamdbctl

Daniel-Constantin Mierla authored on 02/06/2017 18:01:13
Showing 1 changed files
... ...
@@ -41,8 +41,9 @@ STANDARD_TABLES=${STANDARD_TABLES:-version acc dbaliases domain domain_attrs
41 41
 EXTRA_TABLES=${EXTRA_TABLES:-imc_members imc_rooms cpl sip_trace domainpolicy
42 42
 		carrierroute carrier_name domain_name carrierfailureroute userblacklist
43 43
 		globalblacklist htable purplemap uacreg pl_pipes mtree mtrees
44
-		sca_subscriptions mohqcalls mohqueues rtpproxy}
45
-PRESENCE_TABLES=${PRESENCE_TABLES:-presentity active_watchers watchers xcap 
44
+		sca_subscriptions mohqcalls mohqueues rtpproxy dr_gateways dr_rules
45
+		dr_gw_lists}
46
+PRESENCE_TABLES=${PRESENCE_TABLES:-presentity active_watchers watchers xcap
46 47
 		pua rls_presentity rls_watchers}
47 48
 DBUID_TABLES=${UID_TABLES:-uid_credentials uid_domain uid_domain_attrs
48 49
 		uid_global_attrs uid_uri uid_uri_attrs uid_user_attrs}
... ...
@@ -75,7 +76,7 @@ STANDARD_MODULES=${STANDARD_MODULES:-standard acc lcr domain group
75 76
 PRESENCE_MODULES=${PRESENCE_MODULES:-presence rls}
76 77
 
77 78
 EXTRA_MODULES=${EXTRA_MODULES:-imc cpl siptrace domainpolicy carrierroute
78
-		userblacklist htable purple uac pipelimit mtree sca mohqueue
79
+		drouting userblacklist htable purple uac pipelimit mtree sca mohqueue
79 80
 		rtpproxy}
80 81
 
81 82
 DBUID_MODULES=${UID_MODULES:-uid_auth_db uid_avp_db uid_domain uid_gflags
Browse code

kamdbctl: include topos tables when creating standard database

Daniel-Constantin Mierla authored on 02/02/2016 15:54:17
Showing 1 changed files
... ...
@@ -37,7 +37,7 @@ STANDARD_TABLES=${STANDARD_TABLES:-version acc dbaliases domain domain_attrs
37 37
 		grp uri speed_dial lcr_gw lcr_rule lcr_rule_target pdt subscriber
38 38
 		location location_attrs re_grp trusted address missed_calls
39 39
 		usr_preferences aliases silo dialog dialog_vars dispatcher dialplan
40
-		acc_cdrs}
40
+		acc_cdrs topos_d topos_t}
41 41
 EXTRA_TABLES=${EXTRA_TABLES:-imc_members imc_rooms cpl sip_trace domainpolicy
42 42
 		carrierroute carrier_name domain_name carrierfailureroute userblacklist
43 43
 		globalblacklist htable purplemap uacreg pl_pipes mtree mtrees
... ...
@@ -70,7 +70,7 @@ SED=${SED:-sed}
70 70
 # define what modules should be installed
71 71
 STANDARD_MODULES=${STANDARD_MODULES:-standard acc lcr domain group
72 72
 		permissions registrar usrloc msilo alias_db uri_db speeddial
73
-		avpops auth_db pdt dialog dispatcher dialplan}
73
+		avpops auth_db pdt dialog dispatcher dialplan topos}
74 74
 
75 75
 PRESENCE_MODULES=${PRESENCE_MODULES:-presence rls}
76 76
 
Browse code

utils/kamctl: removed unused default values

- test if DEFAULT_Q is set inside the function using it, because it has
single place usage

Daniel-Constantin Mierla authored on 16/09/2014 16:13:02
Showing 1 changed files
... ...
@@ -54,12 +54,6 @@ DBUID_TABLES=${UID_TABLES:-uid_credentials uid_domain uid_domain_attrs
54 54
 # FIXME
55 55
 
56 56
 FOREVER=${FOREVER:-2030-05-28 21:32:15}
57
-DEFAULT_ALIASES_EXPIRES=${DEFAULT_ALIASES_EXPIRES:-${FOREVER}}
58
-DEFAULT_Q=${DEFAULT_Q:-1.0}
59
-DEFAULT_CALLID=${DEFAULT_CALLID:-Default-Call-ID}
60
-DEFAULT_CSEQ=${DEFAULT_CSEQ:-13}
61
-DEFAULT_LOCATION_EXPIRES=${DEFAULT_LOCATION_EXPIRES:-${FOREVER}}
62
-
63 57
 
64 58
 # default location for config files
65 59
 DEFAULT_CFG_DIR=/usr/local/etc/kamailio
Browse code

kamdbctl: added rtpproxy table to the extra group

- it was not listed at all, thus not created

Elena-Ramona Modroiu authored on 25/03/2014 11:05:56
Showing 1 changed files
... ...
@@ -41,7 +41,7 @@ STANDARD_TABLES=${STANDARD_TABLES:-version acc dbaliases domain domain_attrs
41 41
 EXTRA_TABLES=${EXTRA_TABLES:-imc_members imc_rooms cpl sip_trace domainpolicy
42 42
 		carrierroute carrier_name domain_name carrierfailureroute userblacklist
43 43
 		globalblacklist htable purplemap uacreg pl_pipes mtree mtrees
44
-		sca_subscriptions mohqcalls mohqueues}
44
+		sca_subscriptions mohqcalls mohqueues rtpproxy}
45 45
 PRESENCE_TABLES=${PRESENCE_TABLES:-presentity active_watchers watchers xcap 
46 46
 		pua rls_presentity rls_watchers}
47 47
 DBUID_TABLES=${UID_TABLES:-uid_credentials uid_domain uid_domain_attrs
... ...
@@ -81,7 +81,8 @@ STANDARD_MODULES=${STANDARD_MODULES:-standard acc lcr domain group
81 81
 PRESENCE_MODULES=${PRESENCE_MODULES:-presence rls}
82 82
 
83 83
 EXTRA_MODULES=${EXTRA_MODULES:-imc cpl siptrace domainpolicy carrierroute
84
-		userblacklist htable purple uac pipelimit mtree sca mohqueue}
84
+		userblacklist htable purple uac pipelimit mtree sca mohqueue
85
+		rtpproxy}
85 86
 
86 87
 DBUID_MODULES=${UID_MODULES:-uid_auth_db uid_avp_db uid_domain uid_gflags
87 88
 		uid_uri_db}
Browse code

kamctl: added new db tables in kamdbctl lists

Daniel-Constantin Mierla authored on 29/10/2013 21:00:18
Showing 1 changed files
... ...
@@ -36,11 +36,12 @@ INSTALL_DBUID_TABLES=${INSTALL_DBUID_TABLES:-ask}
36 36
 STANDARD_TABLES=${STANDARD_TABLES:-version acc dbaliases domain domain_attrs
37 37
 		grp uri speed_dial lcr_gw lcr_rule lcr_rule_target pdt subscriber
38 38
 		location location_attrs re_grp trusted address missed_calls
39
-		usr_preferences aliases silo dialog dialog_vars dispatcher dialplan}
39
+		usr_preferences aliases silo dialog dialog_vars dispatcher dialplan
40
+		acc_cdrs}
40 41
 EXTRA_TABLES=${EXTRA_TABLES:-imc_members imc_rooms cpl sip_trace domainpolicy
41 42
 		carrierroute carrier_name domain_name carrierfailureroute userblacklist
42 43
 		globalblacklist htable purplemap uacreg pl_pipes mtree mtrees
43
-		sca_subscriptions}
44
+		sca_subscriptions mohqcalls mohqueues}
44 45
 PRESENCE_TABLES=${PRESENCE_TABLES:-presentity active_watchers watchers xcap 
45 46
 		pua rls_presentity rls_watchers}
46 47
 DBUID_TABLES=${UID_TABLES:-uid_credentials uid_domain uid_domain_attrs
... ...
@@ -80,7 +81,7 @@ STANDARD_MODULES=${STANDARD_MODULES:-standard acc lcr domain group
80 81
 PRESENCE_MODULES=${PRESENCE_MODULES:-presence rls}
81 82
 
82 83
 EXTRA_MODULES=${EXTRA_MODULES:-imc cpl siptrace domainpolicy carrierroute
83
-		userblacklist htable purple uac pipelimit mtree sca}
84
+		userblacklist htable purple uac pipelimit mtree sca mohqueue}
84 85
 
85 86
 DBUID_MODULES=${UID_MODULES:-uid_auth_db uid_avp_db uid_domain uid_gflags
86 87
 		uid_uri_db}
Browse code

kamdbctl: new command add-tables

- creates only tables that are groupped under same id, thus have the sql
script in a file
- syntax: kamdbctl add-tables <gid>
- there has to be a <gid>-create.sql script
- eg: kamdbctl add-tables lcr

Daniel-Constantin Mierla authored on 27/08/2013 12:00:17
Showing 1 changed files
... ...
@@ -107,6 +107,7 @@ usage: $COMMAND create <db name or db_path, optional> ...(creates a new database
107 107
        $COMMAND dbonly ..................................(creates empty database)
108 108
        $COMMAND grant ...................................(grant privileges to database)
109 109
        $COMMAND revoke ..................................(revoke privileges to database)
110
+       $COMMAND add-tables <gid> ........................(creates only tables groupped in gid)
110 111
 
111 112
        if you want to manipulate database as other database user than
112 113
        root, want to change database name from default value "$DBNAME",
Browse code

kamctl: added option to creat uid-related tables

- few more options to be able to create database only, grant or revoke
privileges from command line
- the extensions were added for mysql

Daniel-Constantin Mierla authored on 22/01/2013 23:45:17
Showing 1 changed files
... ...
@@ -29,18 +29,22 @@ USERCOL=${USERCOL:-username}
29 29
 
30 30
 INSTALL_EXTRA_TABLES=${INSTALL_EXTRA_TABLES:-ask}
31 31
 INSTALL_PRESENCE_TABLES=${INSTALL_PRESENCE_TABLES:-ask}
32
+INSTALL_DBUID_TABLES=${INSTALL_DBUID_TABLES:-ask}
32 33
 
33 34
 # Used by dbtext and db_berkeley to define tables to be created, used by
34 35
 # postgres to do the grants
35
-STANDARD_TABLES=${STANDARD_TABLES:-version acc dbaliases domain domain_attrs grp
36
-		uri speed_dial lcr_gw lcr_rule lcr_rule_target pdt subscriber
37
-		location re_grp trusted address missed_calls usr_preferences
38
-		aliases silo dialog dialog_vars dispatcher dialplan}
36
+STANDARD_TABLES=${STANDARD_TABLES:-version acc dbaliases domain domain_attrs
37
+		grp uri speed_dial lcr_gw lcr_rule lcr_rule_target pdt subscriber
38
+		location location_attrs re_grp trusted address missed_calls
39
+		usr_preferences aliases silo dialog dialog_vars dispatcher dialplan}
39 40
 EXTRA_TABLES=${EXTRA_TABLES:-imc_members imc_rooms cpl sip_trace domainpolicy
40 41
 		carrierroute carrier_name domain_name carrierfailureroute userblacklist
41
-		globalblacklist htable purplemap uacreg pl_pipes mtree mtrees}
42
+		globalblacklist htable purplemap uacreg pl_pipes mtree mtrees
43
+		sca_subscriptions}
42 44
 PRESENCE_TABLES=${PRESENCE_TABLES:-presentity active_watchers watchers xcap 
43 45
 		pua rls_presentity rls_watchers}
46
+DBUID_TABLES=${UID_TABLES:-uid_credentials uid_domain uid_domain_attrs
47
+		uid_global_attrs uid_uri uid_uri_attrs uid_user_attrs}
44 48
 
45 49
 # SQL definitions
46 50
 # If you change this definitions here, then you must change them
... ...
@@ -69,12 +73,17 @@ GREP=${GREP:-grep}
69 73
 SED=${SED:-sed}
70 74
 
71 75
 # define what modules should be installed
72
-STANDARD_MODULES=${STANDARD_MODULES:-standard acc lcr domain group permissions
73
-				     registrar usrloc msilo alias_db uri_db
74
-				     speeddial avpops auth_db pdt dialog dispatcher
75
-				     dialplan}
76
+STANDARD_MODULES=${STANDARD_MODULES:-standard acc lcr domain group
77
+		permissions registrar usrloc msilo alias_db uri_db speeddial
78
+		avpops auth_db pdt dialog dispatcher dialplan}
79
+
80
+PRESENCE_MODULES=${PRESENCE_MODULES:-presence rls}
81
+
76 82
 EXTRA_MODULES=${EXTRA_MODULES:-imc cpl siptrace domainpolicy carrierroute
77
-    userblacklist htable purple uac pipelimit mtree}
83
+		userblacklist htable purple uac pipelimit mtree sca}
84
+
85
+DBUID_MODULES=${UID_MODULES:-uid_auth_db uid_avp_db uid_domain uid_gflags
86
+		uid_uri_db}
78 87
 
79 88
 ############################################################
80 89
 
... ...
@@ -94,6 +103,10 @@ usage: $COMMAND create <db name or db_path, optional> ...(creates a new database
94 103
        $COMMAND migrate <old_db> <new_db> ...............(migrates DB from 1.2 to 1.3, not implemented yet!)
95 104
        $COMMAND presence ................................(adds the presence related tables)
96 105
        $COMMAND extra ...................................(adds the extra tables)
106
+       $COMMAND dbuid ...................................(adds the uid tables)
107
+       $COMMAND dbonly ..................................(creates empty database)
108
+       $COMMAND grant ...................................(grant privileges to database)
109
+       $COMMAND revoke ..................................(revoke privileges to database)
97 110
 
98 111
        if you want to manipulate database as other database user than
99 112
        root, want to change database name from default value "$DBNAME",
Browse code

kamdbctl: new command - kamdbctl pframework create - creates a provisioning framework for the installed db tables

Ovidiu Sas authored on 10/01/2013 17:50:06
Showing 1 changed files
... ...
@@ -56,6 +56,12 @@ DEFAULT_CSEQ=${DEFAULT_CSEQ:-13}
56 56
 DEFAULT_LOCATION_EXPIRES=${DEFAULT_LOCATION_EXPIRES:-${FOREVER}}
57 57
 
58 58
 
59
+# default location for config files
60
+DEFAULT_CFG_DIR=/usr/local/etc/kamailio
61
+
62
+# default location for data files
63
+DEFAULT_DATA_DIR=/usr/local/share/kamailio
64
+
59 65
 # Needed programs
60 66
 MD5=${MD5:-md5sum}
61 67
 AWK=${AWK:-awk}
... ...
@@ -79,21 +85,22 @@ COMMAND=`basename $0`
79 85
 cat <<EOF
80 86
 $0 $VERSION
81 87
 
82
-usage: $COMMAND create <db name or db_path, optional> .....(creates a new database)
83
-       $COMMAND drop <db name or db_path, optional> .......(!entirely deletes tables!)
84
-       $COMMAND reinit <db name or db_path, optional> .....(!entirely deletes and than re-creates tables!)
85
-       $COMMAND backup <file> .................................(dumps current database to file)
86
-       $COMMAND restore <file> ................................(restores tables from a file)
87
-       $COMMAND copy <new_db> .................................(creates a new db from an existing one)
88
-       $COMMAND migrate <old_db> <new_db> .....................(migrates DB from 1.2 to 1.3, not implemented yet!)
89
-       $COMMAND presence ......................................(adds the presence related tables)
90
-       $COMMAND extra .........................................(adds the extra tables)
88
+usage: $COMMAND create <db name or db_path, optional> ...(creates a new database)
89
+       $COMMAND drop <db name or db_path, optional> .....(!entirely deletes tables!)
90
+       $COMMAND reinit <db name or db_path, optional> ...(!entirely deletes and than re-creates tables!)
91
+       $COMMAND backup <file> ...........................(dumps current database to file)
92
+       $COMMAND restore <file> ..........................(restores tables from a file)
93
+       $COMMAND copy <new_db> ...........................(creates a new db from an existing one)
94
+       $COMMAND migrate <old_db> <new_db> ...............(migrates DB from 1.2 to 1.3, not implemented yet!)
95
+       $COMMAND presence ................................(adds the presence related tables)
96
+       $COMMAND extra ...................................(adds the extra tables)
91 97
 
92 98
        if you want to manipulate database as other database user than
93 99
        root, want to change database name from default value "$DBNAME",
94 100
        or want to use other values for users and password, edit the
95 101
        "config vars" section of the command $COMMAND.
96 102
 
103
+       $COMMAND pframework create .......................(creates a sample provisioning framework file)
97 104
 EOF
98 105
 } #usage
99 106
 
Browse code

more openser to kamailio migration

osas authored on 27/10/2012 16:00:28
Showing 1 changed files
... ...
@@ -3,22 +3,22 @@ PATH=$PATH:/usr/local/sbin
3 3
 # config vars
4 4
 
5 5
 # name of the database to be used by Kamailio
6
-DBNAME=${DBNAME:-openser}
6
+DBNAME=${DBNAME:-kamailio}
7 7
 
8 8
 # address of database server
9 9
 DBHOST=${DBHOST:-localhost}
10 10
 
11 11
 # user with full privileges over DBNAME database
12
-DBRWUSER=${DBRWUSER:-openser}
12
+DBRWUSER=${DBRWUSER:-kamailio}
13 13
 
14 14
 # password user with full privileges over DBNAME database
15
-DBRWPW=${DBRWPW:-openserrw}
15
+DBRWPW=${DBRWPW:-kamailiorw}
16 16
 
17 17
 # read-only user
18
-DBROUSER=${DBROUSER:-openserro}
18
+DBROUSER=${DBROUSER:-kamailioro}
19 19
 
20 20
 # password for read-only user
21
-DBROPW=${DBROPW:-openserro}
21
+DBROPW=${DBROPW:-kamailioro}
22 22
 
23 23
 # user name column
24 24
 USERCOL=${USERCOL:-username}
Browse code

db scheme: move usrloc and alias expire time 10 years to the future, to 2030

Henning Westerholt authored on 07/09/2012 10:57:30
Showing 1 changed files
... ...
@@ -48,7 +48,7 @@ PRESENCE_TABLES=${PRESENCE_TABLES:-presentity active_watchers watchers xcap
48 48
 # script and needed to be the same as in the database definitions.
49 49
 # FIXME
50 50
 
51
-FOREVER=${FOREVER:-2020-05-28 21:32:15}
51
+FOREVER=${FOREVER:-2030-05-28 21:32:15}
52 52
 DEFAULT_ALIASES_EXPIRES=${DEFAULT_ALIASES_EXPIRES:-${FOREVER}}
53 53
 DEFAULT_Q=${DEFAULT_Q:-1.0}
54 54
 DEFAULT_CALLID=${DEFAULT_CALLID:-Default-Call-ID}
Browse code

kamdbctl: add some explanation to the variables section and fix path

Henning Westerholt authored on 03/09/2012 11:01:05
Showing 1 changed files
... ...
@@ -44,7 +44,8 @@ PRESENCE_TABLES=${PRESENCE_TABLES:-presentity active_watchers watchers xcap
44 44
 
45 45
 # SQL definitions
46 46
 # If you change this definitions here, then you must change them
47
-# in db/schema/entities.xml too.
47
+# in ../../lib/srdb1/schema/entities.xml too. They are used in this
48
+# script and needed to be the same as in the database definitions.
48 49
 # FIXME
49 50
 
50 51
 FOREVER=${FOREVER:-2020-05-28 21:32:15}
Browse code

kamdbctl: mtree tables were not in the list for db creation

Daniel-Constantin Mierla authored on 18/07/2012 16:51:54
Showing 1 changed files
... ...
@@ -38,7 +38,7 @@ STANDARD_TABLES=${STANDARD_TABLES:-version acc dbaliases domain domain_attrs grp
38 38
 		aliases silo dialog dialog_vars dispatcher dialplan}
39 39
 EXTRA_TABLES=${EXTRA_TABLES:-imc_members imc_rooms cpl sip_trace domainpolicy
40 40
 		carrierroute carrier_name domain_name carrierfailureroute userblacklist
41
-		globalblacklist htable purplemap uacreg pl_pipes}
41
+		globalblacklist htable purplemap uacreg pl_pipes mtree mtrees}
42 42
 PRESENCE_TABLES=${PRESENCE_TABLES:-presentity active_watchers watchers xcap 
43 43
 		pua rls_presentity rls_watchers}
44 44
 
... ...
@@ -67,7 +67,7 @@ STANDARD_MODULES=${STANDARD_MODULES:-standard acc lcr domain group permissions
67 67
 				     speeddial avpops auth_db pdt dialog dispatcher
68 68
 				     dialplan}
69 69
 EXTRA_MODULES=${EXTRA_MODULES:-imc cpl siptrace domainpolicy carrierroute
70
-    userblacklist htable purple uac pipelimit}
70
+    userblacklist htable purple uac pipelimit mtree}
71 71
 
72 72
 ############################################################
73 73
 
Browse code

kamdbctl: add domain_attrs table to standard tables

Klaus Darilion authored on 11/07/2012 12:30:51
Showing 1 changed files
... ...
@@ -32,7 +32,7 @@ INSTALL_PRESENCE_TABLES=${INSTALL_PRESENCE_TABLES:-ask}
32 32
 
33 33
 # Used by dbtext and db_berkeley to define tables to be created, used by
34 34
 # postgres to do the grants
35
-STANDARD_TABLES=${STANDARD_TABLES:-version acc dbaliases domain grp
35
+STANDARD_TABLES=${STANDARD_TABLES:-version acc dbaliases domain domain_attrs grp
36 36
 		uri speed_dial lcr_gw lcr_rule lcr_rule_target pdt subscriber
37 37
 		location re_grp trusted address missed_calls usr_preferences
38 38
 		aliases silo dialog dialog_vars dispatcher dialplan}
Browse code

srdb1/kamctl: dialog_vars table added to dialog group

- dialog_vars is used by dialog module and created at once with dialog
table, otherwise the module does not start

Daniel-Constantin Mierla authored on 09/10/2011 11:05:36
Showing 1 changed files
... ...
@@ -35,7 +35,7 @@ INSTALL_PRESENCE_TABLES=${INSTALL_PRESENCE_TABLES:-ask}
35 35
 STANDARD_TABLES=${STANDARD_TABLES:-version acc dbaliases domain grp
36 36
 		uri speed_dial lcr_gw lcr_rule lcr_rule_target pdt subscriber
37 37
 		location re_grp trusted address missed_calls usr_preferences
38
-		aliases silo dialog dispatcher dialplan}
38
+		aliases silo dialog dialog_vars dispatcher dialplan}
39 39
 EXTRA_TABLES=${EXTRA_TABLES:-imc_members imc_rooms cpl sip_trace domainpolicy
40 40
 		carrierroute carrier_name domain_name carrierfailureroute userblacklist
41 41
 		globalblacklist htable purplemap uacreg pl_pipes}
Browse code

kamdbctl: added pipelimit to the list of extra tables to create

Daniel-Constantin Mierla authored on 20/07/2011 21:42:05
Showing 1 changed files
... ...
@@ -38,7 +38,7 @@ STANDARD_TABLES=${STANDARD_TABLES:-version acc dbaliases domain grp
38 38
 		aliases silo dialog dispatcher dialplan}
39 39
 EXTRA_TABLES=${EXTRA_TABLES:-imc_members imc_rooms cpl sip_trace domainpolicy
40 40
 		carrierroute carrier_name domain_name carrierfailureroute userblacklist
41
-		globalblacklist htable purplemap uacreg}
41
+		globalblacklist htable purplemap uacreg pl_pipes}
42 42
 PRESENCE_TABLES=${PRESENCE_TABLES:-presentity active_watchers watchers xcap 
43 43
 		pua rls_presentity rls_watchers}
44 44
 
... ...
@@ -67,7 +67,7 @@ STANDARD_MODULES=${STANDARD_MODULES:-standard acc lcr domain group permissions
67 67
 				     speeddial avpops auth_db pdt dialog dispatcher
68 68
 				     dialplan}
69 69
 EXTRA_MODULES=${EXTRA_MODULES:-imc cpl siptrace domainpolicy carrierroute
70
-    userblacklist htable purple uac}
70
+    userblacklist htable purple uac pipelimit}
71 71
 
72 72
 ############################################################
73 73
 
Browse code

kamdbctl: create uacreg table

- uacreg table was not created by kamdbctl

Daniel-Constantin Mierla authored on 28/02/2011 19:32:09
Showing 1 changed files
... ...
@@ -36,8 +36,9 @@ STANDARD_TABLES=${STANDARD_TABLES:-version acc dbaliases domain grp
36 36
 		uri speed_dial lcr_gw lcr_rule lcr_rule_target pdt subscriber
37 37
 		location re_grp trusted address missed_calls usr_preferences
38 38
 		aliases silo dialog dispatcher dialplan}
39
-EXTRA_TABLES=${EXTRA_TABLES:-imc_members imc_rooms cpl sip_trace domainpolicy carrierroute
40
-		carrier_name domain_name carrierfailureroute userblacklist globalblacklist htable purplemap}
39
+EXTRA_TABLES=${EXTRA_TABLES:-imc_members imc_rooms cpl sip_trace domainpolicy
40
+		carrierroute carrier_name domain_name carrierfailureroute userblacklist
41
+		globalblacklist htable purplemap uacreg}
41 42
 PRESENCE_TABLES=${PRESENCE_TABLES:-presentity active_watchers watchers xcap 
42 43
 		pua rls_presentity rls_watchers}
43 44
 
... ...
@@ -65,7 +66,8 @@ STANDARD_MODULES=${STANDARD_MODULES:-standard acc lcr domain group permissions
65 66
 				     registrar usrloc msilo alias_db uri_db
66 67
 				     speeddial avpops auth_db pdt dialog dispatcher
67 68
 				     dialplan}
68
-EXTRA_MODULES=${EXTRA_MODULES:-imc cpl siptrace domainpolicy carrierroute userblacklist htable purple}
69
+EXTRA_MODULES=${EXTRA_MODULES:-imc cpl siptrace domainpolicy carrierroute
70
+    userblacklist htable purple uac}
69 71
 
70 72
 ############################################################
71 73
 
Browse code

kamdbctl: fixed lcr tables name

- reported by Klaus Feichtinger

Daniel-Constantin Mierla authored on 03/10/2010 19:08:59
Showing 1 changed files
... ...
@@ -32,10 +32,10 @@ INSTALL_PRESENCE_TABLES=${INSTALL_PRESENCE_TABLES:-ask}
32 32
 
33 33
 # Used by dbtext and db_berkeley to define tables to be created, used by
34 34
 # postgres to do the grants
35
-STANDARD_TABLES=${STANDARD_TABLES:-version acc dbaliases lcr domain grp
36
-		uri speed_dial gw pdt subscriber location re_grp trusted
37
-		address missed_calls usr_preferences aliases silo dialog
38
-		dispatcher dialplan}
35
+STANDARD_TABLES=${STANDARD_TABLES:-version acc dbaliases domain grp
36
+		uri speed_dial lcr_gw lcr_rule lcr_rule_target pdt subscriber
37
+		location re_grp trusted address missed_calls usr_preferences
38
+		aliases silo dialog dispatcher dialplan}
39 39
 EXTRA_TABLES=${EXTRA_TABLES:-imc_members imc_rooms cpl sip_trace domainpolicy carrierroute
40 40
 		carrier_name domain_name carrierfailureroute userblacklist globalblacklist htable purplemap}
41 41
 PRESENCE_TABLES=${PRESENCE_TABLES:-presentity active_watchers watchers xcap 
Browse code

kamctl: moved from tools/ to utils/

- mv tools/kamctl utils/kamctl
- updated srdb1 Makefile and test/unit/include/common with the new
kamctl path

Andrei Pelinescu-Onciul authored on 09/10/2009 12:05:15
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,200 @@
1
+PATH=$PATH:/usr/local/sbin
2
+
3
+# config vars
4
+
5
+# name of the database to be used by Kamailio
6
+DBNAME=${DBNAME:-openser}
7
+
8
+# address of database server
9
+DBHOST=${DBHOST:-localhost}
10
+
11
+# user with full privileges over DBNAME database
12
+DBRWUSER=${DBRWUSER:-openser}
13
+
14
+# password user with full privileges over DBNAME database
15
+DBRWPW=${DBRWPW:-openserrw}
16
+
17
+# read-only user
18
+DBROUSER=${DBROUSER:-openserro}
19
+
20
+# password for read-only user
21
+DBROPW=${DBROPW:-openserro}
22
+
23
+# user name column
24
+USERCOL=${USERCOL:-username}
25
+
26
+# Describe what additional tables to install. Valid values for the variables
27
+# below are yes/no/ask. With ask it will interactively ask the user for the
28
+# answer, while yes/no allow for automated, unassisted installs.
29
+
30
+INSTALL_EXTRA_TABLES=${INSTALL_EXTRA_TABLES:-ask}
31
+INSTALL_PRESENCE_TABLES=${INSTALL_PRESENCE_TABLES:-ask}
32
+
33
+# Used by dbtext and db_berkeley to define tables to be created, used by
34
+# postgres to do the grants
35
+STANDARD_TABLES=${STANDARD_TABLES:-version acc dbaliases lcr domain grp
36
+		uri speed_dial gw pdt subscriber location re_grp trusted
37
+		address missed_calls usr_preferences aliases silo dialog
38
+		dispatcher dialplan}
39
+EXTRA_TABLES=${EXTRA_TABLES:-imc_members imc_rooms cpl sip_trace domainpolicy carrierroute
40
+		carrier_name domain_name carrierfailureroute userblacklist globalblacklist htable purplemap}
41
+PRESENCE_TABLES=${PRESENCE_TABLES:-presentity active_watchers watchers xcap 
42
+		pua rls_presentity rls_watchers}
43
+
44
+# SQL definitions
45
+# If you change this definitions here, then you must change them
46
+# in db/schema/entities.xml too.
47
+# FIXME
48
+
49
+FOREVER=${FOREVER:-2020-05-28 21:32:15}
50
+DEFAULT_ALIASES_EXPIRES=${DEFAULT_ALIASES_EXPIRES:-${FOREVER}}
51
+DEFAULT_Q=${DEFAULT_Q:-1.0}
52
+DEFAULT_CALLID=${DEFAULT_CALLID:-Default-Call-ID}
53
+DEFAULT_CSEQ=${DEFAULT_CSEQ:-13}
54
+DEFAULT_LOCATION_EXPIRES=${DEFAULT_LOCATION_EXPIRES:-${FOREVER}}
55
+
56
+
57
+# Needed programs
58
+MD5=${MD5:-md5sum}
59
+AWK=${AWK:-awk}
60
+GREP=${GREP:-grep}
61
+SED=${SED:-sed}
62
+
63
+# define what modules should be installed
64
+STANDARD_MODULES=${STANDARD_MODULES:-standard acc lcr domain group permissions
65
+				     registrar usrloc msilo alias_db uri_db
66
+				     speeddial avpops auth_db pdt dialog dispatcher
67
+				     dialplan}
68
+EXTRA_MODULES=${EXTRA_MODULES:-imc cpl siptrace domainpolicy carrierroute userblacklist htable purple}
69
+
70
+############################################################
71
+
72
+# common functions
73
+
74
+usage() {
75
+COMMAND=`basename $0`
76
+cat <<EOF
77
+$0 $VERSION
78
+
79
+usage: $COMMAND create <db name or db_path, optional> .....(creates a new database)
80
+       $COMMAND drop <db name or db_path, optional> .......(!entirely deletes tables!)
81
+       $COMMAND reinit <db name or db_path, optional> .....(!entirely deletes and than re-creates tables!)
82
+       $COMMAND backup <file> .................................(dumps current database to file)
83
+       $COMMAND restore <file> ................................(restores tables from a file)
84
+       $COMMAND copy <new_db> .................................(creates a new db from an existing one)
85
+       $COMMAND migrate <old_db> <new_db> .....................(migrates DB from 1.2 to 1.3, not implemented yet!)
86
+       $COMMAND presence ......................................(adds the presence related tables)
87
+       $COMMAND extra .........................................(adds the extra tables)
88
+
89
+       if you want to manipulate database as other database user than
90
+       root, want to change database name from default value "$DBNAME",
91
+       or want to use other values for users and password, edit the
92
+       "config vars" section of the command $COMMAND.
93
+
94
+EOF
95
+} #usage
96
+
97
+
98
+
99
+
100
+# read realm
101
+prompt_realm()
102
+{
103
+	printf "Domain (realm) for the default user 'admin': "
104
+	read SIP_DOMAIN
105
+	echo
106
+}
107
+
108
+
109
+# calculate credentials for admin
110
+credentials()
111
+{
112
+	HA1=`echo -n "admin:$SIP_DOMAIN:$DBRWPW" | $MD5 | $AWK '{ print $1 }'`
113
+	if [ $? -ne 0 ] ; then
114
+		merr "HA1 calculation failed"
115
+		exit 1
116
+	fi
117
+	HA1B=`echo -n "admin@$SIP_DOMAIN:$SIP_DOMAIN:$DBRWPW" | $MD5 | $AWK '{ print $1 }'`
118
+	if [ $? -ne 0 ] ; then
119
+		merr "HA1B calculation failed"
120
+		exit 1
121
+	fi
122
+
123
+	#PHPLIB_ID of users should be difficulty to guess for security reasons
124
+	NOW=`date`;
125
+	PHPLIB_ID=`echo -n "$RANDOM:$NOW:$SIP_DOMAIN" | $MD5 | $AWK '{ print $1 }'`
126
+	if [ $? -ne 0 ] ; then
127
+		merr "PHPLIB_ID calculation failed"
128
+		exit 1
129
+	fi
130
+}
131
+
132
+# FIXME use the definition from kamctl.base
133
+
134
+mdbg() {
135
+	if [ "0$VERBOSE" -ne 0 ] ; then
136
+		if [ -t 1 -a -z "$NOHLPRINT" ] ; then
137
+			echo -e "\033[1m$1\033[0m"
138
+		else
139
+			echo "$1"
140
+		fi
141
+	fi
142
+}
143
+
144
+mwarn() {
145
+	if [ -t 1 -a -z "$NOHLPRINT" ] ; then
146
+		echo -e '\E[37;32m'"\033[1mWARNING: $1\033[0m"
147
+	else
148
+		echo "** WARNING: $1"
149
+	fi
150
+}
151
+
152
+minfo() {
153
+	if [ -t 1 -a -z "$NOHLPRINT" ] ; then
154
+		echo -e '\E[37;33m'"\033[1mINFO: $1\033[0m"
155
+	else
156
+		echo "** INFO: $1"
157
+	fi
158
+}
159
+
160
+mecho() {
161
+	if [ -t 1 -a -z "$NOHLPRINT" ] ; then
162
+		echo -e "\033[1m$1\033[0m"
163
+	else
164
+		echo "$1"
165
+	fi
166
+}
167
+
168
+merr() {
169
+	if [ -t 1 -a -z "$NOHLPRINT" ] ; then
170
+		echo -e '\E[37;31m'"\033[1mERROR: $1\033[0m"
171
+	else
172
+		echo "** ERROR: $1"
173
+	fi
174
+}
175
+
176
+# Get a y/n value from a variable. If the variable contains the keyword
177
+# `ask', then interactively ask the user for an answer.
178
+#
179
+# Arguments:
180
+#  $1 - variable holding yes/no/ask
181
+#  $2 - question to print if value of variable is ask
182
+#
183
+# Return:
184
+#  On return $ANSWER will be available with y/n
185
+#
186
+get_answer ()
187
+{
188
+    value=$1
189
+    question=$2
190
+    if [ "${value}" = "ask" ]; then
191
+        echo -n "$question"
192
+        read ANSWER
193
+    else
194
+        ANSWER=${value}
195
+    fi
196
+    ANSWER=${ANSWER:0:1}
197
+    ANSWER=${ANSWER/Y/y}
198
+    ANSWER=${ANSWER/N/n}
199
+}
200
+