@@ -223,18 +223,18 @@ function ensure_mysql_application_db() {
223223 if [ -z " $DD_DATABASE_USER " ]; then
224224 DD_DATABASE_USER=" root"
225225 fi
226- if [ -z " $DD_DATABASE_PASsWORD " -a " $BATCH_MODE " == " yes" ]; then
226+ if [ -z " $DD_DATABASE_PASSWORD " -a " $BATCH_MODE " == " yes" ]; then
227227 echo " SQL Password not provided, exiting"
228228 exit 1
229229 else
230- DD_DATABASE_PASsWORD =" dojodb_install"
230+ DD_DATABASE_PASSWORD =" dojodb_install"
231231 fi
232232 if [ -z " $DD_DATABASE_NAME " ]; then
233233 DD_DATABASE_NAME=" dojodb"
234234 fi
235235 fi
236236
237- if mysql -fs --protocol=TCP -h " $DD_DATABASE_HOST " -P " $DD_DATABASE_PORT " -u" $DD_DATABASE_USER " -p" $DD_DATABASE_PASsWORD " " $DD_DATABASE_NAME " > /dev/null 2>&1 < /dev/null; then
237+ if mysql -fs --protocol=TCP -h " $DD_DATABASE_HOST " -P " $DD_DATABASE_PORT " -u" $DD_DATABASE_USER " -p" $DD_DATABASE_PASSWORD " " $DD_DATABASE_NAME " > /dev/null 2>&1 < /dev/null; then
238238 echo " Database $DD_DATABASE_NAME already exists!"
239239 echo
240240 if [ " $AUTO_DOCKER " == " yes" ] || [ " $BATCH_MODE " == " yes" ]; then
@@ -247,15 +247,15 @@ function ensure_mysql_application_db() {
247247 read -p " Drop database $DD_DATABASE_NAME ? [Y/n] " DELETE
248248 fi
249249 if [[ ! $DELETE =~ ^[nN]$ ]]; then
250- mysqladmin -f --protocol=TCP --host=" $DD_DATABASE_HOST " --port=" $DD_DATABASE_PORT " --user=" $DD_DATABASE_USER " --password=" $DD_DATABASE_PASsWORD " drop " $DD_DATABASE_NAME "
251- mysqladmin --protocol=TCP --host=" $DD_DATABASE_HOST " --port=" $DD_DATABASE_PORT " --user=" $DD_DATABASE_USER " --password=" $DD_DATABASE_PASsWORD " create " $DD_DATABASE_NAME "
250+ mysqladmin -f --protocol=TCP --host=" $DD_DATABASE_HOST " --port=" $DD_DATABASE_PORT " --user=" $DD_DATABASE_USER " --password=" $DD_DATABASE_PASSWORD " drop " $DD_DATABASE_NAME "
251+ mysqladmin --protocol=TCP --host=" $DD_DATABASE_HOST " --port=" $DD_DATABASE_PORT " --user=" $DD_DATABASE_USER " --password=" $DD_DATABASE_PASSWORD " create " $DD_DATABASE_NAME "
252252 fi
253253 else
254254 echo " Setting password..."
255255 # Set the root password for mysql
256256 set_random_mysql_db_pwd
257257 sudo service mysql start
258- if mysqladmin --protocol=TCP --host=" $DD_DATABASE_HOST " --port=" $DD_DATABASE_PORT " --user=" $DD_DATABASE_USER " --password=" $DD_DATABASE_PASsWORD " create $DD_DATABASE_NAME ; then
258+ if mysqladmin --protocol=TCP --host=" $DD_DATABASE_HOST " --port=" $DD_DATABASE_PORT " --user=" $DD_DATABASE_USER " --password=" $DD_DATABASE_PASSWORD " create $DD_DATABASE_NAME ; then
259259 echo " Created database $DD_DATABASE_NAME ."
260260 else
261261 echo " Error! Failed to create database $DD_DATABASE_NAME . Check your credentials."
@@ -271,18 +271,18 @@ function ensure_postgres_application_db() {
271271 read -p " Postgres port: " $DD_DATABASE_PORT
272272 read -p " Postgres user (should already exist): " $DD_DATABASE_USER
273273 stty -echo
274- read -p " Password for user: " $DD_DATABASE_PASsWORD ; echo
274+ read -p " Password for user: " $DD_DATABASE_PASSWORD ; echo
275275 stty echo
276276 read -p " Database name (should NOT exist): " $DD_DATABASE_NAME
277277
278- if [ " $( PGPASSWORD=$DD_DATABASE_PASsWORD psql -h $DD_DATABASE_HOST -p $DD_DATABASE_PORT -U $DD_DATABASE_USER -tAc " SELECT 1 FROM pg_database WHERE datname='$DD_DATABASE_NAME '" ) " = ' 1' ]
278+ if [ " $( PGPASSWORD=$DD_DATABASE_PASSWORD psql -h $DD_DATABASE_HOST -p $DD_DATABASE_PORT -U $DD_DATABASE_USER -tAc " SELECT 1 FROM pg_database WHERE datname='$DD_DATABASE_NAME '" ) " = ' 1' ]
279279 then
280280 echo " Database $DD_DATABASE_NAME already exists!"
281281 echo
282282 read -p " Drop database $DD_DATABASE_NAME ? [Y/n] " DELETE
283283 if [[ ! $DELETE =~ ^[nN]$ ]]; then
284- PGPASSWORD=$DD_DATABASE_PASsWORD dropdb $DD_DATABASE_NAME -h $DD_DATABASE_HOST -p $DD_DATABASE_PORT -U $DD_DATABASE_USER
285- PGPASSWORD=$DD_DATABASE_PASsWORD createdb $DD_DATABASE_NAME -h $DD_DATABASE_HOST -p $DD_DATABASE_PORT -U $DD_DATABASE_USER
284+ PGPASSWORD=$DD_DATABASE_PASSWORD dropdb $DD_DATABASE_NAME -h $DD_DATABASE_HOST -p $DD_DATABASE_PORT -U $DD_DATABASE_USER
285+ PGPASSWORD=$DD_DATABASE_PASSWORD createdb $DD_DATABASE_NAME -h $DD_DATABASE_HOST -p $DD_DATABASE_PORT -U $DD_DATABASE_USER
286286 else
287287 read -p " Try and install anyway? [Y/n] " INSTALL
288288 if [[ $INSTALL =~ ^[nN]$ ]]; then
@@ -291,7 +291,7 @@ function ensure_postgres_application_db() {
291291 fi
292292 fi
293293 else
294- PGPASSWORD=$DD_DATABASE_PASsWORD createdb $DD_DATABASE_NAME -h $DD_DATABASE_HOST -p $DD_DATABASE_PORT -U $DD_DATABASE_USER
294+ PGPASSWORD=$DD_DATABASE_PASSWORD createdb $DD_DATABASE_NAME -h $DD_DATABASE_HOST -p $DD_DATABASE_PORT -U $DD_DATABASE_USER
295295 if [ $? = 0 ]
296296 then
297297 echo " Created database $DD_DATABASE_NAME ."
@@ -447,10 +447,10 @@ function prepare_settings_file() {
447447 if [ " $DBTYPE " == " $SQLITE " ]; then
448448 echo ' DD_DATABASE_URL="sqlite:///defectdojo.db"' >> ${ENV_SETTINGS_FILE}
449449 elif [ " $DBTYPE " == " $MYSQL " ]; then
450- SAFE_URL=$( urlenc " $DD_DATABASE_USER " ) " :" $( urlenc " $DD_DATABASE_PASsWORD " ) " @" $( urlenc " $DD_DATABASE_HOST " ) " :" $( urlenc " $DD_DATABASE_PORT " ) " /" $( urlenc " $DD_DATABASE_NAME " )
450+ SAFE_URL=$( urlenc " $DD_DATABASE_USER " ) " :" $( urlenc " $DD_DATABASE_PASSWORD " ) " @" $( urlenc " $DD_DATABASE_HOST " ) " :" $( urlenc " $DD_DATABASE_PORT " ) " /" $( urlenc " $DD_DATABASE_NAME " )
451451 echo " DD_DATABASE_URL=mysql://$SAFE_URL " >> ${ENV_SETTINGS_FILE}
452452 elif [ " $DBTYPE " == " $POSTGRES " ]; then
453- SAFE_URL=$( urlenc " $DD_DATABASE_USER " ) " :" $( urlenc " $DD_DATABASE_PASsWORD " ) " @" $( urlenc " $DD_DATABASE_HOST " ) " :" $( urlenc " $DD_DATABASE_PORT " ) " /" $( urlenc " $DD_DATABASE_NAME " )
453+ SAFE_URL=$( urlenc " $DD_DATABASE_USER " ) " :" $( urlenc " $DD_DATABASE_PASSWORD " ) " @" $( urlenc " $DD_DATABASE_HOST " ) " :" $( urlenc " $DD_DATABASE_PORT " ) " /" $( urlenc " $DD_DATABASE_NAME " )
454454 echo " DD_DATABASE_URL=postgres://$SAFE_URL " >> ${ENV_SETTINGS_FILE}
455455 fi
456456
@@ -540,10 +540,10 @@ function set_random_mysql_db_pwd() {
540540 sudo mysqld_safe --skip-grant-tables > /dev/null 2>&1 &
541541 sleep 5
542542 DB_ROOT_PASS_LEN=` shuf -i 50-60 -n 1`
543- if [[ -z " $DD_DATABASE_PASsWORD " ]]; then
544- DD_DATABASE_PASsWORD =` pwgen -scn $DB_ROOT_PASS_LEN 1`
543+ if [[ -z " $DD_DATABASE_PASSWORD " ]]; then
544+ DD_DATABASE_PASSWORD =` pwgen -scn $DB_ROOT_PASS_LEN 1`
545545 fi
546- mysql mysql -e " UPDATE user SET authentication_string=PASSWORD('$DD_DATABASE_PASsWORD '), plugin='mysql_native_password' WHERE User='root';FLUSH PRIVILEGES;"
546+ mysql mysql -e " UPDATE user SET authentication_string=PASSWORD('$DD_DATABASE_PASSWORD '), plugin='mysql_native_password' WHERE User='root';FLUSH PRIVILEGES;"
547547 sudo service mysql stop
548548}
549549
0 commit comments