github.com/jlmucb/cloudproxy@v0.0.0-20170830161738-b5aa0b619bc4/go/run/scripts/run_docker.sh (about)

     1  #!/bin/bash
     2  
     3  set -o nounset
     4  set -o errexit
     5  
     6  if [ "$#" -ge 1 ]; then
     7    export TAO_DOMAIN="$1"
     8  elif [ "$TAO_DOMAIN" == "" ]; then
     9  	echo "Must supply the path to an initialized domain, or set \$TAO_DOMAIN."
    10  	exit 1
    11  fi
    12  
    13  gowhich() {
    14  	WHICH=$(which which)
    15  	echo -n "$(PATH="${GOPATH//://bin:}/bin" $WHICH "$1")"
    16  }
    17  
    18  TAO="$(gowhich tao)"
    19  FAKE_PASS=BogusPass
    20  
    21  CLIENT="$(gowhich demo_client).img.tgz"
    22  SERVER="$(gowhich demo_server).img.tgz"
    23  
    24  # Make sure we have sudo privileges before trying to start the tao host
    25  sudo test true
    26  
    27  sudo "$TAO" host start -tao_domain "$TAO_DOMAIN" -pass $FAKE_PASS \
    28  	-hosting docker & # daemon
    29  echo "Waiting for linux_host to start"
    30  sleep 5
    31  
    32  "$TAO" run "docker:$SERVER" --name "/demo_server" & # daemon
    33  echo "Waiting for demo_server to start"
    34  sleep 3
    35  
    36  "$TAO" run "docker:$CLIENT" --link "/demo_server:server"
    37  
    38  echo "Shutting down linux_host"
    39  sudo "$TAO" host stop -tao_domain "$TAO_DOMAIN"