Browse code

Made environment variable names consistent with the ones used by openserctl

git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@1600 689a6050-402a-0410-94f2-e92a70836424

Dan Pascu authored on 08/02/2007 10:12:26
Showing 2 changed files
... ...
@@ -2,7 +2,7 @@
2 2
 #
3 3
 # $Id$
4 4
 #
5
-# Script for adding and dropping ser MySql tables
5
+# Script for adding and dropping OpenSER MySQL tables
6 6
 #
7 7
 # TO-DO: update_structures command for migriting to new
8 8
 #        table definitons
... ...
@@ -59,25 +59,25 @@ if [ -z "$DBRWUSER" ]; then
59 59
 	DBRWUSER="openser"
60 60
 fi
61 61
 # password user with full privileges over DBNAME database
62
-if [ -z "$DEFAULT_PW" ]; then
63
-	DEFAULT_PW="openserrw"
62
+if [ -z "$DBRWPW" ]; then
63
+	DBRWPW="openserrw"
64 64
 fi
65 65
 # read-only user
66 66
 if [ -z "$DBROUSER" ]; then
67 67
 	DBROUSER="openserro"
68 68
 fi
69 69
 # password for read-only user
70
-if [ -z "$RO_PW" ]; then
71
-	RO_PW="openserro"
70
+if [ -z "$DBROPW" ]; then
71
+	DBROPW="openserro"
72 72
 fi
73 73
 # full privileges MySQL user
74
-if [ -z "$SQL_USER" ]; then
75
-	SQL_USER="root"
74
+if [ -z "$DBROOTUSER" ]; then
75
+	DBROOTUSER="root"
76 76
 fi
77 77
 
78
-CMD="mysql -h $DBHOST -u$SQL_USER "
79
-DUMP_CMD="mysqldump -h $DBHOST -u$SQL_USER -c -t "
80
-BACKUP_CMD="mysqldump -h $DBHOST -u$SQL_USER -c "
78
+CMD="mysql -h $DBHOST -u$DBROOTUSER "
79
+DUMP_CMD="mysqldump -h $DBHOST -u$DBROOTUSER -c -t "
80
+BACKUP_CMD="mysqldump -h $DBHOST -u$DBROOTUSER -c "
81 81
 
82 82
 # type of mysql tables
83 83
 if [ -z "$TABLE_TYPE" ]; then
... ...
@@ -125,7 +125,7 @@ usage: $COMMAND create
125 125
        $COMMAND reinstall (updates to a new OpenSER database)
126 126
        $COMMAND serweb (adds the SERWEB specific tables)
127 127
 
128
-       if you want to manipulate database as other MySql user than
128
+       if you want to manipulate database as other MySQL user than
129 129
        root, want to change database name from default value "$DBNAME",
130 130
        or want to use other values for users and password, edit the
131 131
        "config vars" section of the command $COMMAND
... ...
@@ -138,7 +138,7 @@ EOF
138 138
 prompt_pw()
