From 32aad35f1550bcdb4c5b876bb04c748a818c9076 Mon Sep 17 00:00:00 2001 From: Yaman Umuroglu <maltanar@gmail.com> Date: Thu, 14 May 2020 21:11:22 +0100 Subject: [PATCH] [Docker] enable running without VIVADO_PATH, color output --- run-docker.sh | 40 +++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/run-docker.sh b/run-docker.sh index b7f844d31..343d9be3a 100755 --- a/run-docker.sh +++ b/run-docker.sh @@ -27,13 +27,27 @@ # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +RED='\033[0;31m' +GREEN='\033[0;32m' +NC='\033[0m' # No Color + +# green echo +gecho () { + echo -e "${GREEN}$1${NC}" +} + +# red echo +recho () { + echo -e "${RED}$1${NC}" +} + if [ -z "$VIVADO_PATH" ];then - echo "For correct implementation please set an environment variable VIVADO_PATH that contains the path to your vivado installation directory" - exit 1 + recho "Please set the VIVADO_PATH that contains the path to your Vivado installation directory." + recho "FINN functionality depending on Vivado or Vivado HLS will not be available." fi if [ -z "$PYNQ_IP" ];then - echo "Please set the PYNQ_IP env.var. to enable PYNQ deployment tests." + recho "Please set the PYNQ_IP env.var. to enable PYNQ deployment tests." fi DOCKER_GID=$(id -g) @@ -74,22 +88,22 @@ VIVADO_IP_CACHE=$BUILD_LOCAL/vivado_ip_cache mkdir -p $BUILD_LOCAL mkdir -p $VIVADO_IP_CACHE -echo "Instance is named as $DOCKER_INST_NAME" -echo "Mounting $BUILD_LOCAL into $BUILD_LOCAL" -echo "Mounting $VIVADO_PATH into $VIVADO_PATH" -echo "Port-forwarding for Jupyter $JUPYTER_PORT:$JUPYTER_PORT" -echo "Port-forwarding for Netron $NETRON_PORT:$NETRON_PORT" -echo "Vivado IP cache dir is at $VIVADO_IP_CACHE" -echo "Using default PYNQ board $PYNQ_BOARD" +gecho "Instance is named as $DOCKER_INST_NAME" +gecho "Mounting $BUILD_LOCAL into $BUILD_LOCAL" +gecho "Mounting $VIVADO_PATH into $VIVADO_PATH" +gecho "Port-forwarding for Jupyter $JUPYTER_PORT:$JUPYTER_PORT" +gecho "Port-forwarding for Netron $NETRON_PORT:$NETRON_PORT" +gecho "Vivado IP cache dir is at $VIVADO_IP_CACHE" +gecho "Using default PYNQ board $PYNQ_BOARD" if [ "$1" = "test" ]; then - echo "Running test suite" + gecho "Running test suite (all tests)" DOCKER_CMD="python setup.py test" elif [ "$1" = "notebook" ]; then - echo "Running Jupyter notebook server" + gecho "Running Jupyter notebook server" DOCKER_CMD="jupyter notebook --ip=0.0.0.0 --port $JUPYTER_PORT notebooks" else - echo "Running container only" + gecho "Running container only" DOCKER_CMD="bash" fi -- GitLab