Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify handling of crossbuild #72

Merged
merged 2 commits into from
Mar 15, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 5 additions & 28 deletions builder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ DOCKER_PUSH=true
DOCKER_USER=
DOCKER_PASSWORD=
DOCKER_LOCAL=false
CROSSBUILD_CLEANUP=true
SELF_CACHE=false
CUSTOM_CACHE_TAG=
RELEASE_TAG=false
Expand Down Expand Up @@ -115,8 +114,6 @@ Options:
Username to login into docker with
--docker-password
Password to login into docker with
--no-crossbuild-cleanup
Don't cleanup the crosscompile feature (for multiple builds)

Use the host docker socket if mapped into container:
/var/run/docker.sock
Expand Down Expand Up @@ -681,30 +678,14 @@ function extract_machine_build() {
#### initialized cross-build ####

function init_crosscompile() {
bashio::log.info "Setup crosscompiling feature"
(
mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc
update-binfmts --enable qemu-arm
update-binfmts --enable qemu-aarch64
) > /dev/null 2>&1 || bashio::log.warning "Can't enable crosscompiling feature"
}


function clean_crosscompile() {
if [ "$CROSSBUILD_CLEANUP" == "false" ]; then
bashio::log.info "Skeep crosscompiling cleanup"
if [[ "$(uname -m)" != "x86_64" ]]; then
bashio::log.info "No crossbuild support on host"
return 0
fi

bashio::log.info "Clean crosscompiling feature"
if [ -f /proc/sys/fs/binfmt_misc ]; then
umount /proc/sys/fs/binfmt_misc || true
fi

(
update-binfmts --disable qemu-arm
update-binfmts --disable qemu-aarch64
) > /dev/null 2>&1 || bashio::log.warning "No crosscompiling feature found for cleanup"
bashio::log.info "Setup crosscompiling feature"
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes \
> /dev/null 2>&1 || bashio::log.warning "Can't enable crosscompiling feature"
}

#### Error handling ####
Expand Down Expand Up @@ -783,9 +764,6 @@ while [[ $# -gt 0 ]]; do
DOCKER_PASSWORD=$2
shift
;;
--no-crossbuild-cleanup)
CROSSBUILD_CLEANUP=false
;;
--armhf)
BUILD_LIST+=("armhf")
;;
Expand Down Expand Up @@ -950,7 +928,6 @@ fi
wait "${BUILD_TASKS[@]}"

# Cleanup docker env
clean_crosscompile
stop_docker

# No Errors
Expand Down