| #!/bin/bash |
| # ----------------------------------------------------------------------------- |
| # Runs the custom version of Buck required by ONOS. |
| # ----------------------------------------------------------------------------- |
| |
| set -e |
| |
| BUCK_URL="http://onlab.vicci.org/onos/third-party/buck-v2016.10.20.01.zip" |
| BUCK_SHA="718ab518bf5edc7e92626e434551396171f3ab5a" |
| REQUIRED_VERSION="buck version 274d79c597589aeac30b39ece59fb78afda78530" |
| |
| [ "-U" = "$1" ] && shift && FORCE_UPDATE=True |
| |
| mkdir -p $ONOS_ROOT/bin |
| pushd $ONOS_ROOT/bin > /dev/null |
| |
| if [ -n "$FORCE_UPDATE" ] || [ ! -f "buck" ] || [ "$REQUIRED_VERSION" != "$(cat .buck_version)" ]; then |
| echo "Downloading Buck..." |
| rm -fr .buck_version buck buck.zip plugins |
| curl -o ./buck.zip -L $BUCK_URL |
| if [ -n "$(which shasum)" ]; then |
| SHA=$(shasum ./buck.zip | cut -d' ' -f1) |
| [ "$SHA" != "$BUCK_SHA" ] && |
| echo "ERROR: Downloaded SHA ($SHA) does not match expected SHA ($BUCK_SHA)" && |
| exit 1 |
| else |
| echo "SHA cannot be verified" |
| fi |
| unzip buck.zip |
| rm buck.zip |
| rm -rf $ONOS_ROOT/buck-out |
| printf "Successfully downloaded Buck to $ONOS_ROOT/bin/buck\n\n" |
| fi |
| popd > /dev/null |
| |
| BUCK=$ONOS_ROOT/bin/buck |
| |
| # Finally, run the Buck command... |
| $BUCK "$@" |