1#!/bin/bash 2# 3# Copyright (c) 2017, the R8 project authors. Please see the AUTHORS file 4# for details. All rights reserved. Use of this source code is governed by a 5# BSD-style license that can be found in the LICENSE file. 6 7function follow_links() { 8 file="$1" 9 while [ -h "$file" ]; do 10 # On Mac OS, readlink -f doesn't work. 11 file="$(readlink "$file")" 12 done 13 echo "$file" 14} 15 16PROG_NAME="$(follow_links $0)" 17PROG_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)" 18R8_ROOT=$PROG_DIR/../.. 19 20CONTAINER_NAME=r8 21HOST_SHARE=$(cd "$R8_ROOT" ; pwd -P) 22CONTAINER_USER=r8 23CONTAINER_HOME=/home/$CONTAINER_USER 24CONTAINER_SHARE=$CONTAINER_HOME/share 25 26ARGS=$@ 27 28docker run \ 29 --volume $HOST_SHARE:$CONTAINER_SHARE \ 30 --rm \ 31 --workdir "$CONTAINER_SHARE" \ 32 r8 \ 33 bash -c "$ARGS" 34 35