2021-10-13 23:40:53 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
# Copyright 2021 The Chromium OS Authors. All rights reserved.
|
|
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
|
|
# found in the LICENSE file.
|
|
|
|
|
|
|
|
set -e
|
|
|
|
cd "$(dirname $0)/.."
|
|
|
|
|
2021-11-03 15:49:17 +00:00
|
|
|
cli_args=(
|
2021-10-13 23:40:53 +00:00
|
|
|
--rm
|
|
|
|
--volume $(pwd):/workspace:rw
|
|
|
|
--device /dev/net/tun
|
|
|
|
--device /dev/kvm
|
|
|
|
--volume /dev/log:/dev/log
|
|
|
|
--privileged
|
|
|
|
)
|
|
|
|
|
|
|
|
# Enable interactive mode when running in an interactive terminal.
|
|
|
|
if [ -t 1 ]; then
|
2021-11-03 15:49:17 +00:00
|
|
|
cli_args+=(-it)
|
2021-10-13 23:40:53 +00:00
|
|
|
fi
|
|
|
|
|
2021-11-03 15:49:17 +00:00
|
|
|
# Allow to override the container CLI tool, similar to the Makefile. Try
|
|
|
|
# "docker" first and fall back to "podman".
|
|
|
|
DOCKER=${DOCKER:-$(which docker || which podman)}
|
|
|
|
|
|
|
|
"${DOCKER}" run \
|
|
|
|
${cli_args[@]} \
|
2021-10-13 23:40:53 +00:00
|
|
|
gcr.io/crosvm-packages/crosvm_dev:$(cat tools/impl/dev_container/version) \
|
|
|
|
"$@"
|
|
|
|
|