Ray Milkey | 594add7 | 2016-11-15 14:36:26 -0800 | [diff] [blame] | 1 | #!/bin/bash |
Daniele Moro | 52d13f3 | 2020-01-30 11:53:26 -0800 | [diff] [blame] | 2 | |
Ray Milkey | c9b267c | 2022-01-05 11:33:10 -0800 | [diff] [blame] | 3 | KARAF_BASE_PACKAGE_VERSION="$KARAF_RELEASE_VERSION" |
Ray Milkey | 887c1ca | 2019-02-12 16:55:49 -0800 | [diff] [blame] | 4 | KARAF_TARFILE_NAME="apache-karaf-${KARAF_RELEASE_VERSION}.tar" |
| 5 | ADDED_BOOT_FEATURES="kar/${KARAF_RELEASE_VERSION},webconsole/${KARAF_RELEASE_VERSION},scr/${KARAF_RELEASE_VERSION},war/${KARAF_RELEASE_VERSION}" |
Ray Milkey | 594add7 | 2016-11-15 14:36:26 -0800 | [diff] [blame] | 6 | |
| 7 | # fetch the standard karaf bits |
| 8 | rm -f /tmp/${KARAF_TARFILE_NAME} |
Daniele Moro | 52d13f3 | 2020-01-30 11:53:26 -0800 | [diff] [blame] | 9 | 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 |
Ray Milkey | 594add7 | 2016-11-15 14:36:26 -0800 | [diff] [blame] | 10 | |
Ray Milkey | 594add7 | 2016-11-15 14:36:26 -0800 | [diff] [blame] | 11 | source ${ONOS_ROOT}/tools/dev/bash_profile |
DongRyeol Cha | 5c0a9f0 | 2018-05-17 14:32:55 +0900 | [diff] [blame] | 12 | 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] | 13 | |
| 14 | ssh sdn@${OC1} " |
| 15 | |
Ray Milkey | c9b267c | 2022-01-05 11:33:10 -0800 | [diff] [blame] | 16 | # clear out the existing maven cache |
| 17 | rm -rf ~/.m2/repository |
| 18 | |
Ray Milkey | 594add7 | 2016-11-15 14:36:26 -0800 | [diff] [blame] | 19 | # unroll the base karaf |
| 20 | rm -rf karaf |
| 21 | mkdir karaf |
| 22 | cd karaf |
| 23 | tar xf /tmp/${KARAF_TARFILE_NAME}.gz |
| 24 | |
Ray Milkey | f85df28 | 2018-11-01 16:29:39 -0700 | [diff] [blame] | 25 | # add the extra ONOS default boot features |
Ray Milkey | 887c1ca | 2019-02-12 16:55:49 -0800 | [diff] [blame] | 26 | sed -i.old -e 's|kar/${KARAF_RELEASE_VERSION}.*$|${ADDED_BOOT_FEATURES}|' apache-karaf-${KARAF_RELEASE_VERSION}/etc/org.apache.karaf.features.cfg |
Ray Milkey | 594add7 | 2016-11-15 14:36:26 -0800 | [diff] [blame] | 27 | |
| 28 | # run karaf to fill the maven repo with required artifacts |
Ray Milkey | 887c1ca | 2019-02-12 16:55:49 -0800 | [diff] [blame] | 29 | apache-karaf-${KARAF_RELEASE_VERSION}/bin/karaf server 1>/tmp/onos.out 2>/tmp/onos.err & |
Ray Milkey | 594add7 | 2016-11-15 14:36:26 -0800 | [diff] [blame] | 30 | |
Ray Milkey | f85df28 | 2018-11-01 16:29:39 -0700 | [diff] [blame] | 31 | sleep 30 |
Ray Milkey | 594add7 | 2016-11-15 14:36:26 -0800 | [diff] [blame] | 32 | |
| 33 | # stop karaf and capture the artifacts that were downloaded into the maven repo |
Ray Milkey | 887c1ca | 2019-02-12 16:55:49 -0800 | [diff] [blame] | 34 | apache-karaf-${KARAF_RELEASE_VERSION}/bin/karaf stop 1>/tmp/onos.out 2>/tmp/onos.err & |
Ray Milkey | 594add7 | 2016-11-15 14:36:26 -0800 | [diff] [blame] | 35 | cd ~/.m2/repository |
| 36 | tar cvf ~/repo.tar * |
| 37 | |
| 38 | # start with a fresh karaf and overlay the downloaded artifacts |
| 39 | cd |
| 40 | rm -rf karaf-offline |
| 41 | mkdir karaf-offline |
| 42 | cd karaf-offline |
| 43 | tar xf /tmp/${KARAF_TARFILE_NAME}.gz |
| 44 | |
| 45 | # load the downloaded artifacts into the karaf system directory |
Ray Milkey | 887c1ca | 2019-02-12 16:55:49 -0800 | [diff] [blame] | 46 | cd apache-karaf-${KARAF_RELEASE_VERSION}/system |
Ray Milkey | 594add7 | 2016-11-15 14:36:26 -0800 | [diff] [blame] | 47 | tar xf ~/repo.tar |
| 48 | |
| 49 | # create a zipped tar ball of the updated karaf tree |
| 50 | cd ~/karaf-offline |
Ray Milkey | 887c1ca | 2019-02-12 16:55:49 -0800 | [diff] [blame] | 51 | tar czf ~/karaf-offline.tar.gz apache-karaf-${KARAF_RELEASE_VERSION} |
Ray Milkey | 594add7 | 2016-11-15 14:36:26 -0800 | [diff] [blame] | 52 | " |
| 53 | |
| 54 | # fetch the new offline karaf tar ball |
Ray Milkey | 887c1ca | 2019-02-12 16:55:49 -0800 | [diff] [blame] | 55 | BUILD_NUMBER="${KARAF_RELEASE_VERSION}-offline-$(date +'%Y%m%d')" |
Ray Milkey | c9b267c | 2022-01-05 11:33:10 -0800 | [diff] [blame] | 56 | scp sdn@[${OC1}]:karaf-offline.tar.gz ./apache-karaf-${BUILD_NUMBER}.tar.gz |
Ray Milkey | 594add7 | 2016-11-15 14:36:26 -0800 | [diff] [blame] | 57 | |
Ray Milkey | 594add7 | 2016-11-15 14:36:26 -0800 | [diff] [blame] | 58 | |
| 59 | |
| 60 | |
| 61 | |
| 62 | |
| 63 | |