blob: 168d9ca057cebb980df82ad7df1eac1d4eb3038b [file] [log] [blame]
tom4d0c6632014-09-15 23:27:01 -07001#!/bin/bash
Pavlin Radoslavov91413792014-10-15 11:00:32 -07002# -----------------------------------------------------------------------------
tom4d0c6632014-09-15 23:27:01 -07003# Starts ONOS Apache Karaf container
Pavlin Radoslavov91413792014-10-15 11:00:32 -07004# -----------------------------------------------------------------------------
tom4d0c6632014-09-15 23:27:01 -07005
Brian O'Connor9362d882015-03-10 11:56:35 -07006# uncomment the following line for performance testing
7#export JAVA_OPTS="${JAVA_OPTS:--Xms8G -Xmx8G -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:+PrintGCDetails -XX:+PrintGCTimeStamps}"
tom5c255702014-09-18 06:57:39 -07008
JunHuy Lam39eb4292015-06-26 17:24:23 +09009# uncomment the following line for Netty TLS encryption
10# Do modify the keystore location/password and truststore location/password accordingly
11#export JAVA_OPTS="${JAVA_OPTS:--DenableNettyTLS=true -Djavax.net.ssl.keyStore=/home/ubuntu/onos.jks -Djavax.net.ssl.keyStorePassword=222222 -Djavax.net.ssl.trustStore=/home/ubuntu/onos.jks -Djavax.net.ssl.trustStorePassword=222222}"
12
Bob Lantz5e4d49d2016-02-25 02:26:45 -080013set -e # exit on error
14set -u # exit on undefined variable
15
16# If ONOS_HOME is set, respect its value.
17# If ONOS_HOME is not set (e.g. in the init or service environment),
18# set it based on this script's path.
19ONOS_HOME=${ONOS_HOME:-$(readlink -e `dirname $0`/..)}
David Bainbridgeff4fb042015-08-17 12:53:29 -070020KARAF_ARGS=
21SYS_APPS=drivers
Bob Lantz5e4d49d2016-02-25 02:26:45 -080022ONOS_APPS=${ONOS_APPS:-} # Empty means don't activate any new apps
Jian Li7343bfa2016-01-27 15:42:05 -080023
Bob Lantz5e4d49d2016-02-25 02:26:45 -080024cd $ONOS_HOME
David Bainbridgeff4fb042015-08-17 12:53:29 -070025
26# Parse out arguments destinted for karaf invocation v. arguments that
27# will be processed in line
28while [ $# -gt 0 ]; do
29 case $1 in
30 apps-clean)
31 # Deactivate all applications
32 find ${ONOS_HOME}/apps -name "active" -exec rm \{\} \;
33 ;;
34 *)
35 KARAF_ARGS+=" $1"
36 ;;
37 esac
38 shift
39done
40
41# Activate the system required applications (SYS_APPS) as well as any
42# specified applications in the var ONOS_APPS
43for app in ${SYS_APPS//,/ } ${ONOS_APPS//,/ }; do
44 if [[ "$app" =~ \. ]]; then
45 touch ${ONOS_HOME}/apps/$app/active
46 else
47 touch ${ONOS_HOME}/apps/org.onosproject.$app/active
48 fi
49done
50
Jonathan Hartf51950d2016-01-15 09:57:10 -080051exec ${ONOS_HOME}/apache-karaf-$KARAF_VERSION/bin/start $KARAF_ARGS