blob: d1f561c3b39c33cae0f8963289a4045e340507ac [file] [log] [blame]
Brian O'Connor9e1352f2016-04-29 17:13:33 -07001#!/bin/bash
2# -----------------------------------------------------------------------------
3# Packages ONOS distributable into onos.tar.gz, onos.zip or a deb file
4# -----------------------------------------------------------------------------
5
6set -e
7
8OUT=$1
9KARAF_TAR=$2
10ONOS_VERSION=$3
11BRANDING=$4
Brian O'Connor92ec2132016-05-03 17:30:25 -070012#FIXME karaf version
13KARAF_VERSION="3.0.5"
14
15PREFIX="onos-1.6.0"
Brian O'Connor9e1352f2016-04-29 17:13:33 -070016
17# Unroll the Apache Karaf bits, prune them and make ONOS top-level directories.
18tar xf $KARAF_TAR
19
20# Unroll the Apache Karaf bits, prune them and make ONOS top-level directories.
21KARAF_DIR=$(ls -d apache*)
22rm -rf $KARAF_DIR/demos
23
24# Patch the log-file size in place to increase it to 10 MB
25perl -pi.old -e "s/maxFileSize=1MB/maxFileSize=10MB/g" \
26 $KARAF_DIR/etc/org.ops4j.pax.logging.cfg
27
28# Patch-in proper Karaf version into the startup script
29sed -i '' "s/apache-karaf-\$KARAF_VERSION/$KARAF_DIR/g" bin/onos-service
30sed -i '' "s/apache-karaf-\$KARAF_VERSION/$KARAF_DIR/g" bin/onos-client
31mv bin/onos-client bin/onos
32chmod a+x bin/onos-service bin/onos
33
Brian O'Connor92ec2132016-05-03 17:30:25 -070034export BOOT_FEATURES="standard,ssh,scr,war,webconsole,onos-api,onos-core,onos-incubator,onos-cli,onos-rest,onos-gui"
Brian O'Connor9e1352f2016-04-29 17:13:33 -070035#FIXME
36#[ "$ONOS_SECURITY_MODE" = true ] && enable_security_mode
37
38# Patch the Apache Karaf distribution file to add ONOS features repository
Brian O'Connor92ec2132016-05-03 17:30:25 -070039perl -pi.old -e "s|^(featuresRepositories=).*|\1mvn:org.apache.karaf.features/standard/$KARAF_VERSION/xml/features,mvn:org.onosproject/onos-features/$ONOS_VERSION/xml/features|" \
Brian O'Connor9e1352f2016-04-29 17:13:33 -070040 $KARAF_DIR/etc/org.apache.karaf.features.cfg
41
42# Patch the Apache Karaf distribution file to load default ONOS boot features
Brian O'Connor92ec2132016-05-03 17:30:25 -070043perl -pi.old -e "s|^(featuresBoot=).*|\1$BOOT_FEATURES|" \
Brian O'Connor9e1352f2016-04-29 17:13:33 -070044 $KARAF_DIR/etc/org.apache.karaf.features.cfg
45
Brian O'Connor92ec2132016-05-03 17:30:25 -070046
Brian O'Connor9e1352f2016-04-29 17:13:33 -070047# Patch the Apache Karaf distribution with ONOS branding bundle
48cp $BRANDING $KARAF_DIR/lib
49
Brian O'Connor92ec2132016-05-03 17:30:25 -070050# **** Moving karaf to subdirectory ****
51mkdir $PREFIX
52mv $KARAF_DIR $PREFIX
53
54# Stage the ONOS admin scripts and patch in Karaf service wrapper extras
55cp -r bin $PREFIX
56cp -r init $PREFIX
57cp -r etc $PREFIX/$KARAF_DIR/etc/
58
Brian O'Connor65c0bdf2016-05-03 18:40:17 -070059zip -q -0 -r $OUT $PREFIX
Brian O'Connor9e1352f2016-04-29 17:13:33 -070060
61#FIXME
62# Stage all builtin ONOS apps for factory install
63#onos-stage-apps $ONOS_STAGE/apps $ONOS_STAGE/$KARAF_DIST/system
64# Mark the org.onosproject.drivers app active by default
65#touch $ONOS_STAGE/apps/org.onosproject.drivers/active
66
67# copy in features and repos
68# Patch in the ONOS version file
69#echo $ONOS_VERSION > $ONOS_STAGE/VERSION
70
71
72#function enable_security_mode() {
73# echo "Enabling security mode ONOS..."
74#
75# # SM-ONOS step 1: downgrade felix config admin
76# FELIX_CFG_ADMIN=${FELIX_CFG_ADMIN:-~/Downloads/org.apache.felix.configadmin-1.6.0.jar}
77# if [ ! -f $FELIX_CFG_ADMIN ]; then
78# echo "Downloading $FELIX_CFG_ADMIN..."
79# curl -sL http://archive.apache.org/dist/felix/org.apache.felix.configadmin-1.6.0.jar > $FELIX_CFG_ADMIN
80# fi
81# [ ! -f $FELIX_CFG_ADMIN ] && \
82# echo "Felix config admin not found: $FELIX_CFG_ADMIN" && exit 1
83#
84# mkdir -p $ONOS_STAGE/$KARAF_DIST/system/org/apache/felix/org.apache.felix.configadmin/1.6.0
85# cp $FELIX_CFG_ADMIN $ONOS_STAGE/$KARAF_DIST/system/org/apache/felix/org.apache.felix.configadmin/1.6.0
86# perl -pi.old -e "s|org.apache.felix.configadmin/1.8.0|org.apache.felix.configadmin/1.6.0|g" \
87# $ONOS_STAGE/$KARAF_DIST/etc/startup.properties
88#
89# # SM-ONOS step 2: stage ONOS Felix framework security (this is already done by karaf assembly); end
90#
91# # SM-ONOS step 3.1: configure karaf
92# perl -pi.old -e "s|#java.security.policy|java.security.policy|" \
93# $ONOS_STAGE/$KARAF_DIST/etc/system.properties
94# perl -pi.old -e "s|#org.osgi.framework.security|org.osgi.framework.security|" \
95# $ONOS_STAGE/$KARAF_DIST/etc/system.properties
96#
97# # SM-ONOS step 3.2: update featuresBoot
98# export BOOT_FEATURES="onos-security,$BOOT_FEATURES"
99#}
100