Add scripts to install opc-ua
[eliot.git] / scripts / opc-ua / install.sh
1 #!/bin/bash
2 set -o errexit
3
4 # set the docker name and docker tag when you build
5 # export DOCKER_NAME=eliot/opc-ua
6 # export DOCKER_TAG=latest
7
8 export ELIOT_DIR=$(cd $(dirname $0); pwd)
9 export WORK_DIR=$ELIOT_DIR/work
10 export CMAKE_URL=https://github.com/Kitware/CMake/releases/download/v3.15.2/cmake-3.15.2.tar.gz
11 export SCONS_PPA_URL=http://repo.okay.com.mx/centos/7/x86_64/release//scons-2.3.0-1.el7.centos.noarch.rpm
12 export GET_PIP_URL=https://bootstrap.pypa.io/get-pip.py
13 export OPCUA_REPO=https://github.com/edgexfoundry-holding/protocol-opcua-c.git
14 export DOCKER_NAME=${DOCKER_NAME:-"eliot/opc-ua"}
15 export DOCKER_TAG=${DOCKER_TAG:-"latest"}
16
17 # Clean and Create the work directory
18 rm -rf $WORK_DIR
19 mkdir -p $WORK_DIR
20
21 yum install -y gcc git wget
22 yum groupinstall -y 'Development Tools'
23 # Get the package and source code
24 cd $WORK_DIR
25 wget $CMAKE_URL
26 wget $SCONS_PPA_URL
27 wget $GET_PIP_URL
28 git clone $OPCUA_REPO
29
30 # Install Package
31 rpm -Uvh scons-2.3.0-1.el7.centos.noarch.rpm
32 python get-pip.py
33
34 # Build and Install camke
35 tar xzf cmake-3.15.2.tar.gz
36 cd ${WORK_DIR}/cmake-3.15.2
37 ./bootstrap
38 make
39 make install
40
41 # Build the opc-ua server and client
42 cd ${WORK_DIR}/protocol-opcua-c/
43 ./build.sh
44
45 set +x
46 echo "####################################################"
47 echo "# If you want to  start the server, follow below steps"
48 echo "# cd ${WORK_DIR}/protocol-opcua-c/example/out"
49 echo "# ./server"
50 echo "####################################################"
51