3 # Copyright 2016 RIFT.IO Inc
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 # Author(s): Jeremy Mordkoff
18 # Creation Date: 8 Sep 2016 -- cloned from BUILD.sh and adapated for Ubuntu
24 # This is a top-level build script for RIFT.io
26 # Arguments and options: use -h or --help
28 # dependencies -- requires sudo rights
30 ###############################################################################
31 # Options and arguments
33 params
="$(getopt -o suhb: -l install-so,install-ui,build-ui:,help --name "$0" -- "$@
")"
34 if [ $?
!= 0 ] ; then echo "Failed parsing options." >&2 ; exit 1 ; fi
44 -s|
--install-so) installSO
=true
; shift;;
45 -u|
--install-ui) installUI
=true
; shift;;
46 -b|
--build-ui) shift; UIPathToBuild
=$1; shift;;
54 echo " $0 [-o] [-u|-b PATH-TO-UI-REPO] [PLATFORM_REPOSITORY] [PLATFORM_VERSION]"
57 echo " Prepare current system to run SO and UI. By default, the system"
58 echo " is set up to support building SO and UI; optionally, either or"
59 echo " both SO and UI can be installed from a Debian package repository."
61 echo " -o|--install-so: install SO from package"
62 echo " -u|--install-ui: install UI from package"
63 echo " -b|--build-ui PATH-TO-UI-REPO: build the UI in the specified repo"
64 echo " PLATFORM_REPOSITORY (optional): name of the RIFT.ware repository."
65 echo " PLATFORM_VERSION (optional): version of the platform packages to be installed."
69 *) echo "Not implemented: $1" >&2; exit 1;;
73 if $installUI && [[ $UIPathToBuild ]]; then
74 echo "Cannot both install and build the UI!"
78 if [[ $UIPathToBuild && ! -d $UIPathToBuild ]]; then
79 echo "Not a directory: $UIPathToBuild"
84 PLATFORM_REPOSITORY
=${1:-OSM}
85 PLATFORM_VERSION
=${2:-4.3.1.0.49556}
87 ###############################################################################
90 # Turn these on after handling options, so the output doesn't get cluttered.
91 set -o errexit
# Exit on any error
92 set -x # Print commands before executing them
94 # must be run from the top of a workspace
97 # inside RIFT.io this is an NFS mount
99 test -h /usr
/rift
&& sudo
rm -f /usr
/rift
101 # enable the right repos
102 curl http
://repos.riftio.com
/public
/xenial-riftware-public-key | sudo apt-key add
-
103 sudo curl
-o /etc
/apt
/sources.list.d
/${PLATFORM_REPOSITORY}.list http
://buildtracker.riftio.com
/repo_file
/ub16
/${PLATFORM_REPOSITORY}/
106 # and install the tools
107 sudo apt remove
-y rw.toolchain-rwbase tcpdump
108 sudo apt-get
install -y rw.tools-container-tools rw.tools-scripts python
110 # enable the OSM repository hosted by RIFT.io
111 # this contains the RIFT platform code and tools
112 # and install of the packages required to build and run
114 sudo
-H /usr
/rift
/container_tools
/mkcontainer
--modes build
--modes ext
--repo ${PLATFORM_REPOSITORY}
118 # install the RIFT platform code:
119 sudo apt-get
install -y rw.toolchain-rwbase
=${PLATFORM_VERSION} \
120 rw.toolchain-rwtoolchain
=${PLATFORM_VERSION} \
121 rw.core.mgmt-mgmt
=${PLATFORM_VERSION} \
122 rw.core.util-util
=${PLATFORM_VERSION} \
123 rw.core.rwvx-rwvx
=${PLATFORM_VERSION} \
124 rw.core.rwvx-rwdts
=${PLATFORM_VERSION} \
125 rw.automation.core-RWAUTO
=${PLATFORM_VERSION} \
126 rw.core.rwvx-rwha-1.0
=${PLATFORM_VERSION}
128 sudo
chmod 777 /usr
/rift
/usr
/rift
/usr
/share
131 sudo apt-get
install -y \
132 rw.core.mc-\
*=${PLATFORM_VERSION}
136 sudo apt-get
install -y \
137 rw.ui-about
=${PLATFORM_VERSION} \
138 rw.ui-logging
=${PLATFORM_VERSION} \
139 rw.ui-skyquake
=${PLATFORM_VERSION} \
140 rw.ui-accounts
=${PLATFORM_VERSION} \
141 rw.ui-composer
=${PLATFORM_VERSION} \
142 rw.ui-launchpad
=${PLATFORM_VERSION} \
143 rw.ui-debug
=${PLATFORM_VERSION} \
144 rw.ui-config
=${PLATFORM_VERSION} \
145 rw.ui-dummy_component
=${PLATFORM_VERSION}
148 # install some base files used to create VNFs
149 test -d /usr
/rift
/images || mkdir
/usr
/rift
/images
150 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
151 test -f /usr
/rift
/images
/$file || curl
-o /usr
/rift
/images
/$file http
://repo.riftio.com
/releases
/open.riftio.com
/4.3.1/$file
154 # If you are re-building SO, you just need to run
156 if ! $installSO; then
161 if [[ $UIPathToBuild ]]; then
162 make -C $UIPathToBuild -j16
163 sudo
make -C $UIPathToBuild install
166 echo "To run SO with UI please run:"
167 echo 'sudo -H /usr/rift/rift-shell -r -i /usr/rift -a /usr/rift/.artifacts -- ./demos/launchpad.py --use-xml-mode'
169 echo "To run SO without UI please run:"
170 echo 'sudo -H /usr/rift/rift-shell -r -i /usr/rift -a /usr/rift/.artifacts -- ./demos/launchpad.py --use-xml-mode --no-ui'