-
Notifications
You must be signed in to change notification settings - Fork 11
/
build
executable file
·224 lines (211 loc) · 6.29 KB
/
build
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
#!/bin/bash
# -*- tab-width:4;indent-tabs-mode:nil -*-
# ex: ts=4 sw=4 et
#: Title : build
#: Date : 2012-04-24
#: Author : "Ery Lee" <[email protected]> from opengoss.com
#: Version : 1.0
#: Description : build server, node, tasks packets
ROOT_DIR=$(cd ${0%/*} && pwd)
REL_DIR=$ROOT_DIR/rel
DATE=`date +%Y%m%d`
VSN="6.4.2"
# Identify the script name
SCRIPT=`basename $0`
SERVER_LIBS="server/lib/agent/ebin \
server/lib/amqp_client/ebin \
server/lib/elog/ebin \
server/lib/extlib/ebin \
server/lib/evmon/ebin \
server/lib/lager/ebin \
server/lib/rabbit_common/ebin \
server/lib/sesnmp/ebin \
server/lib/errdb/ebin \
server/lib/emysql/ebin \
server/lib/worker_pool/ebin \
server/lib/mochiweb/ebin"
NODE_LIBS="node/lib/agent/ebin \
node/lib/amqp_client/ebin \
node/lib/elog/ebin \
node/lib/evmon/ebin \
node/lib/extlib/ebin \
node/lib/errdb/ebin \
node/lib/lager/ebin \
node/lib/mochiweb/ebin \
node/lib/worker_pool/ebin \
node/lib/rabbit_common/ebin \
node/lib/sesnmp/ebin"
TRAPD_LIBS="trapd/lib/agent/ebin \
trapd/lib/amqp_client/ebin \
trapd/lib/elog/ebin \
trapd/lib/extlib/ebin \
trapd/lib/lager/ebin \
trapd/lib/worker_pool/ebin \
trapd/lib/mochiweb/ebin \
trapd/lib/rabbit_common/ebin \
trapd/lib/sesnmp/ebin"
# Check the first argument for instructions
case "$1" in
server)
if [ $# -lt 2 ]; then
echo "Usage: $SCRIPT server ipkg | upkg"
exit 1
fi
PKG=$REL_DIR/mobile-server-$VSN-$2-$DATE.tgz
SERVER_DIR=$REL_DIR/server
mkdir -p $SERVER_DIR
rsync -r --exclude=.git $ROOT_DIR/lib $SERVER_DIR
rsync -r $ROOT_DIR/mit --exclude=var --exclude=log --exclude=src $SERVER_DIR
rsync -r $ROOT_DIR/evabus --exclude=var --exclude=log --exclude=src $SERVER_DIR
rsync -r $ROOT_DIR/statd --exclude=var --exclude=log --exclude=src $SERVER_DIR
rsync -r $ROOT_DIR/metrix --exclude=var --exclude=log --exclude=src $SERVER_DIR
rsync -r $ROOT_DIR/wifioss --exclude=var --exclude=log --exclude=src $SERVER_DIR
rsync -r $ROOT_DIR/wifista --exclude=var --exclude=log --exclude=src $SERVER_DIR
cp $ROOT_DIR/run $SERVER_DIR
cp $ROOT_DIR/setting $SERVER_DIR
cp $ROOT_DIR/check $SERVER_DIR
cp $ROOT_DIR/start $SERVER_DIR
cp $ROOT_DIR/stop $SERVER_DIR
cp $ROOT_DIR/README $SERVER_DIR/README
cp $ROOT_DIR/INSTALL $SERVER_DIR/INSTALL
cd $REL_DIR
MIT_DIR=server/mit
mkdir -p $MIT_DIR/var/mnesia
EVABUS_DIR=server/evabus
mkdir -p $EVABUS_DIR/var/mnesia
STATD_DIR=server/statd
mkdir -p $STATD_DIR/var/mnesia
METRIX_DIR=server/metrix
mkdir -p $METRIX_DIR/var/mnesia
WIFIOSS_DIR=server/wifioss
mkdir -p $WIFIOSS_DIR/var/mnesia
WIFISTA_DIR=server/wifista
mkdir -p $WIFISTA_DIR/var/mnesia
if [ $2 == 'ipkg' ]; then
tar czf $PKG $SERVER_LIBS \
server/README server/INSTALL server/setting \
server/start server/stop server/run server/check \
$MIT_DIR/bin $MIT_DIR/ebin $MIT_DIR/etc $MIT_DIR/var \
$EVABUS_DIR/bin $EVABUS_DIR/ebin $EVABUS_DIR/etc $EVABUS_DIR/var \
$METRIX_DIR/bin $METRIX_DIR/ebin $METRIX_DIR/etc $METRIX_DIR/var \
$STATD_DIR/bin $STATD_DIR/ebin $STATD_DIR/etc $STATD_DIR/var \
$WIFIOSS_DIR/bin $WIFIOSS_DIR/ebin $WIFIOSS_DIR/etc $WIFIOSS_DIR/var \
$WIFISTA_DIR/bin $WIFISTA_DIR/ebin $WIFISTA_DIR/etc $WIFISTA_DIR/var
fi
if [ $2 == 'upkg' ]; then
tar czf $PKG \
$SERVER_LIBS \
$MIT_DIR/ebin $MIT_DIR/bin \
$EVABUS_DIR/ebin \
$METRIX_DIR/ebin \
$STATD_DIR/ebin \
$WIFIOSS_DIR/ebin \
$WIFISTA_DIR/ebin
fi
echo "success: $PKG"
;;
node)
if [ $# -lt 2 ]; then
echo "Usage: $SCRIPT node ipkg | upkg"
exit 1
fi
PKG=$REL_DIR/mobile-node-$VSN-$2-$DATE.tgz
NODE_DIR=$REL_DIR/node
mkdir -p $NODE_DIR
rsync -r --exclude=.git $ROOT_DIR/lib $NODE_DIR
rsync -r --exclude=lib --exclude=log --exclude=var --exclude=src $ROOT_DIR/node/* $NODE_DIR
cd $REL_DIR
if [ $2 == 'ipkg' ]; then
mkdir -p node/log
mkdir -p node/var/mnesia
tar czf $PKG \
$NODE_LIBS node/README node/INSTALL \
node/start node/stop node/setting \
node/hpstart \
node/bin node/ebin \
node/etc node/var \
node/log
fi
if [ $2 == 'upkg' ]; then
tar czf $PKG $NODE_LIBS \
node/etc/*.origin \
node/ebin
fi
echo "success: rel/$PKG"
;;
tasks)
if [ $# -lt 2 ]; then
echo "Usage: $SCRIPT tasks ipkg | upkg"
exit 1
fi
PKG=$REL_DIR/mobile-tasks-$VSN-$2-$DATE.tgz
rsync -r --exclude=.git $ROOT_DIR/lib $ROOT_DIR/tasks/report/
if [ $2 == 'ipkg' ]; then
tar czf $PKG tasks/setting \
tasks/INSTALL tasks/README \
tasks/*.cron tasks/*.task \
tasks/report/README \
tasks/report/oraload.sh \
tasks/report/process.erl \
tasks/report/rrdbexp.py \
tasks/report/ebin \
tasks/report/etc \
tasks/report/log \
tasks/report/tmp \
tasks/report/lib/elog/ebin \
tasks/report/lib/extlib/ebin \
tasks/report/lib/lager/ebin \
tasks/report/lib/emysql/ebin
fi
if [ $2 == 'upkg' ]; then
tar czf $PKG tasks/README \
tasks/*.task \
tasks/report/README \
tasks/report/oraload.sh \
tasks/report/process.erl \
tasks/report/rrdbexp.py \
tasks/report/ebin \
tasks/report/lib/elog/ebin \
tasks/report/lib/extlib/ebin \
tasks/report/lib/lager/ebin \
tasks/report/lib/emysql/ebin
fi
rm -rf $ROOT_DIR/tasks/report/lib
echo "success: rel/$PKG"
;;
trapd)
PKG=$REL_DIR/mobile-trapd-$VSN-$2-$DATE.tgz
TRAP_DIR=$REL_DIR/trapd
mkdir -p $TRAP_DIR
rsync -r --exclude=.git $ROOT_DIR/lib $TRAP_DIR
rsync -r --exclude=lib --exclude=log $ROOT_DIR/trapd/* $TRAP_DIR
cd $REL_DIR
if [ $2 == 'ipkg' ]; then
mkdir -p trapd/log
tar czf $PKG trapd/README trapd/INSTALL \
trapd/start trapd/stop trapd/setting \
trapd/bin trapd/ebin \
trapd/etc trapd/log \
$TRAPD_LIBS
echo "success: $PKG"
fi
if [ $2 == 'upkg' ]; then
tar czf $PKG $TRAPD_LIBS trapd/ebin
echo "success: $PKG"
fi
;;
clean)
if [ -d $REL_DIR ]; then
cd $REL_DIR && rm -rf *
fi
;;
*)
echo "Usage: $SCRIPT {server | tasks | node | trapd | clean}"
echo " server ipkg | upkg #build server package"
echo " tasks ipkg | upkg #build tasks package"
echo " node ipkg | upkg #build node package"
echo " trapd ipkg | upkg #build node package"
exit 1
;;
esac
exit 0