This repository has been archived by the owner on Jan 19, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathsdm_nsp_install.sh
executable file
·51 lines (36 loc) · 1.65 KB
/
sdm_nsp_install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
set -e
set -u
if [ -n "${db_admin_password}" ]; then
mysql_admin_connect="${mysql_dir}/bin/mysql -u ${db_admin_user} -p${db_admin_password}"
else
mysql_admin_connect="${mysql_dir}/bin/mysql -u ${db_admin_user}"
fi
if [ -n "${db_password}" ]; then
mysql_user_connect="${mysql_dir}/bin/mysql -u ${db_username} -p${db_password}"
else
mysql_user_connect="${mysql_dir}/bin/mysql -u ${db_username}"
fi
## Create the trifork database user
num_users=$(${mysql_admin_connect} -D mysql -N -e "select count(*) from user where user='${db_username}';" | grep 0 || true)
if [ "${num_users}" != "0" ]; then
#echo "DROP USER 'trifork'@'%';" > sql/drop_trifork_user.sql
#${mysql_admin_connect} < sql/drop_trifork_user.sql
echo "User trifork already present on this MySQL instance"
else
echo "Creating user trifork"
${mysql_admin_connect} < sql/create_trifork_mysql_user.sql
fi
### Create database stamdata
echo "DROP DATABASE IF EXISTS stamdata;" > sql/stamdata/drop_db_stamdata.sql
echo "Dropping database stamdata"
${mysql_admin_connect} -v < sql/stamdata/drop_db_stamdata.sql
echo "Creating database stamdata"
## Create stamdata database
${mysql_admin_connect} < sql/stamdata/create_db_stamdata.sql
## Create schema in stamdata database
${mysql_user_connect} stamdata < sql/stamdata/schema.sql
echo "Replacing jboss.server.config.url placeholder i nspslalog properties with path to jboss conf folder"
find . -type f -name "nspslalog*.properties" -exec sed -i.orig -e "s|\\\${jboss.server.config.url}|${jboss_conf_url}|g" {} \;
echo "Please verify that only the archives you expect to exist in the deploy dir is there"
find ${jboss_deploy_dir}/ -name "*.war"