#!/bin/bash set -e pushd $(cd $(dirname ${0})/..; pwd) > /dev/null bold() { echo "$(tty -s && tput bold)$1$(tty -s && tput sgr0)" } clean() { bold "mxnet clean" rm -rf "./third_party/src/mxnet" } sync() { bold "mxnet sync" [ -d "./third_party/src/mxnet" ] || git clone --quiet --recursive https://github.com/apache/incubator-mxnet.git "./third_party/src/mxnet" pushd "./third_party/src/mxnet" > /dev/null git pull --quiet --prune git submodule sync --quiet git submodule update --quiet --init --recursive popd > /dev/null } metadata() { bold "mxnet metadata" # python3 ./tools/mxnet-script.py } while [ "$#" != 0 ]; do command="$1" && shift case "${command}" in "clean") clean;; "sync") sync;; "metadata") metadata;; esac done