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, Lezz Giles
18 # Creation Date: 08/29/2016
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 [-s] [-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 " -s|--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"
83 PLATFORM_REPOSITORY
=${1:-OSM} # change to OSM when published
84 PLATFORM_VERSION
=${2:-4.3.1.0.49553-1}
86 ###############################################################################
89 # Turn these on after handling options, so the output doesn't get cluttered.
90 set -o errexit
# Exit on any error
91 set -x # Print commands before executing them
93 # must be run from the top of a workspace
99 # inside RIFT.io this is an NFS mount
101 test -h /usr
/rift
&& sudo
rm -f /usr
/rift
103 # get the container tools from the correct repository
104 sudo
rm -f /etc
/yum.repos.d
/private.repo
105 sudo curl
-o /etc
/yum.repos.d
/${PLATFORM_REPOSITORY}.repo \
106 http
://buildtracker.riftio.com
/repo_file
/fc20
/${PLATFORM_REPOSITORY}/
107 sudo yum
install --assumeyes rw.tools-container-tools rw.tools-scripts
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
/usr
/rift
/container_tools
/mkcontainer
--modes build
--modes ext
--repo ${PLATFORM_REPOSITORY}
116 temp
=$
(mktemp
-d /tmp
/rw.XXX
)
119 # yum does not accept the --nodeps and --replacefiles options so we
120 # download first and then install
121 yumdownloader rw.toolchain-rwbase-
${PLATFORM_VERSION} \
122 rw.toolchain-rwtoolchain-
${PLATFORM_VERSION} \
123 rw.core.mgmt-mgmt-
${PLATFORM_VERSION} \
124 rw.core.util-util-
${PLATFORM_VERSION} \
125 rw.core.rwvx-rwvx-
${PLATFORM_VERSION} \
126 rw.core.rwvx-rwha-1.0
-${PLATFORM_VERSION} \
127 rw.core.rwvx-rwdts-
${PLATFORM_VERSION} \
128 rw.automation.core-RWAUTO-
${PLATFORM_VERSION}
130 sudo rpm
-i --replacefiles --nodeps *rpm
134 # this file gets in the way of the one generated by the build
135 sudo
rm -f /usr
/rift
/usr
/lib
/libmano_yang_gen.so
138 sudo
chmod 777 /usr
/rift
/usr
/rift
/usr
/share
141 sudo apt-get
install -y \
142 rw.core.mc-\
*-${PLATFORM_VERSION}
146 sudo apt-get
install -y \
147 rw.ui-about-
${PLATFORM_VERSION} \
148 rw.ui-logging-
${PLATFORM_VERSION} \
149 rw.ui-skyquake-
${PLATFORM_VERSION} \
150 rw.ui-accounts-
${PLATFORM_VERSION} \
151 rw.ui-composer-
${PLATFORM_VERSION} \
152 rw.ui-launchpad-
${PLATFORM_VERSION} \
153 rw.ui-debug-
${PLATFORM_VERSION} \
154 rw.ui-config-
${PLATFORM_VERSION} \
155 rw.ui-dummy_component-
${PLATFORM_VERSION}
158 # install some base files used to create VNFs
159 test -d /usr
/rift
/images || mkdir
/usr
/rift
/images
160 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
161 test -f /usr
/rift
/images
/$file || curl
-o /usr
/rift
/images
/$file http
://repo.riftio.com
/releases
/open.riftio.com
/4.3.1/$file
164 # If you are re-building SO, you just need to run
166 if ! $installSO; then
171 if [[ $UIPathToBuild ]]; then
172 make -C $UIPathToBuild -j16
173 sudo
make -C $UIPathToBuild install
176 echo "To run SO with UI please run:"
177 echo 'sudo -H /usr/rift/rift-shell -r -i /usr/rift -a /usr/rift/.artifacts -- ./demos/launchpad.py --use-xml-mode'
179 echo "To run SO without UI please run:"
180 echo 'sudo -H /usr/rift/rift-shell -r -i /usr/rift -a /usr/rift/.artifacts -- ./demos/launchpad.py --use-xml-mode --no-ui'