forked from FullMetalUpdate/fullmetalupdate-yocto-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStartBuild.sh
executable file
·56 lines (53 loc) · 2.27 KB
/
StartBuild.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
#!/usr/bin/env bash
if [ ! -e ./config.cfg ]; then
echo 'ERROR: config.cfg is missing. This file is used to configure the connectivity between the embedded device and the server. Please copy config.cfg.sample in config.cfg and adapt the configuration to your network setup.'
else
DOCKER_NETWORK_NAME="$(docker network ls --format '{{.Name}}' | grep fmu_network)"
if [ -z "$DOCKER_NETWORK_NAME" ]; then
echo "fmu_network does not seem to exists. Did you run StartServer.sh?"
exit 1
fi
# Check if we are running on Linux or Windows to adapt the path of the source command
unamestr=`uname`
if [[ "$unamestr" == 'Linux' ]]; then
# Check if we are running inside builbot worker to disable --interractive
if [ -n "$BUILDMASTER" ]; then
docker run \
--volume $(pwd)/build:/data \
--volume $(pwd)/yocto-entrypoint.sh:/yocto-entrypoint.sh \
--volume ~/.gitconfig:/home/docker/.gitconfig \
--volume $(pwd)/config.cfg:/home/docker/config.cfg \
--network "$DOCKER_NETWORK_NAME" --tty --rm fullmetalupdate/build-yocto:v1.0 \
yocto $@
else
docker run \
--volume $(pwd)/build:/data \
--volume $(pwd)/yocto-entrypoint.sh:/yocto-entrypoint.sh \
--volume ~/.gitconfig:/home/docker/.gitconfig \
--volume $(pwd)/config.cfg:/home/docker/config.cfg \
--interactive --network "$DOCKER_NETWORK_NAME" --tty --rm fullmetalupdate/build-yocto:v1.0 \
yocto $@
fi
else
# Check if we are running inside builbot worker to disable --interractive
if [ -n "$BUILDMASTER" ]; then
docker volume create yocto_fullmetalupdate
MSYS_NO_PATHCONV=1 docker run \
--volume yocto_fullmetalupdate:/data \
--volume $(pwd)/yocto-entrypoint.sh:/yocto-entrypoint.sh \
--volume ~/.gitconfig:/home/docker/.gitconfig \
--volume $(pwd)/config.cfg:/home/docker/config.cfg \
--network "$DOCKER_NETWORK_NAME" --tty --rm fullmetalupdate/build-yocto:v1.0 \
yocto $@
else
docker volume create yocto_fullmetalupdate
MSYS_NO_PATHCONV=1 docker run \
--volume yocto_fullmetalupdate:/data \
--volume $(pwd)/yocto-entrypoint.sh:/yocto-entrypoint.sh \
--volume ~/.gitconfig:/home/docker/.gitconfig \
--volume $(pwd)/config.cfg:/home/docker/config.cfg \
--interactive --network "$DOCKER_NETWORK_NAME" --tty --rm fullmetalupdate/build-yocto:v1.0 \
yocto $@
fi
fi
fi