-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·55 lines (46 loc) · 1.34 KB
/
run.sh
File metadata and controls
executable file
·55 lines (46 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env bash
# Get Current Directory
ABS_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" && pwd )
# Select Local or Remote Container
if [ "$1" = "-l" ] || [ "$1" = "--local" ]; then
CONTAINER=ryancramer22/carp-tools:envfix
else
CONTAINER=ryancramer22/carp-tools:latest
fi
TERM=xterm-256color
HOST=asic
if [ ! -d $ABS_DIR/workspace ]; then
mkdir -p $ABS_DIR/workspace
cp -r scripts/ workspace/
cp Makefile workspace
cp -r examples/ workspace/
fi
# Mac Install
if [[ "$OSTYPE" == "darwin"* ]]; then
set -x
xhost -
xhost +localhost
docker run -it --rm \
-v $ABS_DIR/workspace:/home/$HOST/workspace:rw \
-v ~/.ssh:/home/$HOST/.ssh\
-v ~/.gitconfig:/home/$HOST/.gitconfig \
-e DISPLAY=host.docker.internal:0 \
-e "TERM=$TERM"\
--hostname $HOST \
$CONTAINER -s bash
# Linux/WSL Install
else
set -x
xhost local:root
docker run -it --rm \
-v $ABS_DIR/workspace:/home/$HOST/workspace:rw\
-v ~/.ssh:/home/$HOST/.ssh\
-v ~/.gitconfig:/home/$HOST/.gitconfig \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v /mnt/wslg:/mnt/wslg \
-e DISPLAY \
-e "TERM=$TERM"\
--hostname $HOST \
--net=host \
$CONTAINER -s /bin/bash
fi