Home | History | Annotate | Download | only in tunnel_monitor
      1 #!/bin/bash
      2 # Copyright (c) PLUMgrid, Inc.
      3 # Licensed under the Apache License, Version 2.0 (the "License")
      4 
      5 # this script:
      6 #  1. checks for bower to be installed
      7 #  2. clones the chord-transitions UI from github
      8 #  3. installs locally the packages required by the UI
      9 
     10 function which_() { hash "$1" &>/dev/null; }
     11 
     12 if [[ ! -d chord-transitions ]]; then
     13   git clone https://github.com/iovisor/chord-transitions.git
     14 fi
     15 
     16 cd chord-transitions
     17 
     18 export PATH=node_modules/.bin:$PATH
     19 
     20 if ! which_ bower; then
     21   if ! which_ npm; then
     22     echo "Error: required binary 'npm' not found, please install nodejs"
     23     exit 1
     24   fi
     25   npm install bower
     26 fi
     27 
     28 if [[ "$(id -u)" = "0" ]]; then
     29   args="--allow-root"
     30 fi
     31 
     32 bower install $args
     33