blob: fe99f1b9a6adee7c5c252d7138c99c56428e1646 [file] [log] [blame]
#!/bin/bash
# -----------------------------------------------------------------------------
# Checks if ONOS bits are available in preparation for install.
# -----------------------------------------------------------------------------
[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
. $ONOS_ROOT/tools/build/envDefaults
# If the bazel-built bits are newer than the buck-built bits, use the former.
BUCK_TAR=$ONOS_ROOT/buck-out/gen/tools/package/onos-package/onos.tar.gz
BAZEL_TAR=$ONOS_ROOT/bazel-bin/onos.tar.gz
if [ -f $BAZEL_TAR ] && [ $BAZEL_TAR -nt $ONOS_TAR ]; then
rm -f $ONOS_TAR >/dev/null; ln -s $BAZEL_TAR $ONOS_TAR
else
if [ -f $BUCK_TAR ] && [ $BUCK_TAR -nt $ONOS_TAR ]; then
rm -f $ONOS_TAR >/dev/null; ln -s $BUCK_TAR $ONOS_TAR
fi
fi
ls -lL $ONOS_TAR && cksum $ONOS_TAR
if [ $? -ne 0 ]; then
echo "ONOS archive is unreadable" && exit 1
fi
tar tzf ${ONOS_TAR} >/dev/null
if [ $? -ne 0 ]; then
echo "ONOS archive is not a valid tar file" && exit 1
fi
tar tzf ${ONOS_TAR} | grep -q "onos-${ONOS_POM_VERSION}.*/VERSION"
if [ $? -ne 0 ]; then
echo "ONOS archive does not contain the proper version file" && exit 1
fi
tar tzf ${ONOS_TAR} | grep -q apache-karaf-4.2.3
if [ $? -ne 0 ]; then
echo "ONOS archive does not contain karaf" && exit 1
fi
tar tzf ${ONOS_TAR} | grep -q apps/org.onosproject.openflow
if [ $? -ne 0 ]; then
echo "ONOS archive does not contain openflow app" && exit 1
fi
tar tzf ${ONOS_TAR} | grep -q onos-core-net
if [ $? -ne 0 ]; then
echo "ONOS archive does not contain onos-core-net" && exit 1
fi