OPC-UA support in IOT Gateway Node
[eliot.git] / blueprints / iotgateway / scripts / opc-ua / install.sh
1 #!/bin/bash
2
3 ##############################################################################
4 # Copyright (c) 2019 Huawei Tech and others.
5 #
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Apache License, Version 2.0
8 # which accompanies this distribution, and is available at
9 # http://www.apache.org/licenses/LICENSE-2.0
10 ##############################################################################
11
12 set -o errexit
13
14 # set the docker name and docker tag when you build
15 # export DOCKER_NAME=eliot/opc-ua
16 # export DOCKER_TAG=latest
17
18 export ELIOT_DIR=$(cd $(dirname $0); pwd)
19 export WORK_DIR=$ELIOT_DIR/work
20 export CMAKE_URL=https://github.com/Kitware/CMake/releases/download/v3.15.2/cmake-3.15.2.tar.gz
21 export SCONS_PPA_URL=http://repo.okay.com.mx/centos/7/x86_64/release//scons-2.3.0-1.el7.centos.noarch.rpm
22 export GET_PIP_URL=https://bootstrap.pypa.io/get-pip.py
23 export OPCUA_REPO=https://github.com/edgexfoundry-holding/protocol-opcua-c.git
24 export DOCKER_NAME=${DOCKER_NAME:-"eliot/opc-ua"}
25 export DOCKER_TAG=${DOCKER_TAG:-"latest"}
26
27 # Clean and Create the work directory
28 rm -rf $WORK_DIR
29 mkdir -p $WORK_DIR
30
31 yum install -y gcc git wget
32 yum groupinstall -y 'Development Tools'
33 # Get the package and source code
34 cd $WORK_DIR
35 wget $CMAKE_URL
36 wget $SCONS_PPA_URL
37 wget $GET_PIP_URL
38 git clone $OPCUA_REPO
39
40 # Install Package
41 rpm -Uvh scons-2.3.0-1.el7.centos.noarch.rpm
42 python get-pip.py
43
44 # Build and Install camke
45 tar xzf cmake-3.15.2.tar.gz
46 cd ${WORK_DIR}/cmake-3.15.2
47 ./bootstrap
48 make
49 make install
50
51 # Build the opc-ua server and client
52 cd ${WORK_DIR}/protocol-opcua-c/
53 ./build.sh
54
55 set +x
56 echo "####################################################"
57 echo "# If you want to  start the server, follow below steps"
58 echo "# cd ${WORK_DIR}/protocol-opcua-c/example/out"
59 echo "# ./server"
60 echo "####################################################"
61