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