~aleteoryx/muditaos

f82561af5fc12811d7ddb2f12baac9c8527af64b — Radoslaw Wicik 4 years ago 0b7691f
[EGD-5813] Add add to docker group step in bootstrap

Introduce one more step to bootstrap so user doesn't have
to run in manually.
2 files changed, 32 insertions(+), 13 deletions(-)

M config/bootstrap.sh
M doc/quickstart.md
M config/bootstrap.sh => config/bootstrap.sh +27 -2
@@ 18,7 18,18 @@ SCRIPT_DIR="$(dirname ${SCRIPT})"
. ${SCRIPT_DIR}/bootstrap_config
. ${SCRIPT_DIR}/common_scripsts_lib


function test_if_run_as_root() {
    echo -e "\e[32m${FUNCNAME[0]}\e[0m"
    MY_NAME=$(whoami)
    if [[ "${MY_NAME}" == "root" ]]; then
        cat <<-MSGEND
			Please do not run this script as a root.
			Script will ask for your password for taks it needs
			to run as a root (sudo ...)
			MSGEND
        exit 1
    fi
}
function add_to_path() {
    echo -e "\e[32m${FUNCNAME[0]} $1 $2\e[0m"
    TOOL_NAME=$1


@@ 126,6 137,19 @@ function install_docker() {
    fi
}

function add_to_docker_group() {
    DOCKER_GRP="docker"
    if grep -q $DOCKER_GRP /etc/group
    then
        NAME=$(whoami)
        sudo usermod -aG ${DOCKER_GRP} ${NAME}
        cat <<-MSGEND
		Group is updated, please logout and login back so
		the change has come into effect
		MSGEND
    fi
}


BUILD_STEPS=(
        install_hooks


@@ 137,9 161,10 @@ BUILD_STEPS=(
        "add_to_path ${ARM_GCC_PATH_VAR} ${HOME}/${ARM_GCC}/bin"
        "add_to_path ${CMAKE_PATH_VAR} ${HOME}/${CMAKE_NAME}/bin"
        install_docker
        add_to_docker_group
        )


test_if_run_as_root

if [ $# -eq 1 ]; then 
    PARAM=$1

M doc/quickstart.md => doc/quickstart.md +5 -11
@@ 186,33 186,27 @@ git commit
## CI build using Docker
You can build MuditaOS using a Docker container. To do that, follow these steps

1. Get Docker by running `./config/bootstrap.sh 8` or [install it yourself](https://www.docker.com/get-started) (if was not installed previously with `./config/bootstrap 0-`).
1. Get Docker by running `./config/bootstrap.sh 8` or [install it yourself](https://www.docker.com/get-started) (if was not installed previously with `./config/bootstrap.sh 0-`).

2. Add yourself to a `docker` group:

```bash
NAME=$(whoami)
sudo usermod -aG docker ${NAME}
```
After that you have to log out and log back in as groups are set during the login process. To make sure you are in docker group enter the `groups` command and 
you will see the list of groups your user is assigned to.

3. Configure for Linux Debug: 
2. Configure for Linux Debug: 
```bash
./in_docker.sh config linux Debug
```

4. Build linux Debug:
3. Build linux Debug:
```bash
./in_docker.sh make build-linux-Debug
```

5. Build RT1051 Release
4. Build RT1051 Release
```bash
./in_docker.sh config rt1051 Release
./in_docker.sh make build-rt1051-Release
```
6. Build and run tests (Linux only)
5. Build and run tests (Linux only)

```bash
./in_docker.sh make build-linux-Debug