diff --git a/README.markdown b/README.markdown index 0f75a1d..4b5889a 100644 --- a/README.markdown +++ b/README.markdown @@ -74,6 +74,8 @@ Mac OS X binaries and libraries are built on host, others using containers. ```sh script/run # Build and test all for all oses and architectures +script/run NO_HALT=1 # Don't halt VMs after building +script/run NO_UP=1 # Don't start VMs before building (will fail if not already running) script/run darwin 64 # Build only platforms matching darwin or 64 make # Build all tools and copy them to vendor/OS-ARCH for current OS and ARCH, then test diff --git a/script/run b/script/run index a231d95..a9943cb 100755 --- a/script/run +++ b/script/run @@ -68,54 +68,57 @@ container_build() { container_name="image_optim_pack-build-$vm" workdir=/pack - status=$("$container_tool" inspect --format '{{.State.Status}}' "$container_name" 2>/dev/null || true) - - if [[ "$status" == "" ]]; then - mount="./_path_:$workdir/_path_" - - "$container_tool" \ - container create \ - --quiet \ - --name="$container_name" \ - --stop-signal SIGHUP \ - -it \ - -v "${mount//_path_/Makefile}":ro \ - -v "${mount//_path_/checksums.mk}":ro \ - -v "${mount//_path_/download}":ro \ - -v "${mount//_path_/patches}":ro \ - -v "${mount//_path_/build/$vm}" \ - -v "${mount//_path_/vendor/$vm}" \ - --workdir "$workdir" \ - "$image" - - "$container_tool" container start "$container_name" - - "$container_tool" exec -it "$container_name" bash -ec " - apt update - apt -y install make gcc g++ chrpath perl pkg-config autoconf automake libtool nasm cmake cargo patch - " - fi - - if [[ "$status" = @(created|exited) ]]; then - "$container_tool" container start "$container_name" - fi - - if [[ "$status" = @(created|exited|running) ]]; then - "$container_tool" exec -it "$container_name" bash -ec " - apt update - apt -y dist-upgrade - rustup update - " - fi - if ! [[ "$status" = @(|created|exited|running) ]]; then - echo "unexpected status $status" - exit 1 + if [[ -z "$NO_UP" ]]; then + status=$("$container_tool" inspect --format '{{.State.Status}}' "$container_name" 2>/dev/null || true) + + if [[ "$status" == "" ]]; then + mount="./_path_:$workdir/_path_" + + "$container_tool" \ + container create \ + --quiet \ + --name="$container_name" \ + --stop-signal SIGHUP \ + -it \ + -v "${mount//_path_/Makefile}":ro \ + -v "${mount//_path_/checksums.mk}":ro \ + -v "${mount//_path_/download}":ro \ + -v "${mount//_path_/patches}":ro \ + -v "${mount//_path_/build/$vm}" \ + -v "${mount//_path_/vendor/$vm}" \ + --workdir "$workdir" \ + "$image" + + "$container_tool" container start "$container_name" + + "$container_tool" exec -it "$container_name" bash -ec " + apt update + apt -y install make gcc g++ chrpath perl pkg-config autoconf automake libtool nasm cmake cargo patch + " + fi + + if [[ "$status" = @(created|exited) ]]; then + "$container_tool" container start "$container_name" + fi + + if [[ "$status" = @(created|exited|running) ]]; then + "$container_tool" exec -it "$container_name" bash -ec " + apt update + apt -y dist-upgrade + rustup update + " + fi + + if ! [[ "$status" = @(|created|exited|running) ]]; then + echo "unexpected status $status" + exit 1 + fi fi "$container_tool" exec -it "$container_name" make $MAKE_TASK - "$container_tool" container stop "$container_name" + [[ -n "$NO_HALT" ]] || "$container_tool" container stop "$container_name" } container_build linux-x86_64 rust