3 export BASE_DIR=$( cd "$(dirname "$0")" ; pwd )
5 BINARY_FILE="edge-orchestration"
6 SERVICE_DIR="/etc/systemd/system"
7 BINARY_DIR=$BASE_DIR/"src/CMain/bin"
8 SERVICE_FILE="edge-orchestration.service"
9 DBUS_CONF_FILE="org.tizen.orchestration.conf"
10 DBUS_CONF_FILE_x86="org.tizen.orchestration.conf.amd64"
11 DBUS_SERVICE_FILE="org.tizen.orchestration.service"
12 DBUS_CONF_DIR="/etc/dbus-1/system.d"
13 DBUS_SERVICE_DIR="/usr/share/dbus-1/system-services"
21 echo "*****************************"
22 echo " Target Binary arch is amd64 "
23 echo "*****************************"
28 echo "*****************************"
29 echo " Target Binary arch is armv7 "
30 echo "*****************************"
31 export GOARCH=arm GOARM=7
32 export CC="arm-linux-gnueabi-gcc"
37 echo "---------------------------------------------------------"
38 echo " $0 : build Go executable binary for amd64 "
39 echo " $0 all : build C executable binary for amd64 "
40 echo " $0 arm : build Go object for arm"
41 echo " $0 tizen : build arm packages for Tizen"
42 echo "---------------------------------------------------------"
47 export GOPATH=$GOPATH:$BASE_DIR:$BASE_DIR/vendor
49 ORG_VENDOR_DIR='vendor'
50 CUR_VENDOR_DIR='vendor/src'
51 if [ ! -d $BASE_DIR/$CUR_VENDOR_DIR ]; then
52 ln -s $BASE_DIR/$ORG_VENDOR_DIR $BASE_DIR/$CUR_VENDOR_DIR
55 function install_prerequisite() {
57 echo "-----------------------------------"
58 echo " Install prerequisite packages"
59 echo "-----------------------------------"
60 go get github.com/axw/gocov/gocov
61 go get github.com/matm/gocov-html
62 go get github.com/Songmu/make2help/cmd/make2help
65 function build_clean() {
67 echo "-----------------------------------"
69 echo "-----------------------------------"
73 function build_binary() {
75 echo "----------------------------------------"
76 echo " Create Executable binary from GoMain"
77 echo "----------------------------------------"
81 function build_object() {
83 echo "----------------------------------------"
84 echo " Create Static object of Orchestration"
85 echo "----------------------------------------"
89 function build_dbus() {
91 echo "----------------------------------------"
92 echo " Create Executable binary from CMain"
93 echo "----------------------------------------"
94 make build-dbus-server
97 echo "--------------------------------------------------"
98 echo " Create Shared Object from libedge-orchestration"
99 echo "--------------------------------------------------"
100 make build-dbus-client
103 function build_test() {
105 echo "-------------------------------------"
106 echo " Build test to calculate Coverage"
107 echo "-------------------------------------"
108 sudo systemctl stop ${SERVICE_FILE}
109 sudo systemctl status ${SERVICE_FILE}
114 function lint_src_code() {
116 echo "---------------------------------------"
117 echo " Analysis source code golint & go vet"
118 echo "---------------------------------------"
122 function build_package() {
124 echo "------------------------------------------"
125 echo " Create Packages for Tizen from gbs build"
126 echo "------------------------------------------"
128 gbs -c ./.tizen.gbs.conf build -A armv7l --include-all
130 ### build through go toolchain
131 #gbs -c ./.tizen.gbs.conf build -A armv7l --include-all --define 'go_build ON'
134 function register_service() {
136 echo "-----------------------------------"
137 echo " Create Service File [SuperUser]"
138 echo "-----------------------------------"
140 sudo systemctl stop $SERVICE_FILE
141 sudo cp $BINARY_DIR/$BINARY_FILE /usr/bin
142 sudo cp $BASE_DIR/packaging/$SERVICE_FILE $SERVICE_DIR
143 sudo cp $BASE_DIR/packaging/$DBUS_CONF_FILE_x86 $DBUS_CONF_DIR/$DBUS_CONF_FILE
144 sudo cp $BASE_DIR/packaging/$DBUS_SERVICE_FILE $DBUS_SERVICE_DIR
145 ls -al $SERVICE_DIR | grep $SERVICE_FILE
148 echo "----------------------------------------"
149 echo " Register Edge-Orchestration Service"
150 echo "----------------------------------------"
152 sudo systemctl daemon-reload
153 sudo systemctl restart $SERVICE_FILE
154 sudo systemctl status $SERVICE_FILE
157 if [ "$1" == "ubuntu" ]; then
168 elif [ "$2" == "test" ]
171 elif [ "$2" == "status" ]
173 sudo systemctl status ${SERVICE_FILE}
174 elif [ "$2" == "start" ]
176 sudo systemctl daemon-reload
177 sudo systemctl start ${SERVICE_FILE}
178 sudo systemctl status ${SERVICE_FILE}
179 elif [ "$2" == "stop" ]
181 sudo systemctl stop ${SERVICE_FILE}
182 sudo systemctl status ${SERVICE_FILE}
183 elif [ "$2" == "restart" ]
185 sudo systemctl daemon-reload
186 sudo systemctl restart ${SERVICE_FILE}
187 sudo systemctl status ${SERVICE_FILE}
192 elif [ "$1" == "tizen" ]; then