tom | 4d0c663 | 2014-09-15 23:27:01 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | #------------------------------------------------------------------------------- |
| 3 | # Packages ONOS distributable into onos.tar.gz |
| 4 | #------------------------------------------------------------------------------- |
| 5 | |
tom | 5c25570 | 2014-09-18 06:57:39 -0700 | [diff] [blame^] | 6 | [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 |
| 7 | . $ONOS_ROOT/tools/build/envDefaults |
tom | 4d0c663 | 2014-09-15 23:27:01 -0700 | [diff] [blame] | 8 | |
| 9 | # Bail on any errors |
| 10 | set -e |
| 11 | |
| 12 | rm -fr $ONOS_STAGE # Remove this when package script is completed |
| 13 | |
| 14 | # Make sure we have the original apache karaf bits first |
| 15 | [ ! -d $M2_REPO ] && echo "M2 repository $M2_REPO not found" && exit 1 |
| 16 | [ ! -f $KARAF_ZIP ] && echo "Apache Karaf bits $KARAF_ZIP not found" && exit 1 |
| 17 | [ -d $ONOS_STAGE ] && echo "ONOS stage $ONOS_STAGE already exists" && exit 1 |
| 18 | |
| 19 | # Create the stage directory and warp into it |
| 20 | mkdir -p $ONOS_STAGE |
| 21 | cd $ONOS_STAGE |
| 22 | |
tom | 5c25570 | 2014-09-18 06:57:39 -0700 | [diff] [blame^] | 23 | # Unroll the Apache Karaf bits, prune them and make ONOS top-level directories. |
| 24 | unzip -q $KARAF_ZIP && rm -rf $KARAF_DIST/demos |
tom | 4d0c663 | 2014-09-15 23:27:01 -0700 | [diff] [blame] | 25 | mkdir bin |
tom | 4d0c663 | 2014-09-15 23:27:01 -0700 | [diff] [blame] | 26 | |
tom | 5c25570 | 2014-09-18 06:57:39 -0700 | [diff] [blame^] | 27 | # Stage the ONOS admin scripts and patch in Karaf service wrapper extras |
tom | 4d0c663 | 2014-09-15 23:27:01 -0700 | [diff] [blame] | 28 | cp -r $ONOS_ROOT/tools/package/bin . |
tom | 5c25570 | 2014-09-18 06:57:39 -0700 | [diff] [blame^] | 29 | cp -r $ONOS_ROOT/tools/package/wrapper/* $KARAF_DIST |
tom | 4d0c663 | 2014-09-15 23:27:01 -0700 | [diff] [blame] | 30 | |
| 31 | # Stage the ONOS bundles |
tom | 5c25570 | 2014-09-18 06:57:39 -0700 | [diff] [blame^] | 32 | mkdir -p $KARAF_DIST/system/org/onlab |
| 33 | cp -r $M2_REPO/org/onlab $KARAF_DIST/system/org/ |
tom | 4d0c663 | 2014-09-15 23:27:01 -0700 | [diff] [blame] | 34 | |
| 35 | # Patch the Apache Karaf distribution file to add ONOS features repository |
| 36 | perl -pi.old -e "s|^(featuresRepositories=.*)|\1,mvn:org.onlab.onos/onos-features/$ONOS_VERSION/xml/features|" \ |
| 37 | $ONOS_STAGE/$KARAF_DIST/etc/org.apache.karaf.features.cfg |
| 38 | |
| 39 | # Patch the Apache Karaf distribution file to load ONOS features |
tom | 5c25570 | 2014-09-18 06:57:39 -0700 | [diff] [blame^] | 40 | perl -pi.old -e 's|^(featuresBoot=.*)|\1,wrapper,onos-api,onos-core,onos-cli,onos-rest,onos-gui,onos-openflow,onos-app-tvue|' \ |
tom | 73d6d1e | 2014-09-17 20:08:01 -0700 | [diff] [blame] | 41 | $ONOS_STAGE/$KARAF_DIST/etc/org.apache.karaf.features.cfg |
tom | 4d0c663 | 2014-09-15 23:27:01 -0700 | [diff] [blame] | 42 | |
| 43 | # Patch the Apache Karaf distribution with ONOS branding bundle |
| 44 | cp $M2_REPO/org/onlab/onos/onos-branding/$ONOS_VERSION/onos-branding-*.jar \ |
tom | 73d6d1e | 2014-09-17 20:08:01 -0700 | [diff] [blame] | 45 | $ONOS_STAGE/$KARAF_DIST/lib |
tom | 4d0c663 | 2014-09-15 23:27:01 -0700 | [diff] [blame] | 46 | |
| 47 | # Now package up the ONOS tar file |
| 48 | cd $ONOS_STAGE_ROOT |
tom | 5c25570 | 2014-09-18 06:57:39 -0700 | [diff] [blame^] | 49 | COPYFILE_DISABLE=1 tar zcf $ONOS_TAR $ONOS_BITS |
| 50 | ls -l $ONOS_TAR >&2 |