-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathrun.sh
executable file
·49 lines (45 loc) · 1.49 KB
/
run.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
#!/bin/bash
# Start container and start process inside container.
#
# Example:
# ./run.sh Start a sh shell inside container.
# ./run.sh ls -la Run `ls -la` inside container.
#
# Calls to `make` are intercepted and the "O=/buildroot_output" is added to
# command. So calling `./run.sh make savedefconfig` will run `make
# savedefconfig O=/buildroot_output` inside the container.
#
# Example:
# ./run.sh make Run `make O=/buildroot_output` in container.
# ./run.sh make docker_python2_defconfig menuconfig
# Build config based on docker_python2_defconfig.
#
# When working with Buildroot you probably want to create a config, build
# some products based on that config and save the config for future use.
# Your workflow will look something like this:
#
# ./run.sh make docker_python2_defconfig defconfig
# ./run.sh make menuconfig
# ./run.sh make BR2_DEFCONFIG=/root/buildroot/external/configs/docker_python2_defconfig savedefconfig
# ./run.sh make
set -e
OUTPUT_DIR=/buildroot_output
BUILDROOT_DIR=/root/buildroot
DOCKER_RUN="docker run
--rm
-ti
--volumes-from buildroot_output
-v $(pwd)/data:$BUILDROOT_DIR/data
-v $(pwd)/external:$BUILDROOT_DIR/external
-v $(pwd)/rootfs_overlay:$BUILDROOT_DIR/rootfs_overlay
-v $(pwd)/images:$OUTPUT_DIR/images
advancedclimatesystems/buildroot"
make() {
echo "make O=$OUTPUT_DIR"
}
echo $DOCKER_RUN
if [ "$1" == "make" ]; then
eval $DOCKER_RUN $(make) ${@:2}
else
eval $DOCKER_RUN $@
fi