Ubuntu build script
[osm/SO.git] / BUILD_UB.sh
1 #
2 # Copyright 2016 RIFT.IO Inc
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 # http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 #
16 # Author(s): Jeremy Mordkoff
17 # Creation Date: 8 Sep 2016 -- cloned from BUILD.sh and adapated for Ubuntu
18 #
19 #
20
21 # BUILD_UB.sh
22 #
23 # This is a top-level build script for RIFT.io
24 #
25 # args none
26 #
27 # dependencies -- requires sudo rights
28
29
30 # ARGS
31
32 PLATFORM_REPOSITORY=${1:-OSM}
33 PLATFORM_VERSION=${2:-4.3.1.0.49164}
34
35 # must be run from the top of a workspace
36 cd $(dirname $0)
37
38 # inside RIFT.io this is an NFS mount
39 # so just to be safe
40 test -h /usr/rift && sudo rm -f /usr/rift
41
42 # enable the right repos
43 curl http://repos.riftio.com/public/xenial-riftware-public-key | sudo apt-key add -
44 sudo curl -o /etc/apt/sources.list.d/${PLATFORM_REPOSITORY}.list http://buildtracker.riftio.com/repo_file/ub16/${PLATFORM_REPOSITORY}/
45 sudo apt-get update
46
47 # and install the tools
48 sudo apt remove -y rw.toolchain-rwbase tcpdump
49 sudo apt-get install -y rw.tools-container-tools rw.tools-scripts python
50
51 # enable the OSM repository hosted by RIFT.io
52 # this contains the RIFT platform code and tools
53 # and install of the packages required to build and run
54 # this module
55 sudo -H /usr/rift/container_tools/mkcontainer --modes build --modes ext --repo ${PLATFORM_REPOSITORY}
56
57
58
59 # install the RIFT platform code:
60 temp=$(mktemp -d /tmp/rw.XXX)
61 pushd $temp
62
63 apt-get download rw.toolchain-rwbase=${PLATFORM_VERSION} \
64 rw.toolchain-rwtoolchain=${PLATFORM_VERSION} \
65 rw.core.mgmt-mgmt=${PLATFORM_VERSION} \
66 rw.core.util-util=${PLATFORM_VERSION} \
67 rw.core.rwvx-rwvx=${PLATFORM_VERSION} \
68 rw.core.rwvx-rwdts=${PLATFORM_VERSION} \
69 rw.automation.core-RWAUTO=${PLATFORM_VERSION} \
70 rw.core.rwvx-rwha-1.0=${PLATFORM_VERSION}
71
72 sudo dpkg -i --force-overwrite *deb
73
74
75 popd
76 rm -rf $temp
77
78 # this file gets in the way of the one generated by the build
79 sudo rm -f /usr/rift/usr/lib/libmano_yang_gen.so
80
81
82 sudo chmod 777 /usr/rift /usr/rift/usr/share
83
84 # install some base files used to create VNFs
85 test -d /usr/rift/images || mkdir /usr/rift/images
86 for file in Fedora-x86_64-20-20131211.1-sda-ping.qcow2 Fedora-x86_64-20-20131211.1-sda-pong.qcow2 Fedora-x86_64-20-20131211.1-sda.qcow2; do
87 test -f /usr/rift/images/$file || curl -o /usr/rift/images/$file http://repo.riftio.com/releases/open.riftio.com/4.3.1/$file
88 done
89
90 ####### If you are re-building, you just need to run
91 # these two steps
92 make -j16
93 sudo make install
94
95 # you can now clone and build the UI using just make && sudo make install
96 # or you can run without the UI, e.g.
97 # note to start the RIFT.io UI please run
98 echo 'sudo -H /usr/rift/rift-shell -r -i /usr/rift -a /usr/rift/.artifacts -- ./demos/launchpad.py --use-xml-mode --no-ui'