139 139
 {
140 140
 	savetty=`stty -g`
141
-	printf "MySql password for $SQL_USER: "
141
+	printf "MySQL password for $DBROOTUSER: "
142 142
 	stty -echo
143 143
 	read PW
144 144
 	stty $savetty
... ...
@@ -223,12 +223,12 @@ prompt_realm()
223 223
 # calculate credentials for admin
224 224
 credentials()
225 225
 {
226
-	HA1=`echo -n "admin:$SIP_DOMAIN:$DEFAULT_PW" | $MD5 | $AWK '{ print $1 }'`
226
+	HA1=`echo -n "admin:$SIP_DOMAIN:$DBRWPW" | $MD5 | $AWK '{ print $1 }'`
227 227
 	if [ $? -ne 0 ] ; then
228 228
 		echo "HA1 calculation failed"
229 229
 		exit 1
230 230
 	fi
231
-	HA1B=`echo -n "admin@$SIP_DOMAIN:$SIP_DOMAIN:$DEFAULT_PW" | $MD5 | $AWK '{ print $1 }'`
231
+	HA1B=`echo -n "admin@$SIP_DOMAIN:$SIP_DOMAIN:$DBRWPW" | $MD5 | $AWK '{ print $1 }'`
232 232
 	if [ $? -ne 0 ] ; then
233 233
 		echo "HA1B calculation failed"
234 234
 		exit 1
... ...
@@ -279,10 +279,10 @@ create database $1 character set $CHARSET;
279 279
 use $1;
280 280
 
281 281
 # Users: ser is the regular user, serro only for reading
282
-GRANT ALL PRIVILEGES ON $1.* TO $DBRWUSER IDENTIFIED  BY '$DEFAULT_PW';
283
-GRANT ALL PRIVILEGES ON $1.* TO ${DBRWUSER}@$DBHOST IDENTIFIED BY '$DEFAULT_PW';
284
-GRANT SELECT ON $1.* TO $DBROUSER IDENTIFIED BY '$RO_PW';
285
-GRANT SELECT ON $1.* TO ${DBROUSER}@$DBHOST IDENTIFIED BY '$RO_PW';
282
+GRANT ALL PRIVILEGES ON $1.* TO $DBRWUSER IDENTIFIED  BY '$DBRWPW';
283
+GRANT ALL PRIVILEGES ON $1.* TO ${DBRWUSER}@$DBHOST IDENTIFIED BY '$DBRWPW';
284
+GRANT SELECT ON $1.* TO $DBROUSER IDENTIFIED BY '$DBROPW';
285
+GRANT SELECT ON $1.* TO ${DBROUSER}@$DBHOST IDENTIFIED BY '$DBROPW';
286 286
 
287 287
 
288 288
 #
... ...
@@ -702,7 +702,7 @@ if [ -z "$NO_USER_INIT" ] ; then
702 702
 			($USERCOL, password, first_name, last_name, phone,
703 703
 			email_address, datetime_created, datetime_modified, confirmation,
704 704
 			flag, sendnotification, greeting, ha1, domain, ha1b, phplib_id )
705
-			VALUES ( 'admin', '$DEFAULT_PW', 'Initial', 'Admin', '123',
705
+			VALUES ( 'admin', '$DBRWPW', 'Initial', 'Admin', '123',
706 706
 			'root@localhost', '2002-09-04 19:37:45', '0000-00-00 00:00:00',
707 707
 			'57DaSIPuCm52UNe54LF545750cfdL48OMZfroM53', 'o', '', '',
708 708
 			'$HA1', '$SIP_DOMAIN', '$HA1B',
... ...
@@ -877,7 +877,7 @@ EOF
877 877
 		echo "!                                                 !"
878 878
                 echo "! There was a default admin user created:         !"
879 879
 		echo "!    username: admin@$SIP_DOMAIN "
880
-		echo "!    password: $DEFAULT_PW       "
880
+		echo "!    password: $DBRWPW       "
881 881
 		echo "!                                                 !"
882 882
 		echo "! Please change this password or remove this user !"
883 883
 		echo "! from the subscriber and admin_privileges table. !"
... ...
@@ -2,7 +2,7 @@
2 2
 #
3 3
 # $Id$
4 4
 #
5
-# Script for adding and dropping ser MySql tables
5
+# Script for adding and dropping OpenSER Postgres tables
6 6
 #
7 7
 # TO-DO: update_structures command for migriting to new
8 8
 #        table definitons
... ...
@@ -80,20 +80,20 @@ if [ -z "$DBRWUSER" ]; then
80 80
 	DBRWUSER="openser"
81 81
 fi
82 82
 # password user with full privileges over DBNAME database
83
-if [ -z "$DEFAULT_PW" ]; then
84
-	DEFAULT_PW="openserrw"
83
+if [ -z "$DBRWPW" ]; then
84
+	DBRWPW="openserrw"
85 85
 fi
86 86
 # read-only user
87 87
 if [ -z "$DBROUSER" ]; then
88 88
 	DBROUSER="openserro"
89 89
 fi
90 90
 # password for read-only user
91
-if [ -z "$RO_PW" ]; then
92
-	RO_PW="openserro"
91
+if [ -z "$DBROPW" ]; then
92
+	DBROPW="openserro"
93 93
 fi
94 94
 # full privileges Postgres user
95
-if [ -z "$SQL_USER" ]; then
96
-	SQL_USER="postgres"
95
+if [ -z "$DBROOTUSER" ]; then
96
+	DBROOTUSER="postgres"
97 97
 	if [ ! -r ~/.pgpass ]; then
98 98
 		echo "~./pgpass does not exist, please create this file and support proper credentials for user postgres."
99 99
 		echo "Note: you need at least postgresql>= 7.3"
... ...
@@ -101,10 +101,10 @@ if [ -z "$SQL_USER" ]; then
101 101
 	fi
102 102
 fi
103 103
 
104
-CMD="psql -h $DBHOST -d template1 -U $SQL_USER "
104
+CMD="psql -h $DBHOST -d template1 -U $DBROOTUSER "
105 105
 # the following commands are untested:
106
-#   DUMP_CMD="pg_dump -h $DBHOST -u$SQL_USER -c -t "
107
-#   BACKUP_CMD="mysqldump -h $DBHOST -u$SQL_USER -c "
106
+#   DUMP_CMD="pg_dump -h $DBHOST -u$DBROOTUSER -c -t "
107
+#   BACKUP_CMD="mysqldump -h $DBHOST -u$DBROOTUSER -c "
108 108
 
109 109
 # type of sql tables
110 110
 if [ -z "$TABLE_TYPE" ]; then
... ...
@@ -165,7 +165,7 @@ EOF
165 165
 #prompt_pw()
166 166
 #{
167 167
 #	savetty=`stty -g`
168
-#	printf "MySql password for $SQL_USER: "
168
+#	printf "Postgres password for $DBROOTUSER: "
169 169
 #	stty -echo
170 170
 #	read PW
171 171
 #	stty $savetty
... ...
@@ -252,12 +252,12 @@ prompt_realm()
252 252
 # calculate credentials for admin
253 253
 credentials()
254 254
 {
255
-	HA1=`echo -n "admin:$SIP_DOMAIN:$DEFAULT_PW" | $MD5 | $AWK '{ print $1 }'`
255
+	HA1=`echo -n "admin:$SIP_DOMAIN:$DBRWPW" | $MD5 | $AWK '{ print $1 }'`
256 256
 	if [ $? -ne 0 ] ; then
257 257
 		echo "HA1 calculation failed"
258 258
 		exit 1
259 259
 	fi
260
-	HA1B=`echo -n "admin@$SIP_DOMAIN:$SIP_DOMAIN:$DEFAULT_PW" | $MD5 | $AWK '{ print $1 }'`
260
+	HA1B=`echo -n "admin@$SIP_DOMAIN:$SIP_DOMAIN:$DBRWPW" | $MD5 | $AWK '{ print $1 }'`
261 261
 	if [ $? -ne 0 ] ; then
262 262
 		echo "HA1B calculation failed"
263 263
 		exit 1
... ...
@@ -281,8 +281,8 @@ fi
281 281
 
282 282
 # define constants for database definition
283 283
 USE_CMD='\connect'
284
-GRANT_CMD="CREATE USER $DBRWUSER WITH PASSWORD '$DEFAULT_PW';
285
-	CREATE USER $DBROUSER WITH PASSWORD '$RO_PW';
284
+GRANT_CMD="CREATE USER $DBRWUSER WITH PASSWORD '$DBRWPW';
285
+	CREATE USER $DBROUSER WITH PASSWORD '$DBROPW';
286 286
 	GRANT ALL PRIVILEGES ON TABLE 
287 287
 		version, 
288 288
 		acc, acc_id_seq, 
... ...
@@ -898,7 +898,7 @@ if [ -z "$NO_USER_INIT" ] ; then
898 898
 			($USERCOL, password, first_name, last_name, phone,
899 899
 			email_address, datetime_created, datetime_modified, confirmation,
900 900
 			flag, sendnotification, greeting, ha1, domain, ha1b, phplib_id )
901
-			VALUES ( 'admin', '$DEFAULT_PW', 'Initial', 'Admin', '123',
901
+			VALUES ( 'admin', '$DBRWPW', 'Initial', 'Admin', '123',
902 902
 			'root@localhost', '2002-09-04 19:37:45', '$DUMMY_DATE',
903 903
 			'57DaSIPuCm52UNe54LF545750cfdL48OMZfroM53', 'o', '', '',
904 904
 			'$HA1', '$SIP_DOMAIN', '$HA1B',
... ...
@@ -1104,7 +1104,7 @@ EOF
1104 1104
 		echo "!                                                 !"
1105 1105
 		echo "! There was a default admin user created:         !"
1106 1106
 		echo "!    username: admin@$SIP_DOMAIN "
1107
-		echo "!    password: $DEFAULT_PW       "
1107
+		echo "!    password: $DBRWPW       "
1108 1108
 		echo "!                                                 !"
1109 1109
 		echo "! Please change this password or remove this user !"
1110 1110
 		echo "! from the subscriber and admin_privileges table. !"