-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_all_from_src.sh
executable file
·75 lines (62 loc) · 1.93 KB
/
build_all_from_src.sh
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/bash
set -eu
my_dir="$(dirname $(readlink -f $0))"
if echo "$my_dir" | grep -E '/holoocean_tools(/.*)?' >/dev/null 2>&1
then
HOLOOCEAN_DIR="$(echo "$my_dir" | sed -E 's#/holoocean_tools(/.*)?$##')"
else
echo "Unable to detect HoloOcean base folder: $my_dir"
exit 1
fi
HOLOOCEAN_HOST_USER_ID=${HOLOOCEAN_HOST_USER_ID:-$UID}
HOLOOCEAN_HOST_USER_NAME=${HOLOOCEAN_HOST_USER_NAME:-$USER}
HOLOOCEAN_TOOLS_IN_DOCKER=/holoocean/holoocean_tools
function docker_build() {
docker build --network=host --no-cache $@
}
function docker_run() {
docker run --network=host --rm -e HOST_USER_ID=$HOLOOCEAN_HOST_USER_ID -e HOST_USER_NAME=$HOLOOCEAN_HOST_USER_NAME -e TZ=$(cat /etc/timezone) -v $HOLOOCEAN_DIR:/holoocean $@
}
function holoocean_base_image() {
docker_build -t holoocean_base_image_iron:latest --build-arg HOST_USER_ID=$HOLOOCEAN_HOST_USER_ID -f ./Dockerfile ./
}
function unreal_build() {
docker_run holoocean_base_image_iron:latest $HOLOOCEAN_TOOLS_IN_DOCKER/docker/build_unreal.sh $@
}
function holoocean_sim_build() {
docker_run -e HOLODECKPATH=/holoocean/worlds holoocean_base_image_iron:latest $HOLOOCEAN_TOOLS_IN_DOCKER/docker/build_holoocean_develop.sh $@
}
scriptname="$0"
tasks=$(cat $scriptname | grep '^function' | grep -v docker_run | grep -v docker_build | sed 's/function \([a-z][a-z_]*\).*/\1/')
tasks_to_run=""
skipping=1
startfrom="${1:-}"
custom_parameter="${2:-}"
if [ "$startfrom" = "help" ]
then
echo "Usage: $0 help | [starting_task_name]"
echo "Available tasks: $tasks"
exit 1
fi
for f in $tasks
do
if [ $skipping -eq 1 ] && [ "$startfrom" != "" ]
then
if [ "$f" != "$startfrom" ]
then
echo "Skipping $f"
continue
fi
skipping=0
fi
tasks_to_run="$tasks_to_run $f"
if [ "$custom_parameter" = "selected_only" ]
then
echo "Only selected task build: $f"
break
fi
done
for f in $tasks_to_run
do
$f
done