Thomas Vachuska | f9c8436 | 2015-04-15 11:20:45 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # ----------------------------------------------------------------------------- |
| 3 | # Checks if ONOS bits are available in preparation for install. |
| 4 | # ----------------------------------------------------------------------------- |
| 5 | |
| 6 | [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 |
| 7 | . $ONOS_ROOT/tools/build/envDefaults |
| 8 | |
Ray Milkey | 3933295 | 2018-07-16 13:42:51 -0700 | [diff] [blame] | 9 | # If the bazel-built bits are newer than the buck-built bits, use the former. |
Ray Milkey | a42cb58 | 2016-10-25 15:42:00 -0700 | [diff] [blame] | 10 | BUCK_TAR=$ONOS_ROOT/buck-out/gen/tools/package/onos-package/onos.tar.gz |
Ray Milkey | 3933295 | 2018-07-16 13:42:51 -0700 | [diff] [blame] | 11 | BAZEL_TAR=$ONOS_ROOT/bazel-bin/onos.tar.gz |
| 12 | if [ -f $BAZEL_TAR ] && [ $BAZEL_TAR -nt $ONOS_TAR ]; then |
| 13 | rm -f $ONOS_TAR >/dev/null; ln -s $BAZEL_TAR $ONOS_TAR |
| 14 | else |
| 15 | if [ -f $BUCK_TAR ] && [ $BUCK_TAR -nt $ONOS_TAR ]; then |
| 16 | rm -f $ONOS_TAR >/dev/null; ln -s $BUCK_TAR $ONOS_TAR |
| 17 | fi |
Ray Milkey | a42cb58 | 2016-10-25 15:42:00 -0700 | [diff] [blame] | 18 | fi |
| 19 | |
Thomas Vachuska | b3ef9d0 | 2017-01-26 08:51:11 -0800 | [diff] [blame] | 20 | ls -lL $ONOS_TAR && cksum $ONOS_TAR |
Ray Milkey | a42cb58 | 2016-10-25 15:42:00 -0700 | [diff] [blame] | 21 | if [ $? -ne 0 ]; then |
Yuta HIGUCHI | 34a25d1 | 2017-05-26 09:39:01 -0700 | [diff] [blame] | 22 | echo "ONOS archive is unreadable" && exit 1 |
Ray Milkey | a42cb58 | 2016-10-25 15:42:00 -0700 | [diff] [blame] | 23 | fi |
| 24 | |
| 25 | tar tzf ${ONOS_TAR} >/dev/null |
| 26 | if [ $? -ne 0 ]; then |
| 27 | echo "ONOS archive is not a valid tar file" && exit 1 |
| 28 | fi |
| 29 | |
Yuta HIGUCHI | 34a25d1 | 2017-05-26 09:39:01 -0700 | [diff] [blame] | 30 | tar tzf ${ONOS_TAR} | grep -q "onos-${ONOS_POM_VERSION}.*/VERSION" |
Ray Milkey | a42cb58 | 2016-10-25 15:42:00 -0700 | [diff] [blame] | 31 | if [ $? -ne 0 ]; then |
| 32 | echo "ONOS archive does not contain the proper version file" && exit 1 |
| 33 | fi |
| 34 | |
Ray Milkey | 642146d | 2020-07-06 11:30:36 -0700 | [diff] [blame^] | 35 | tar tzf ${ONOS_TAR} | grep -q apache-karaf-4.2.9 |
Ray Milkey | a42cb58 | 2016-10-25 15:42:00 -0700 | [diff] [blame] | 36 | if [ $? -ne 0 ]; then |
| 37 | echo "ONOS archive does not contain karaf" && exit 1 |
| 38 | fi |
| 39 | |
| 40 | tar tzf ${ONOS_TAR} | grep -q apps/org.onosproject.openflow |
| 41 | if [ $? -ne 0 ]; then |
| 42 | echo "ONOS archive does not contain openflow app" && exit 1 |
| 43 | fi |
| 44 | |
| 45 | tar tzf ${ONOS_TAR} | grep -q onos-core-net |
| 46 | if [ $? -ne 0 ]; then |
| 47 | echo "ONOS archive does not contain onos-core-net" && exit 1 |
| 48 | fi |