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 | a42cb58 | 2016-10-25 15:42:00 -0700 | [diff] [blame] | 9 | # If the BUCK-built bits are newer than the Maven-built bits, use the former. |
| 10 | BUCK_TAR=$ONOS_ROOT/buck-out/gen/tools/package/onos-package/onos.tar.gz |
Yuta HIGUCHI | 34a25d1 | 2017-05-26 09:39:01 -0700 | [diff] [blame] | 11 | if [ -f $BUCK_TAR ] && [ $BUCK_TAR -nt $ONOS_TAR ]; then |
| 12 | rm -f $ONOS_TAR >/dev/null; ln -s $BUCK_TAR $ONOS_TAR |
Ray Milkey | a42cb58 | 2016-10-25 15:42:00 -0700 | [diff] [blame] | 13 | fi |
| 14 | |
Thomas Vachuska | f25c248 | 2018-06-12 13:18:45 -0700 | [diff] [blame] | 15 | # If the Bazel-built bits are newer than the BUCK-built bits, use the former. |
| 16 | # BAZEL_TAR=$ONOS_ROOT/bazel-bin/tools/package/onos.tar.gz |
| 17 | # if [ -f $BAZEL_TAR ] && [ $BAZEL_TAR -nt $BUCK_TAR ]; then |
| 18 | # rm -f $ONOS_TAR >/dev/null; ln -s $BAZEL_TAR $ONOS_TAR |
| 19 | # fi |
| 20 | |
Thomas Vachuska | b3ef9d0 | 2017-01-26 08:51:11 -0800 | [diff] [blame] | 21 | ls -lL $ONOS_TAR && cksum $ONOS_TAR |
Ray Milkey | a42cb58 | 2016-10-25 15:42:00 -0700 | [diff] [blame] | 22 | if [ $? -ne 0 ]; then |
Yuta HIGUCHI | 34a25d1 | 2017-05-26 09:39:01 -0700 | [diff] [blame] | 23 | echo "ONOS archive is unreadable" && exit 1 |
Ray Milkey | a42cb58 | 2016-10-25 15:42:00 -0700 | [diff] [blame] | 24 | fi |
| 25 | |
| 26 | tar tzf ${ONOS_TAR} >/dev/null |
| 27 | if [ $? -ne 0 ]; then |
| 28 | echo "ONOS archive is not a valid tar file" && exit 1 |
| 29 | fi |
| 30 | |
Yuta HIGUCHI | 34a25d1 | 2017-05-26 09:39:01 -0700 | [diff] [blame] | 31 | tar tzf ${ONOS_TAR} | grep -q "onos-${ONOS_POM_VERSION}.*/VERSION" |
Ray Milkey | a42cb58 | 2016-10-25 15:42:00 -0700 | [diff] [blame] | 32 | if [ $? -ne 0 ]; then |
| 33 | echo "ONOS archive does not contain the proper version file" && exit 1 |
| 34 | fi |
| 35 | |
Jon Hall | b84df5d | 2017-01-31 11:19:48 -0800 | [diff] [blame] | 36 | tar tzf ${ONOS_TAR} | grep -q apache-karaf-3.0.8 |
Ray Milkey | a42cb58 | 2016-10-25 15:42:00 -0700 | [diff] [blame] | 37 | if [ $? -ne 0 ]; then |
| 38 | echo "ONOS archive does not contain karaf" && exit 1 |
| 39 | fi |
| 40 | |
| 41 | tar tzf ${ONOS_TAR} | grep -q apps/org.onosproject.openflow |
| 42 | if [ $? -ne 0 ]; then |
| 43 | echo "ONOS archive does not contain openflow app" && exit 1 |
| 44 | fi |
| 45 | |
| 46 | tar tzf ${ONOS_TAR} | grep -q onos-core-net |
| 47 | if [ $? -ne 0 ]; then |
| 48 | echo "ONOS archive does not contain onos-core-net" && exit 1 |
| 49 | fi |