forked from weimeilin79/iot-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.sh
executable file
·123 lines (103 loc) · 3.71 KB
/
init.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#!/bin/sh
DEMO="JBoss A-MQ Biomedical IoT Demo"
VERSION=6.1.0
AUTHORS="Christina Lin"
PROJECT="[email protected]:weimeilin79/amqp-demo-web-biomedical.git"
AMQ=jboss-a-mq-6.1.0.redhat-379
AMQ_BIN=jboss-a-mq-6.1.0.redhat-379.zip
DEMO_HOME=./target
AMQ_HOME=$DEMO_HOME/$AMQ
SERVER_CONF=$AMQ_HOME/etc
SERVER_BIN=$AMQ_HOME/bin
SRC_DIR=./installs
PRJ_DIR=./projects/amqp-example-web
PRJ2_DIR=./projects/mqtt-drools
# wipe screen.
clear
# add executeable in installs
chmod +x installs/*.zip
echo
echo "#################################################################"
echo "## ##"
echo "## Setting up the ${DEMO} ##"
echo "## ##"
echo "## ##"
echo "## ### # # ### ##"
echo "## # # ## ## # # ##"
echo "## ##### ### # # # # # ##"
echo "## # # # # # ## ##"
echo "## # # # # ##### ##"
echo "## ##"
echo "## ##"
echo "## brought to you by, ##"
echo "## ${AUTHORS} ##"
echo "## ##"
echo "## ${PROJECT} ##"
echo "## ##"
echo "#################################################################"
echo
# double check for maven.
command -v mvn -q >/dev/null 2>&1 || { echo >&2 "Maven is required but not installed yet... aborting."; exit 1; }
# make some checks first before proceeding.
if [[ -r $SRC_DIR/$AMQ_BIN || -L $SRC_DIR/$AMQ_BIN ]]; then
echo $DEMO sources are present...
echo
else
echo Need to download $AMQ_BIN package from the Customer Support Portal
echo and place it in the $SRC_DIR directory to proceed...
echo
exit
fi
# Create the target directory if it does not already exist.
if [ ! -x $DEMO_HOME ]; then
echo " - creating the demo home directory..."
echo
mkdir $DEMO_HOME
else
echo " - detected demo home directory, moving on..."
echo
fi
# Move the old JBoss instance, if it exists, to the OLD position.
if [ -x $AMQ_HOME ]; then
echo " - existing JBoss AMQ detected..."
echo
echo " - moving existing JBoss AMQ aside..."
echo
rm -rf $AMQ_HOME.OLD
mv $AMQ_HOME $AMQ_HOME.OLD
# Unzip the JBoss instance.
echo Unpacking JBoss AMQ $VERSION
echo
unzip -q -d $DEMO_HOME $SRC_DIR/$AMQ_BIN
else
# Unzip the JBoss instance.
echo Unpacking new JBoss AMQ...
echo
unzip -q -d $DEMO_HOME $SRC_DIR/$AMQ_BIN
fi
echo " - enabling demo accounts logins in users.properties file..."
echo
cp support/users.properties $SERVER_CONF
echo " - copying updated JBoss A-MQ configuration file activemq.xml from project..."
echo
cp support/activemq.xml $SERVER_CONF/activemq.xml
echo " - making sure 'AMQ' for server is executable..."
echo
chmod u+x $AMQ_HOME/bin/amq
echo Now going to build the project.
echo
cd $PRJ_DIR
mvn clean install -DskipTests
echo Now going to build the project.
echo
cd $PRJ2_DIR
mvn clean install -DskipTests
echo
echo You have two steps to start the demo:
echo
echo "First you can start the WEB Dashboard in $PRJ_DIR by executing 'mvn jetty:run'"
echo
echo "Then you need to start the $PRODUCT with $SERVER_BIN/amq"
echo
echo Red Hat $DEMO $VERSION Setup Completed.
echo