blob: 9b788db77143326defa10fd1d9ff8ea45c9e48c6 [file] [log] [blame]
Ray Milkey594add72016-11-15 14:36:26 -08001#!/bin/bash
Ray Milkey3f274d92018-09-28 14:23:34 -07002
Thomas Vachuska369e3fb2019-01-02 16:38:37 -08003KARAF_VERSION="4.2.2"
4KARAF_BASE_PACKAGE_VERSION="4.2.2"
Ray Milkey594add72016-11-15 14:36:26 -08005KARAF_TARFILE_NAME="apache-karaf-${KARAF_VERSION}.tar"
Ray Milkeyf85df282018-11-01 16:29:39 -07006ADDED_BOOT_FEATURES="kar/${KARAF_VERSION},webconsole/${KARAF_VERSION},scr/${KARAF_VERSION},war/${KARAF_VERSION}"
Ray Milkey594add72016-11-15 14:36:26 -08007
8# fetch the standard karaf bits
9rm -f /tmp/${KARAF_TARFILE_NAME}
Ray Milkeyf85df282018-11-01 16:29:39 -070010curl -o /tmp/${KARAF_TARFILE_NAME}.gz http://repo1.maven.org/maven2/org/onosproject/apache-karaf-offline/${KARAF_BASE_PACKAGE_VERSION}/apache-karaf-offline-${KARAF_BASE_PACKAGE_VERSION}.tar.gz
Ray Milkey594add72016-11-15 14:36:26 -080011
12# get a small cell
13source ${ONOS_ROOT}/tools/dev/bash_profile
14cell borrow 60 1+0
DongRyeol Cha5c0a9f02018-05-17 14:32:55 +090015scp /tmp/${KARAF_TARFILE_NAME}.gz sdn@[${OC1}]:/tmp/${KARAF_TARFILE_NAME}.gz
Ray Milkey594add72016-11-15 14:36:26 -080016
17ssh sdn@${OC1} "
18
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 Milkeyf85df282018-11-01 16:29:39 -070025 # add the extra ONOS default boot features
26 sed -i.old -e 's|kar/${KARAF_VERSION}.*$|${ADDED_BOOT_FEATURES}|' apache-karaf-${KARAF_VERSION}/etc/org.apache.karaf.features.cfg
Ray Milkey594add72016-11-15 14:36:26 -080027
28 # run karaf to fill the maven repo with required artifacts
29 apache-karaf-${KARAF_VERSION}/bin/karaf server 1>/tmp/onos.out 2>/tmp/onos.err &
30
Ray Milkeyf85df282018-11-01 16:29:39 -070031 sleep 30
Ray Milkey594add72016-11-15 14:36:26 -080032
33 # stop karaf and capture the artifacts that were downloaded into the maven repo
34 apache-karaf-${KARAF_VERSION}/bin/karaf stop 1>/tmp/onos.out 2>/tmp/onos.err &
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
46 cd apache-karaf-${KARAF_VERSION}/system
47 tar xf ~/repo.tar
48
49 # create a zipped tar ball of the updated karaf tree
50 cd ~/karaf-offline
51 tar czf ~/karaf-offline.tar.gz apache-karaf-${KARAF_VERSION}
52"
53
54# fetch the new offline karaf tar ball
Ray Milkeyf85df282018-11-01 16:29:39 -070055BUILD_NUMBER="${KARAF_VERSION}-offline-$(date +'%Y%m%d')"
DongRyeol Cha5c0a9f02018-05-17 14:32:55 +090056scp sdn@[${OC1}]:karaf-offline.tar.gz /tmp/${BUILD_NUMBER}.tar.gz
Ray Milkey594add72016-11-15 14:36:26 -080057
58cell return
59
60
61
62
63
64