Brian O'Connor

Adding onos-buck file and buck alias

Change-Id: I548aade4802da87707d86c192e1800eb1edeb200
1 +#/bin/bash
2 +# -----------------------------------------------------------------------------
3 +# Runs the custom version of Buck required by ONOS.
4 +# -----------------------------------------------------------------------------
5 +
6 +set -e
7 +
8 +BUCK_URL="https://github.com/bocon13/buck/releases/download/v2016.04.08.01/buck"
9 +BUCK_SHA="e22b6accd43cd3e928fe8e63256ebdc8f0b24cab"
10 +REQUIRED_VERSION="buck version ad0295088e5da2782062636ed97bd4f71c65bddd"
11 +
12 +[ "-U" = "$1" ] && shift && FORCE_UPDATE=True
13 +
14 +mkdir -p $ONOS_ROOT/bin
15 +pushd $ONOS_ROOT/bin > /dev/null
16 +
17 +if [ -n "$FORCE_UPDATE" ] || [ ! -f "buck" ] || [ "$REQUIRED_VERSION" != "$(cat .buck_version)" ]; then
18 + echo "Downloading Buck..."
19 + rm -f .buck_version buck
20 + curl -o ./buck -L $BUCK_URL
21 + if [ -n "$(which shasum)" ]; then
22 + SHA=$(shasum ./buck | cut -d' ' -f1)
23 + [ "$SHA" != "$BUCK_SHA" ] &&
24 + echo "ERROR: Downloaded SHA ($SHA) does not match expected SHA ($BUCK_SHA)" &&
25 + exit 1
26 + else
27 + echo "SHA cannot be verified"
28 + fi
29 + chmod 555 ./buck
30 + echo $(./buck -V 2>/dev/null) > .buck_version
31 + chmod 444 .buck_version
32 + rm -rf ./buck_out
33 + printf "Successfully downloaded Buck to $ONOS_ROOT/bin/buck\n\n"
34 +fi
35 +popd > /dev/null
36 +
37 +# Finally, run the Buck command...
38 +eval $ONOS_ROOT/bin/buck $*
...@@ -198,3 +198,9 @@ alias atttopo='onos-netcfg $OCI $ONOS_ROOT/tools/test/topos/attmpls-cfg.json' ...@@ -198,3 +198,9 @@ alias atttopo='onos-netcfg $OCI $ONOS_ROOT/tools/test/topos/attmpls-cfg.json'
198 198
199 # Load UK topo GEO data 199 # Load UK topo GEO data
200 alias uktopo='onos-netcfg $OCI $ONOS_ROOT/tools/test/topos/uk-cfg.json' 200 alias uktopo='onos-netcfg $OCI $ONOS_ROOT/tools/test/topos/uk-cfg.json'
201 +
202 +# Git annotated one-line log
203 +alias gil='git log --oneline --decorate=short'
204 +
205 +# Buck (if "buck" is not on the PATH)
206 +[ -z "$(which buck)" ] && alias buck="onos-buck"
......