| #!/bin/bash |
| |
| KARAF_RELEASE_VERSION="4.2.9" |
| KARAF_BASE_PACKAGE_VERSION="4.2.9" |
| KARAF_TARFILE_NAME="apache-karaf-${KARAF_RELEASE_VERSION}.tar" |
| ADDED_BOOT_FEATURES="kar/${KARAF_RELEASE_VERSION},webconsole/${KARAF_RELEASE_VERSION},scr/${KARAF_RELEASE_VERSION},war/${KARAF_RELEASE_VERSION}" |
| |
| # fetch the standard karaf bits |
| rm -f /tmp/${KARAF_TARFILE_NAME} |
| curl -o /tmp/${KARAF_TARFILE_NAME}.gz https://repo1.maven.org/maven2/org/onosproject/apache-karaf-offline/${KARAF_BASE_PACKAGE_VERSION}/apache-karaf-${KARAF_BASE_PACKAGE_VERSION}.tar.gz |
| |
| # get a small cell |
| source ${ONOS_ROOT}/tools/dev/bash_profile |
| cell borrow 60 1+0 |
| scp /tmp/${KARAF_TARFILE_NAME}.gz sdn@[${OC1}]:/tmp/${KARAF_TARFILE_NAME}.gz |
| |
| ssh sdn@${OC1} " |
| |
| # unroll the base karaf |
| rm -rf karaf |
| mkdir karaf |
| cd karaf |
| tar xf /tmp/${KARAF_TARFILE_NAME}.gz |
| |
| # add the extra ONOS default boot features |
| sed -i.old -e 's|kar/${KARAF_RELEASE_VERSION}.*$|${ADDED_BOOT_FEATURES}|' apache-karaf-${KARAF_RELEASE_VERSION}/etc/org.apache.karaf.features.cfg |
| |
| # run karaf to fill the maven repo with required artifacts |
| apache-karaf-${KARAF_RELEASE_VERSION}/bin/karaf server 1>/tmp/onos.out 2>/tmp/onos.err & |
| |
| sleep 30 |
| |
| # stop karaf and capture the artifacts that were downloaded into the maven repo |
| apache-karaf-${KARAF_RELEASE_VERSION}/bin/karaf stop 1>/tmp/onos.out 2>/tmp/onos.err & |
| cd ~/.m2/repository |
| tar cvf ~/repo.tar * |
| |
| # start with a fresh karaf and overlay the downloaded artifacts |
| cd |
| rm -rf karaf-offline |
| mkdir karaf-offline |
| cd karaf-offline |
| tar xf /tmp/${KARAF_TARFILE_NAME}.gz |
| |
| # load the downloaded artifacts into the karaf system directory |
| cd apache-karaf-${KARAF_RELEASE_VERSION}/system |
| tar xf ~/repo.tar |
| |
| # create a zipped tar ball of the updated karaf tree |
| cd ~/karaf-offline |
| tar czf ~/karaf-offline.tar.gz apache-karaf-${KARAF_RELEASE_VERSION} |
| " |
| |
| # fetch the new offline karaf tar ball |
| BUILD_NUMBER="${KARAF_RELEASE_VERSION}-offline-$(date +'%Y%m%d')" |
| scp sdn@[${OC1}]:karaf-offline.tar.gz /tmp/${BUILD_NUMBER}.tar.gz |
| |
| cell return |
| |
| |
| |
| |
| |
| |