Stefan Agner 6c79ce0f98
Use git submodule for buildroot (#1445)
* Drop buildroot from git repository

Manage buildroot in a separate git repository and use a git submodule
to include it into the HAOS source tree.

This makes it easier to manage changes to buildroot since it can be
managed by git. A buildroot fork repository is being maintained with
the changes we currently have. It makes the buildroot-patches unnecessary
and should make it easier to rebase and upstream changes to buildroot.

* Remove buildroot-patches

Now that buildroot changes are managed in the buildroot fork repository
there is no need to manage patches in a separate directory.

* Initialize git submodule if necessary

* Move build directory to root

This avoids conflict/local modification issues with the buildroot
git submodule.
2021-07-08 16:19:37 +02:00

27 lines
679 B
Bash
Executable File

#!/bin/bash
set -e
BUILDER_UID="$(id -u)"
BUILDER_GID="$(id -g)"
CACHE_DIR="${CACHE_DIR:-$HOME/hassos-cache}"
ARGS="$*"
COMMAND="${ARGS:-bash}"
sudo mkdir -p "${CACHE_DIR}"
sudo chown -R "${BUILDER_UID}:${BUILDER_GID}" "${CACHE_DIR}"
sudo docker build -t hassos:local .
if [ ! -f buildroot/Makefile ]; then
# Initialize git submodule
git submodule update --init
fi
# Make sure loop devices are present before starting the container
sudo losetup -f > /dev/null
# shellcheck disable=SC2086
sudo docker run -it --rm --privileged \
-v "$(pwd):/build" -v "${CACHE_DIR}:/cache" \
-e BUILDER_UID="${BUILDER_UID}" -e BUILDER_GID="${BUILDER_GID}" \
hassos:local ${COMMAND}