Ray Milkey | 594add7 | 2016-11-15 14:36:26 -0800 | [diff] [blame] | 1 | #!/bin/bash |
Ray Milkey | 3f274d9 | 2018-09-28 14:23:34 -0700 | [diff] [blame^] | 2 | |
| 3 | KARAF_VERSION="4.2.1" |
Ray Milkey | 594add7 | 2016-11-15 14:36:26 -0800 | [diff] [blame] | 4 | KARAF_TARFILE_NAME="apache-karaf-${KARAF_VERSION}.tar" |
| 5 | BOOT_FEATURES="standard,ssh,scr,war,webconsole" |
| 6 | |
| 7 | # fetch the standard karaf bits |
| 8 | rm -f /tmp/${KARAF_TARFILE_NAME} |
| 9 | curl -o /tmp/${KARAF_TARFILE_NAME}.gz http://onlab.vicci.org/onos/third-party/${KARAF_TARFILE_NAME}.gz |
| 10 | |
| 11 | # get a small cell |
| 12 | source ${ONOS_ROOT}/tools/dev/bash_profile |
| 13 | cell borrow 60 1+0 |
DongRyeol Cha | 5c0a9f0 | 2018-05-17 14:32:55 +0900 | [diff] [blame] | 14 | scp /tmp/${KARAF_TARFILE_NAME}.gz sdn@[${OC1}]:/tmp/${KARAF_TARFILE_NAME}.gz |
Ray Milkey | 594add7 | 2016-11-15 14:36:26 -0800 | [diff] [blame] | 15 | |
| 16 | ssh sdn@${OC1} " |
| 17 | |
| 18 | # unroll the base karaf |
| 19 | rm -rf karaf |
| 20 | mkdir karaf |
| 21 | cd karaf |
| 22 | tar xf /tmp/${KARAF_TARFILE_NAME}.gz |
| 23 | |
| 24 | # set the ONOS default boot features |
| 25 | perl -pi.old -e 's|^(featuresBoot=).*|\1${BOOT_FEATURES}|' apache-karaf-${KARAF_VERSION}/etc/org.apache.karaf.features.cfg |
| 26 | |
| 27 | # run karaf to fill the maven repo with required artifacts |
| 28 | apache-karaf-${KARAF_VERSION}/bin/karaf server 1>/tmp/onos.out 2>/tmp/onos.err & |
| 29 | |
| 30 | sleep 15 |
| 31 | |
| 32 | # stop karaf and capture the artifacts that were downloaded into the maven repo |
| 33 | apache-karaf-${KARAF_VERSION}/bin/karaf stop 1>/tmp/onos.out 2>/tmp/onos.err & |
| 34 | cd ~/.m2/repository |
| 35 | tar cvf ~/repo.tar * |
| 36 | |
| 37 | # start with a fresh karaf and overlay the downloaded artifacts |
| 38 | cd |
| 39 | rm -rf karaf-offline |
| 40 | mkdir karaf-offline |
| 41 | cd karaf-offline |
| 42 | tar xf /tmp/${KARAF_TARFILE_NAME}.gz |
| 43 | |
| 44 | # load the downloaded artifacts into the karaf system directory |
| 45 | cd apache-karaf-${KARAF_VERSION}/system |
| 46 | tar xf ~/repo.tar |
| 47 | |
| 48 | # create a zipped tar ball of the updated karaf tree |
| 49 | cd ~/karaf-offline |
| 50 | tar czf ~/karaf-offline.tar.gz apache-karaf-${KARAF_VERSION} |
| 51 | " |
| 52 | |
| 53 | # fetch the new offline karaf tar ball |
| 54 | BUILD_NUMBER="apache-karaf-${KARAF_VERSION}-offline-$(date +'%Y%m%d')" |
DongRyeol Cha | 5c0a9f0 | 2018-05-17 14:32:55 +0900 | [diff] [blame] | 55 | scp sdn@[${OC1}]:karaf-offline.tar.gz /tmp/${BUILD_NUMBER}.tar.gz |
Ray Milkey | 594add7 | 2016-11-15 14:36:26 -0800 | [diff] [blame] | 56 | |
| 57 | cell return |
| 58 | |
| 59 | |
| 60 | |
| 61 | |
| 62 | |
| 63 | |